PPeter CollingbourneFix more compiler-rt tests after #149015.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[compiler-rt] Avoid memintrinsic calls inserted by the compiler D135716 introduced -ftrivial-auto-var-init=pattern where supported. Unfortunately this introduces unwanted memset() for large stack arrays, as shown by the new tests added for asan and msan (tsan already had this test). In general, the problem of compiler-inserted memintrinsic calls (memset/memcpy/memmove) is not new to compiler-rt, and has been a problem before. To avoid introducing unwanted memintrinsic calls, we redefine memintrinsics as __sanitizer_internal_mem* at the assembly level for most source files automatically (where sanitizer_common_internal_defs.h is included). In few cases, redefining a symbol in this way causes issues for interceptors, namely the memintrinsic interceptor themselves. For such source files we have to selectively disable the redefinition. Other alternatives have been considered, but simply do not work well in the context of compiler-rt: 1. Linker --wrap: this does not work because --wrap only applies to the final link, and would not apply when building sanitizer static libraries. 2. Changing references to memset() via objcopy: this may work, but due to the complexities of the build system, introducing such a post-processing step for the right object files (in particular object files defining memset cannot be touched) seems infeasible. The chosen solution works well (as shown by the tests). Other libraries have chosen the same solution where nothing else works (see e.g. glibc's "symbol-hacks.h"). v4: - Add interface attribute to __sanitizer_internal_mem* declarations as well, as otherwise some compilers (MSVC) will complain. - Add SANITIZER_COMMON_NO_REDEFINE_BUILTINS to source files using C++STL, since this could lead to ODR violations (see added comment). v3: - Don't use ALIAS() to alias internal_mem*() functions to __sanitizer_internal_mem*() functions, but just define them as ALWAYS_INLINE functions instead. This will work on darwin and windows. v2: - Fix ubsan_minimal build where compiler decides to insert memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc, therefore do not redefine the builtins. - Fix definition of internal_mem* functions with compilers that want the aliased function to already be defined before. - Fix definition of __sanitizer_internal_mem* functions with compilers more pedantic about attribute placement around extern "C". Reviewed By: vitalybuka, dvyukov Differential Revision: https://reviews.llvm.org/D151152 | 3 年前 | |
[sanitizer] Internalize .preinit_array variables We can use an internal linkage variable to make it clear the variable is not exported. The special section .preinit_array is a GC root. Pull Request: https://github.com/llvm/llvm-project/pull/98584 | 2 年前 | |
[tsan] Add pthread_cond_clockwait interceptor Disable the test on old systems. pthread_cond_clockwait is supported by glibc-2.30. It also supported by Android api 30 even though we do not run tsan on Android. Fixes https://github.com/google/sanitizers/issues/1259 Reviewed By: dvyukov | 5 年前 | |
tsan: enable clone interceptor only on Linux Clone does not exist on Mac. There are chances it will break on other OSes. Enable it incrementally starting with Linux only, other OSes can enable it later as needed. Reviewed By: melver, thakis Differential Revision: https://reviews.llvm.org/D113693 | 4 年前 | |
Fix some small typos in compiler-rt. NFC (#133388) | 1 年前 | |
[tsan] Convert tests to check 'target=...' Part of the project to eliminate special handling for triples in lit expressions. | 3 年前 | |
[tsan] Replace mem intrinsics with calls to interceptors After https://reviews.llvm.org/rG463aa814182a23 tsan replaces llvm intrinsics with calls to glibc functions. However this approach is fragile, as slight changes in pipeline can return llvm intrinsics back. In particular InstCombine can do that. Msan/Asan already declare own version of these memory functions for the similar purpose. KCSAN, or anything that uses something else than compiler-rt, needs to implement this callbacks. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D133268 | 3 年前 | |
tsan: avoid false positives related to epoll An application can use the mere fact of epoll_wait returning an fd as synchronization with the write on the fd that triggered the notification. This pattern come up in an internal networking server (b/229276331). If an fd is added to epoll, setup a link from the fd to the epoll fd and use it for synchronization as well. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D124518 | 4 年前 | |
tsan: add another fork deadlock test The test tries to provoke internal allocator to be locked during fork and then force the child process to use the internal allocator. This test sometimes deadlocks with the new tsan runtime. Depends on D114514. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D114515 | 4 年前 | |
tsan: add a simple syscall test Add a simple test that uses syscall annotations. Just to ensure at least basic functionality works. Also factor out annotated syscall wrappers into a separate header file as they may be useful for future tests. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D102223 | 5 年前 | |
Fix more compiler-rt tests after #149015. | 1 年前 | |
compiler-rt: Rename .cc file in test/tsan to .cpp Like r367463, but for test/tsan. llvm-svn: 367656 | 6 年前 | |
compiler-rt: Rename .cc file in test/tsan to .cpp Like r367463, but for test/tsan. llvm-svn: 367656 | 6 年前 | |
tsan: fix crash during thread exit Use of gethostent provokes caching of some resources inside of libc. They are freed in __libc_thread_freeres very late in thread lifetime, after our ThreadFinish. __libc_thread_freeres calls free which previously crashed in malloc hooks. Fix it by setting ignore_interceptors for finished threads, which in turn prevents malloc hooks. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D113989 | 4 年前 | |
| 2 年前 | ||
tsan: fix latent race size bug in test The test contains a race in read/write syscalls. The size of reported race depends on how the accessed memory range split into granules inside of tsan runtime. The test used to report access of size 8, because presumably the buffer ended up being aligned to 8 bytes. But after some unrelated changes this test started to report accesses of size 1 (presumably .data layout changed), which makes the test fail. Guarantee alignment of the buf object explicitly. Reviewed By: vitalybuka, melver Differential Revision: https://reviews.llvm.org/D107131 | 4 年前 | |
tsan: fix syscall test on aarch64 Add missing includes and use SYS_pipe2 instead of SYS_pipe as it's not present on some arches. Differential Revision: https://reviews.llvm.org/D102311 | 5 年前 | |
tsan: add pthread_tryjoin_np and pthread_timedjoin_np interceptors Add pthread_tryjoin_np() and pthread_timedjoin_np() interceptors on Linux, so that ThreadSanitizer can handle programs using these functions. Author: Yuri Per (yuri) Reviewed in: https://reviews.llvm.org/D54521 llvm-svn: 347383 | 7 年前 | |
tsan: add pthread_tryjoin_np and pthread_timedjoin_np interceptors Add pthread_tryjoin_np() and pthread_timedjoin_np() interceptors on Linux, so that ThreadSanitizer can handle programs using these functions. Author: Yuri Per (yuri) Reviewed in: https://reviews.llvm.org/D54521 llvm-svn: 347383 | 7 年前 | |
compiler-rt: Rename .cc file in test/tsan to .cpp Like r367463, but for test/tsan. llvm-svn: 367656 | 6 年前 | |
compiler-rt: Rename .cc file in test/tsan to .cpp Like r367463, but for test/tsan. llvm-svn: 367656 | 6 年前 |