summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-06-25Disable ASan interceptorsaccepted/tizen/base/x/asan/20240626.010335accepted/tizen/base/toolchain/20240723.163727sandbox/dkson95/asanyaroslav3-2/+16
Conditioning the interceptors by SANITIZER_TIZEN and SANITIZER_RISCV64 Change-Id: I53eb96d6b58f2c22ad3db5c1b56186173fa4e5c1 Signed-off-by: yaroslav <y.yamshchiko@samsung.com>
2024-06-25libsanitizer: add filtering of sleep intervals for BackgroundThread.Andrey Drobyshev4-1/+153
Previously sleep interval length of BackgroundThread was determined by a hardcoded value, thus limiting time resolution of dependent tools, such as Heap Profiler. This commit implements simple algorithm which remembers last several sleeps (namely 2), their durations and whether or not they were followed by some interesting events (i.e. delivery of some memory usage statistics). Then it tries to predict an optimal sleep length for the next time, changing it dynamically. Change-Id: Ia95cc5ac60ff9ac9edaa8b7b99e319c0bce80ea7 Signed-off-by: Andrey Drobyshev <a.drobyshev@samsung.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com> Signed-off-by: yaroslav <y.yamshchiko@samsung.com>
2024-06-25libsanitizer: re-implement heap profiler.Dmitriy Evgenevich Gonzha6-18/+335
In the previos heap profiler implementation HeapProfile instance was created every time BackgroundThread wanted to collect statistical data. This commit simply applies the singleton pattern: now there's only one HeapProfile object which can both decide wether it's time to collect the statistics and print profiling data. Change-Id: I509de33174ff0114428d66394e0ef06116b0a9a9 Signed-off-by: Andrey Drobyshev <a.drobyshev@samsung.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com> Signed-off-by: yaroslav <y.yamshchiko@samsung.com>
2024-06-25[libsanitizer] Switch RISC-V 64 Virtual Address detection to dynamicSlava Barinov1-3/+2
Upstream sanitizers for riscv64 only support 39-bit address space accordingly to RISC-V 64 specification. But when executed under qemu-user-riscv64 on x86_64 host the address space bitness mismatches which leads to internal stack errors inside AddrInMem() checks. And the check fails correctly: x86_64 bit host kernel allocates the stack in High Mem segment like 0x7fe000000000 which just does not fit into the 39-bit memory model. This patch switches the sanitizer to dynamic detection of address space, which might formally violate the spec, but allows sanitized binaries to be executed under qemu-user-riscv64 on x86_64 host. Change-Id: I55946dc612cc73bf5f60c34e53296eab74622f4f Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-23packaging: add riscv64 to LSAN/ TSANaccepted/tizen/base/x/asan/20240624.231502accepted/tizen/base/x/20240612.012456sandbox/dkson95/14.1.0Dongkyun Son5-10/+10
Change-Id: I8fee2abc1f50ab61ea3a179ad33d4bfa247c3f5a Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
2024-05-13FIXME: fix rebase build issues with GCC-14.1.0Dongkyun Son2-2/+2
related commits : - bffde000fc38be874c6cda245e9d2f7dfc7a5afa - 170fe0f7ae46cfa40069ab9b42f288d5f359dbbf Change-Id: I544d08d0ca0a32c9fe4ffdce06b1b17b673c233c Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
2024-05-13packaging: bump-up version 14.1.0Dongkyun Son5-5/+5
Change-Id: I01c4e139c67289f1398de7583091ad20ee851bbe Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
2024-05-13[gcc] Fix the CFLAGS/CXXFLAGS cleanupSlava Barinov2-7/+19
Currently the sed command line is wrong for sed in configure script and therefore composition of -Os with -Wl,-O1 results into wrong command line. Change-Id: I0a0e8e908956e0435f3f404373aec9e6648eb2f7 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-13packaging: Enable LSan for ix86Dongkyun Son5-5/+5
https://github.sec.samsung.net/RS-TizenStudio/tizen-gnu-toolchain-upgrade/issues/46 Change-Id: I43c3919dd7e297cc62c632be5176d26b2181a821 Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
2024-05-13packaging: Enable LSan for %armSlava Barinov5-5/+5
Change-Id: I7427bea84bf7593ac72c27d24148ad6296616fad Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-13[ASan] Add __libc_siglongjmp/__libc_longjmp interceptorsMikhail Kashkarov2-0/+24
Change-Id: Ic247cb33f17743fa597b3a74baf7cf31c075165d
2024-05-13[LSan] Add dynamic loading support for LSan libraryVyacheslav Cherkashin1-2/+10
The LSan library has very big static TLS section Problem: - LSan library could not be loaded dynamically because it had a very big static TLS section. AllocatorCache: ~15KB for 32bit ~53KB for 64bit Solution: - Store in the TLS section only a pointer to the AllocatorCache and dynamically allocate memory for it. Change-Id: I6e90e6682e277c90825938f5732867b6564d62b4 Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
2024-05-13[THUMB2] Frame pointer for arm with THUMB2 mode.Denis Khalikov4-29/+240
Set frame pointer to the predictable location in the stack frame for arm with THUMB2 mode. Denis Khalikov <d.khalikov@partner.samsung.com> * config/arm/arm.c (arm_emit_multi_reg_pop_no_return): New function. (arm_compute_initial_elimination_offset): Add support for TARGET_THUMB_STACK_UNWIND. (arm_expand_prologue): Emit function prologue related to TARGET_THUMB_STACK_UNWIND. (thumb2_expand_return): Emit function epilogue related to TARGET_THUMB_STACK_UNWIND. (arm_expand_epilogue): Emit function epilogue related to TARGET_THUMB_STACK_UNWIND. * config/arm/arm.h (TARGET_THUMB_STACK_UNWIND): New define. (INITIAL_ELIMINATION_OFFSET): Add support for TARGET_THUMB_STACK_UNWIND. * config/arm/arm.opt: Add compile-time option THUMB_FP. * gcc/testsuite/c-c++-common/asan/fast-unwind-thumb.c: New tests. Change-Id: I45a68a1216f3115c5199e5cea14c344fabe11fc1
2024-05-13[ASan] Add FORTIFY_SOURCE interceptorsDenis Khalikov16-0/+869
List of interceptors: __strcat_chk, __strncat_chk, __strcpy_chk, __strncpy_chk. __poll_chk, __ppoll_chk, __read_chk, __recv_chk, __recvfrom_chk, __pread_chk, __pread64_chk. __getgroups_chk, __getcwd_chk, __realpath_chk, __confstr_chk. __mbstowcs_chk, __mbsrtowcs_chk, __mbsnrtowcs_chk, __wcstombs_chk, __wcsrtombs_chk, __wcsnrtombs_chk, __wcrtomb_chk, __ttyname_r_chk. Change-Id: I16ef4d2d80089b96e5c51ea5160b706b35f9ce18
2024-05-13[ASan] Add tests of interceptor for printf_chkDenis Khalikov4-0/+133
Differential Revision: https://reviews.llvm.org/D40951 Change-Id: I7c32945659da4cf80e995370cb26fb063bb7930c
2024-05-09[TTC-8][Sanitizers] Add tests for allocator_may_return_null=1 flagSlava Barinov9-0/+186
The LLVM test has been rewritten to be able to run inside GCC test suite. Change-Id: Ifaf9e3681ddacfaad73a314a01ab3c6c7704d40b Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09[TTC-9] Make LSan compliant with recovery mode when running on top of ASanSlava Barinov3-0/+40
Don't overwrite exit code in LSan when running on top of ASan in recovery mode to avoid breakage of users code due to found leaks. Change-Id: I172f59734837d3df350c9e586ace2547ae9f3f23 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Add ChangeLog.TizenSangmin Seo1-0/+337
ChangeLog.Tizen is to keep track of private patches for Tizen GCC. Change-Id: I2fbde58d410ab4a7ddbda361be86a48de9d891e3
2024-05-09Fix cleanup location for try_finally_expr.Slava Barinov16-6/+127
gcc/ * tree.def: Add STATEMENT_LIST_END tree code. * tree.c: Add STATEMENT_LIST_END handling as TS_COMMON. * gimplify.c (gimplify_expr): Use STATEMENT_LIST_END location to provide right information for try_finally_expr. * tree-eh.c (lower_try_finally_onedest): Set finally location * c-family/c-semantics.c (pop_stmt_list): Support single-statement lists extraction with STATEMENT_LIST_END in the end. * fold-const.c (operand_equal_p): Add STATEMENT_LIST_END support. gcc/cp/ * parser.c (cp_parser_compound_statement): Use STATEMENT_LIST_END to keep the location of closing brace. * pt.c: Handle STATEMENT_LIST_END. * constraint.cc (check_function_concept): Handle concept definitions with STATEMENT_LIST_END. * error.c (dump_expr): Add STATEMENT_LIST_END support. gcc/testsuite/ * g++.dg/ext/statement-list-end.C: New. Change-Id: Id22e953b97b52d0f2a2ba44065337a59639578db Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09[UBSAN] Fix systemd initialization with UBSan.Denis Khalikov1-0/+1
In case systemd was build with UBSan we should ensure that /proc is mounted, to prevent booting error. Change-Id: I52016a5e440f311c85f6fe2cad1dfd7966976651 Signed-off-by: Denis Khalikov <d.khalikov@partner.samsung.com>
2024-05-09Switch on detect_leaks on 64-bit platforms by defaultSlava Barinov3-3/+3
libsanitizer/ * asan/asan_flags.cc: Switch on leak detection for 64-bit target. * lsan/lsan.cc: Likewise. * sanitizer_common/sanitizer_flags.inc: Likewise. Neither the OBS build nor sanitized firmware build are affected. When Tizen application developer enables ASan for his own package only and run it in 64-bit emulator (without any additional setup) ASan will report leaks additionally to all other error messages. Change-Id: Id16017e9bbe5221778330287c707bdf1846f0760 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09[sanitizer-coverage] Add stub for trace-pc instrumentationDmitriy Nikiforov1-0/+1
libsanitizer/ * sanitizer_common/sanitizer_coverage_libcdep_new.cc (__sanitizer_cov_trace_pc): New function. Change-Id: I1ead302ccb56c8f20d1a6e29a7cdef8963fa4090 Signed-off-by: Dmitriy Nikiforov <d.nikiforov@partner.samsung.com>
2024-05-09Move SanitizerToolName definition before MaybeMountProcFS.Maxim Ostapenko2-2/+2
The MaybeMountProcFS uses SanitizerToolName in its failure messages so we need it defined at this point. Change-Id: I6a568e1ebf3d646ecfbdb53fd8e48910e9b66559 Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Support asan runtime without /ASAN_OPTIONS fileMikhail Kashkarov1-1/+4
Allow nice host builds with Tizen libasan.
2024-05-09Make lsan-force-options and lsan-build-env more usable. Factor out common ↵Ivan Baravy8-43/+57
code from {A, UB}San to sanitizer_common code. Add -fno-omit-frame-pointer -U_FORTIFY_SOURCE to lsan-force-options because LSan heavily relies on frame pointers. Disable LSan in QEMU builds through LSAN_OPTIONS file. Refactor Tizen specific patches in ASan and UBSan. Change-Id: I5365daee191dd1f61229757b8f47d102390d59a0
2024-05-09Fix ASan tests.Maxim Ostapenko9-17/+77
Some ASan tests fail due to: 1) Unable to unwind malloc trace. 2) Return invalid code due to hant_on_error=false enabled by default. Let's fix this. Change-Id: I634c5bff0e21a693a4168eaa12f443cee114a83e Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Set detect_leaks = false and halt_on_error = false by default.Ivan Baravy4-4/+4
Set detect_leaks and halt_on_error to false by default because mic installs asan-build-env package too late. Change-Id: I497f1f8e6a1e9425e40c8087ea50b14d176a04ce
2024-05-09Remove redundant calls of MaybeMountProcFS and refactor it.Maxim Ostapenko1-7/+2
It seems that we have lots of redundant MaybeMountProcFS, in particular each mapped sanitized shared library calls it from AsanInitializer constructor. Remove redudant MaybeMountProcFS calls from AsanInitializer and __asan_init. Also, it seems that under qemu-aarch64 opening /proc/self/maps for reading might be very expensive, so replace OpenFile("/proc/self/maps", RdOnly) with FileExists("/proc/self/maps") in MaybeMountProcFS to avoid expensive calls. Change-Id: I8ba28dbbc102be519fa2b284520509f601ec5cf7 Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Add git-merge-changelog supportMikhail Kashkarov1-0/+1
Change-Id: I84fc05f8672a17ee7c862595d9c25c86c9f18f27
2024-05-09Fix c-c++-common/asan/pr64820.c testcase to pass output pattern tests underIvan Baravy2-2/+16
qemu-aarch64. Adjust halt_on_error tests. gcc/testsuite/ * c-c++-common/asan/pr64820.c: Adjust output patterns. * c-c++-common/asan/halt_on_error-1.c: Adjust. * c-c++-common/asan/halt_on_error-1.c: Likewise.
2024-05-09Move lsan_check_in_progress definition to lsan_common.cc.Maxim Ostapenko2-1/+3
This commit fixes undefined reference error from libasan.so: /lib/libasan.so: undefined reference to `lsan_check_in_progress' occurred due to ASan runtime embeds part of LSan runtime and misses lsan_check_in_progress symbol. To overcome the issue, just move lsan_check_in_progress definition to lsan_common.cc. Change-Id: I9ed7f4d490d525bbf7ce054285afaec24716f35a Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Add mmap/munmap interceptors.Maxim Ostapenko4-4/+60
Some allocators may use mmap for their local pools that may cause false positive reports because LSan currently doesn't intercept mmap call mainly due to its complexity (we don't know whether a particular mmap would contain live pointers). However for some cases (e.g. anonymous rw mmaps) we can guess that they would contain live pointers thus we can add them into root regions. Thus, now we intercept mmap/munmap calls, add anonymous rw mappings into root regions and call real mmap. Change-Id: Ie0bde91497a31ab670f15d67b34d328969dc0981 Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Make {A, L}San allocator more compact.Maxim Ostapenko2-2/+2
This change tries to reduce memory consumption of {A, L}Saned image by hacking primary allocator internals: * Reduce region size 2^20 -> 2^17. * Make largest chunk size in primary allocator 2^17 -> 2^16. The change appears to be quite useful for LSan'ed image: Stock version: total used free shared buffers cached Mem: 964 828 136 3 4 92 Patched version: total used free shared buffers cached Mem: 964 688 275 5 13 185 Change-Id: I80b95f7dfb5a7be0e7208567a31606a3d027256c Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
2024-05-09Set 0777 mode to sanitizer tool reportSlava Barinov1-1/+1
There are processes which are executed with root permissions and then change the user during run on target. Without setting up the file mode to 0777 trying to write log causes write error and process exits. Change-Id: I88c6738625d67f4db2efea76cc8928d4f58b6e7c Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Support print_cmdline in LSan.Maxim Ostapenko2-1/+3
Change-Id: I65d37582e6b5c3d54f8628e96edbaf4cbfc7c337 Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com> Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
2024-05-09Switch off UBSan for sha1 to reduce number of log messagesSlava Barinov1-0/+1
The sha1 contains intentional unaligned access Change-Id: I5bb6d0c9bf274e8ed0fe4c87c341dee054623202 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Force halt_on_error=true in ASan testsSlava Barinov2-0/+2
Since our ASan does not fail application on error by default we should switch this behaviour on explicitly to keep testsuite work. Change-Id: I4344f82427bc62a40604a75f5f09f62333b6782d Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09* gcc.dg/ubsan/static-init-null.c: New testcaseIvan Baravy1-0/+25
2024-05-09Set 0644 mode to sanitizer tool reportSlava Barinov1-1/+8
Without setting up the file mode explicitly its impossible to read the logs by users in OBS. Change-Id: Icaa540b434fc6266cbd0b1ad3391e21b8cbb692f Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Add binary name printing support to UBSanSlava Barinov2-1/+7
The binary name is needed for reporting with log_path since PID is not always enough to identify the process right. Change-Id: Ibefe22bac9f4d2a89eaacb40e6d7dc860b08d5f9 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Deliver LSan fixes for Tizen.Maxim Ostapenko8-3/+69
* Read LSAN_OPTIONS from /LSAN_OPTIONS file. * Add MaybeMountProcFS stuff for LSan. This would allow us to preload liblsan.so even for systemd when /proc/ isn't mounted yet. * Add ARM and x86 ports for LSan. * Add PointsIntoChunk method to protect against segfault when pointer points to metadata. * Make cf.exitcode = 0 by default. commit a6549ffda72b4f84bbd2c763640181eaeccf6582 Change-Id: I20b10bd29f4ed25e78a61b70dfb82b12c1be352e
2024-05-09Backport Tizen specific stuff from VDLinux 6.Ivan Baravy3-4/+63
Backport from VDLinux 5. Optionally mount /proc in __asan_init to allow systemd sanitization. 2014-10-21 Yury Gribov <y.gribov@samsung.com> JIRA: MAVDT-64 * libsanitizer/asan/asan_rtl.cc (MaybeMountProcFS): New function. (__asan_init): Call MaybeMountProcFS. Mount /proc not only in AsanInitInternal, but also in __asan_init and AsanInitializer to ensure we have proc mounted when needed. * libsanitizer/asan/asan_rtl.cc (__asan_init): Call MaybeMountProcFS. * (AsanInitializer): Likewise. Set address space unlimited if it is not. * libsanitizer/asan/asan_rtl.cc (MaybeDisableUlimit): New function. (AsanInitInternal): Call it. Read ASan and UBSan options from predefined file if it is available. * libsanitizer/asan/asan_flags.cc: Read ASAN_OPTIONS from predefined file if available. * libsanitizer/ubsan/ubsan_flags.cc: Likewise. Change-Id: Ibfa7a3bb032f757e28cf7baac19882a8e4367cae
2024-05-09Add .gbs.conf to align upstream branch with tagDongkyun Son1-0/+5
Change-Id: Icf28ce7c590f459e6e7a851d9de0ac5b997cce34 Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
2024-05-09riscv64: add /lib64 and /usr/lib64 to libdir for gcc driverSlava Barinov1-1/+3
At least until a decision on system-wide %_libdir for RISC-V 64 is made Change-Id: I509acf5263a3f06afd4395b4d72b931789e44454 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09packaging: Add riscv64 platformSlava Barinov6-21/+1382
Change-Id: I377f05d4a027040f22b9c22d361efd9865584132 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09Revert "Do not build libgfortran unless requested explicitly"Dongkyun Son1-5/+2
This reverts commit 15f23fa790a5c3396ce177981d8395152b679266.
2024-05-09packaging: libstdc++exp addedSlava Barinov4-0/+8
Change-Id: I5495f7a6c39462b22f3470380982f5ae1bbd48b1 Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09packaging: enable HWASan for x86_64Slava Barinov4-4/+4
Now the library is built by default Change-Id: I60d5f8a4b82d54556ecf8f70deb597a7047371aa Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2024-05-09packaging: Bump to 13.1.0Slava Barinov4-4/+4
Change-Id: I64c7fc98d709773616da57490647f5a1ae0ea53d
2024-05-09packaging: update math libraries versionDongkyun Son10-24/+24
* gmp-6.1.2 -> 6.2.1 * mpfr-4.0.2 -> 4.2.0 * mpc-1.1.0 -> 1.3.1 Change-Id: Iffc8a68e30dfff976e1b8628f64bcc406b778148 Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>