summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
Commit message (Collapse)AuthorAgeFilesLines
...
* hwasan: Untag unwound stack frames by wrapping personality functions.Peter Collingbourne2019-08-232-3/+13
| | | | | | | | | | | | | | | | | | | | | | | One problem with untagging memory in landing pads is that it only works correctly if the function that catches the exception is instrumented. If the function is uninstrumented, we have no opportunity to untag the memory. To address this, replace landing pad instrumentation with personality function wrapping. Each function with an instrumented stack has its personality function replaced with a wrapper provided by the runtime. Functions that did not have a personality function to begin with also get wrappers if they may be unwound past. As the unwinder calls personality functions during stack unwinding, the original personality function is called and the function's stack frame is untagged by the wrapper if the personality function instructs the unwinder to keep unwinding. If unwinding stops at a landing pad, the function is still responsible for untagging its stack frame if it resumes unwinding. The old landing pad mechanism is preserved for compatibility with old runtimes. Differential Revision: https://reviews.llvm.org/D66377 llvm-svn: 369721
* [sanitizer_common] Extend test after switch to posix_spawnJulian Lettner2019-08-191-0/+2
| | | | llvm-svn: 369311
* [Sanitizer] arc4random interception on MacDavid Carlier2019-08-191-1/+1
| | | | | | | | | | Reviewers: yln,vitalybuka Reviewed By: yln Differential Revision: https://reviews.llvm.org/D66391 llvm-svn: 369285
* [TSan] Add interceptors for os_unfair_lockJulian Lettner2019-08-161-0/+30
| | | | llvm-svn: 369164
* [sanitizer_common] Replace forkpty with posix_spawn on DarwinJulian Lettner2019-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | On Darwin, we currently use forkpty to communicate with the "atos" symbolizer. There are several problems that fork[pty] has, e.g. that after fork, interceptors are still active and this sometimes causes crashes or hangs. This is especially problematic for TSan, which uses interceptors for OS-provided locks and mutexes, and even Libc functions use those. This patch replaces forkpty with posix_spawn on Darwin. Since posix_spawn doesn't fork (at least on Darwin), the interceptors are not a problem. Another benefit is that we'll handle post-fork failures (e.g. sandbox disallows "exec") gracefully now. Related revisions and previous attempts that were blocked by or had to be revered due to test failures: https://reviews.llvm.org/D48451 https://reviews.llvm.org/D40032 Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D65253 llvm-svn: 368947
* [TSan] Fix test failing on LinuxJulian Lettner2019-08-131-1/+1
| | | | llvm-svn: 368641
* [asan_symbolize] Fix bug where the frame counter was not incremented.Dan Liew2019-08-122-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This bug occurred when a plug-in requested that a binary not be symbolized while the script is trying to symbolize a stack frame. In this case `self.frame_no` would not be incremented. This would cause subsequent stack frames that are symbolized to be incorrectly numbered. To fix this `get_symbolized_lines()` has been modified to take an argument that indicates whether the stack frame counter should incremented. In `process_line_posix()` `get_symbolized_lines(None, ...)` is now used in in the case where we don't want to symbolize a line so that we can keep the frame counter increment in a single function. A test case is included. The test uses a dummy plugin that always asks `asan_symbolize.py` script to not symbolize the first binary that the script asks about. Prior to the patch this would cause the output to script to look something like ``` #0 0x0 #0 0x0 in do_access #1 0x0 in main ``` This is the second attempt at landing this patch. The first (r368373) failed due to failing some android bots and so was reverted in r368472. The new test is now disabled for Android. It turns out that the patch also fails for iOS too so it is also disabled for that family of platforms too. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65495 llvm-svn: 368603
* Add support for FreeBSD's LD_32_LIBRARY_PATHDimitry Andric2019-08-103-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Because the dynamic linker for 32-bit executables on 64-bit FreeBSD uses the environment variable `LD_32_LIBRARY_PATH` instead of `LD_LIBRARY_PATH` to find needed dynamic libraries, running the 32-bit parts of the dynamic ASan tests will fail with errors similar to: ``` ld-elf32.so.1: Shared object "libclang_rt.asan-i386.so" not found, required by "Asan-i386-inline-Dynamic-Test" ``` This adds support for setting up `LD_32_LIBRARY_PATH` for the unit and regression tests. It will likely also require a minor change to the `TestingConfig` class in `llvm/utils/lit/lit`. Reviewers: emaste, kcc, rnk, arichardson Reviewed By: arichardson Subscribers: kubamracek, krytarowski, fedor.sergeev, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65772 llvm-svn: 368516
* [Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptrJulian Lettner2019-08-091-0/+45
| | | | | | | | | | | | | | | | | Ensure that malloc_default_zone and malloc_zone_from_ptr return the sanitizer-installed malloc zone even when MallocStackLogging (MSL) is requested. This prevents crashes in certain situations. Note that the sanitizers and MSL cannot be used together. If both are enabled, MSL functionality is essentially deactivated since it only hooks the default allocator which is replaced by a custom sanitizer allocator. rdar://53686175 Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D65990 llvm-svn: 368492
* Revert "[asan_symbolize] Fix bug where the frame counter was not incremented."Mitch Phillips2019-08-092-79/+0
| | | | | | | | | This reverts commit 52a36fae2a3f8560a5be690a67304db5edafc3fe. This commit broke the sanitizer_android buildbot. See comments at https://reviews.llvm.org/rL368373 for more details. llvm-svn: 368472
* [asan_symbolize] Fix bug where the frame counter was not incremented.Dan Liew2019-08-092-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This bug occurred when a plug-in requested that a binary not be symbolized while the script is trying to symbolize a stack frame. In this case `self.frame_no` would not be incremented. This would cause subsequent stack frames that are symbolized to be incorrectly numbered. To fix this `get_symbolized_lines()` has been modified to take an argument that indicates whether the stack frame counter should incremented. In `process_line_posix()` `get_symbolized_lines(None, ...)` is now used in in the case where we don't want to symbolize a line so that we can keep the frame counter increment in a single function. A test case is included. The test uses a dummy plugin that always asks `asan_symbolize.py` script to not symbolize the first binary that the script asks about. Prior to the patch this would cause the output to script to look something like ``` #0 0x0 #0 0x0 in do_access #1 0x0 in main ``` rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D65495 llvm-svn: 368373
* Add LLD as a requirement for hwasan tests because of change in r368111.Douglas Yung2019-08-081-1/+1
| | | | llvm-svn: 368242
* [HWASan] Use LLD for check-hwasan.Mitch Phillips2019-08-071-1/+1
| | | | | | | | HWASan+globals build fix in rL368111 unfortunately didn't fix the problem when clang_cflags specified -fuse-ld=ld.gold. Change the order to force lld in an attempt to fix the Android sanitizer bot. llvm-svn: 368218
* Require lld for hwasan tests.Peter Collingbourne2019-08-063-2/+5
| | | | | | | | We're using relocations that are unsupported by the version of gold on the bot, so force the use of lld. One of the tests is already using lld, so this should be safe. llvm-svn: 368111
* [TSAN] Fix tsan on FreeBSD after D54889Alexander Richardson2019-08-061-1/+1
| | | | | | | | | | | | | | | | | | Summary: It appears that since https://reviews.llvm.org/D54889, BackgroundThread() crashes immediately because cur_thread()-> will return a null pointer which is then dereferenced. I'm not sure why I only see this issue on FreeBSD and not Linux since it should also be unintialized on other platforms. Reviewers: yuri, dvyukov, dim, emaste Subscribers: kubamracek, krytarowski, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65705 llvm-svn: 368103
* hwasan: Instrument globals.Peter Collingbourne2019-08-062-1/+23
| | | | | | | | | | | | | | | | | | Globals are instrumented by adding a pointer tag to their symbol values and emitting metadata into a special section that allows the runtime to tag their memory when the library is loaded. Due to order of initialization issues explained in more detail in the comments, shadow initialization cannot happen during regular global initialization. Instead, the location of the global section is marked using an ELF note, and we require libc support for calling a function provided by the HWASAN runtime when libraries are loaded and unloaded. Based on ideas discussed with @evgeny777 in D56672. Differential Revision: https://reviews.llvm.org/D65770 llvm-svn: 368102
* [compiler-rt] Implement getrandom interceptionVitaly Buka2019-08-061-0/+22
| | | | | | | | | | | | | | | | | | | | | | | Summary: Straightforward implementation of `getrandom` syscall and libc hooks. Test Plan: Local MSAN failures caused by uninstrumented `getrandom` calls stop failing. Patch by Andrew Krieger. Reviewers: eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, kubamracek, dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65551 llvm-svn: 367999
* hwasan: Untag global variable addresses in tests.Peter Collingbourne2019-08-0514-42/+99
| | | | | | | | | | | | Once we start instrumenting globals, all addresses including those of string literals that we pass to the operating system will start being tagged. Since we can't rely on the operating system to be able to cope with these addresses, we need to untag them before passing them to the operating system. This change introduces a macro that does so and uses it everywhere it is needed. Differential Revision: https://reviews.llvm.org/D65768 llvm-svn: 367938
* compiler-rt: Remove .cc from all lit config filesNico Weber2019-08-0513-13/+13
| | | | | | All cc files have been renamed to cpp now. llvm-svn: 367911
* Follow-up for r367863 and r367656Nico Weber2019-08-052-2/+2
| | | | llvm-svn: 367888
* compiler-rt: Rename cc files below test/asan to cppNico Weber2019-08-05419-349/+349
| | | | | | See r367803 and similar other changes. llvm-svn: 367887
* compiler-rt: Rename cc files below test/sanitizer_common to cppNico Weber2019-08-05120-24/+24
| | | | | | See r367803 and similar other changes. llvm-svn: 367863
* compiler-rt: Rename remaining cc files in test/profile to cppNico Weber2019-08-057-9/+9
| | | | | | See r367803 and similar other changes. llvm-svn: 367858
* More follow-up to r367851Nico Weber2019-08-053-3/+3
| | | | llvm-svn: 367856
* compiler-rt: Rename last few cc files below test/ubsan to cppNico Weber2019-08-055-4/+4
| | | | | | See r367803 and similar other changes. llvm-svn: 367855
* compiler-rt: Rename .cc file in test/dfsan to cppNico Weber2019-08-052-1/+1
| | | | | | See r367849 et al. llvm-svn: 367854
* compiler-rt: Rename cc files in test/hwasan/TestCases subdirectories as wellNico Weber2019-08-054-0/+0
| | | | | | Should've been part of r367849. llvm-svn: 367851
* compiler-rt: Rename .cc file in test/hwasan to .cppNico Weber2019-08-0513-6/+6
| | | | | | Like r367463, but for test/hwasan. llvm-svn: 367849
* compiler-rt: Rename .cc file in test/lsan to .cppFangrui Song2019-08-0536-0/+0
| | | | | | Like r367463, but for test/lsan. llvm-svn: 367803
* compiler-rt: Rename .cc file in test/tsan to .cppFangrui Song2019-08-02235-47/+47
| | | | | | Like r367463, but for test/tsan. llvm-svn: 367656
* compiler-rt: Rename .cc file in test/msan to .cppFangrui Song2019-08-02136-78/+78
| | | | | | Like r367463, but for test/msan. llvm-svn: 367653
* compiler-rt: Rename .cc file in test/xray to .cppFangrui Song2019-08-0229-1/+1
| | | | | | | | | Like r367463, but for test/xray. Update test/xray/lit.cfg.py config.suffixes to remove .cc (we actually don't have .c tests now) llvm-svn: 367652
* try to fix bots more after r367562Nico Weber2019-08-011-6/+6
| | | | llvm-svn: 367587
* try to fix bots after r367562Nico Weber2019-08-011-3/+3
| | | | llvm-svn: 367586
* compiler-rt: Rename .cc file in lib/tsan/rtl to .cppNico Weber2019-08-013-3/+3
| | | | | | Like r367463, but for tsan/rtl. llvm-svn: 367564
* compiler-rt: Rename .cc file in lib/msan to .cppNico Weber2019-08-012-11/+11
| | | | | | Like r367463, but for msan. llvm-svn: 367562
* compiler-rt: Rename .cc file in lib/asan to .cppNico Weber2019-08-011-3/+3
| | | | | | Like r367463, but for asan. llvm-svn: 367558
* compiler-rt: Rename .cc file in lib/sanitizer_common to .cppNico Weber2019-07-311-1/+1
| | | | | | | | | | | See https://reviews.llvm.org/D58620 for discussion, and for the commands I ran. In addition I also ran for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done and manually updated (many) references to renamed files found by that. llvm-svn: 367463
* compiler-rt: Rename .cc files in lib/ubsan to .cpp.Nico Weber2019-07-311-1/+1
| | | | | | | | | | | See https://reviews.llvm.org/D58620 for discussion, and for the commands I ran. In addition I also ran for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done and manually updated references to renamed files found by that. llvm-svn: 367452
* [Sanitizer][ASAN][MSAN] Fix infinite recursion on FreeBSDAlexander Richardson2019-07-313-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: MSAN was broken on FreeBSD by https://reviews.llvm.org/D55703: after this change accesses to the key variable call __tls_get_addr, which is intercepted. The interceptor then calls GetCurrentThread which calls MsanTSDGet which again calls __tls_get_addr, etc... Using the default implementation in the SANITIZER_FREEBSD case fixes MSAN for me. I then applied the same change to ASAN (introduced in https://reviews.llvm.org/D55596) but that did not work yet. In the ASAN case, we get infinite recursion again during initialization, this time because calling pthread_key_create() early on results in infinite recursion. pthread_key_create() calls sysctlbyname() which is intercepted but COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED returns true, so the interceptor calls internal_sysctlbyname() which then ends up calling the interceptor again. I fixed this issue by using dlsym() to get the libc version of sysctlbyname() instead. This fixes https://llvm.org/PR40761 Reviewers: vitalybuka, krytarowski, devnexen, dim, bsdjhb, #sanitizers, MaskRay Reviewed By: MaskRay Subscribers: MaskRay, emaste, kubamracek, jfb, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65221 llvm-svn: 367442
* [builtins][test] XFAIL two SPARC testsRainer Orth2019-07-302-0/+8
| | | | | | | | | | | | | | | | Two SPARC builtins tests are currently FAILing due to codegen bugs: Builtins-sparc-sunos :: divtc3_test.c Builtins-sparcv9-sunos :: compiler_rt_logbl_test.c Builtins-sparcv9-sunos :: divtc3_test.c I'd like to XFAIL them to reduce testsuite noise. Done as follows, tested on sparcv9-sun-solaris2.11 and x86_64-pc-solaris2.11. Differential Revision: https://reviews.llvm.org/D64796 llvm-svn: 367295
* [ASan][test] XFAIL AddressSanitizer-*-sunos :: ↵Rainer Orth2019-07-301-0/+2
| | | | | | | | | | | | | | | | TestCases/intercept-rethrow-exception.cc on Solaris AddressSanitizer-*-sunos :: TestCases/intercept-rethrow-exception.cc currently FAILs on Solaris. This happens because std::rethrow_exception cannot be intercepted, as detailed in Bug 42703. To account for this and reduce testsuite noise, this patch XFAILs the test. Tested on x86_64-pc-solaris2.11. Differential Revision: https://reviews.llvm.org/D65056 llvm-svn: 367293
* [NFC][ASAN] Add brackets around not commandLei Huang2019-07-231-1/+1
| | | | | | | | | Under certain execution conditions, the `not` command binds to the command the output is piped to rather than the command piping the output. In this case, that flips the return code of the FileCheck invocation, causing a failure when FileCheck succeeds. llvm-svn: 366805
* [TSan] Enable fiber tests on iOS simulatorJulian Lettner2019-07-225-5/+5
| | | | | | | | | These tests *do not* work on device, but they *do* work in the simulator. rdar://53403778 llvm-svn: 366738
* Fix asan infinite loop on undefined symbolSerge Guelton2019-07-201-0/+43
| | | | | | | | | | | | Fix llvm#39641 Recommit of r366413 Differential Revision: https://reviews.llvm.org/D63877 > llvm-svn: 366632 llvm-svn: 366638
* Revert "Fix asan infinite loop on undefined symbol"Serge Guelton2019-07-201-43/+0
| | | | | | | | This reverts commit cbd28cd05bb11e9d76d71c6cc2d38d89dbb1fe1a. Buildbot fail: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/22434/steps/64-bit%20check-asan-dynamic/ llvm-svn: 366634
* Fix asan infinite loop on undefined symbolSerge Guelton2019-07-201-0/+43
| | | | | | | | | | Fix llvm#39641 Recommit of r366413 Differential Revision: https://reviews.llvm.org/D63877 llvm-svn: 366632
* Revert "Fix asan infinite loop on undefined symbol"Matthew Voss2019-07-191-42/+0
| | | | | | | | This reverts commit 8e46275488ca453a24964cb26be0736172ad1db8. This was failing on sanitizer-x86_64-linux and our internal CI. llvm-svn: 366618
* Fix asan infinite loop on undefined symbolSerge Guelton2019-07-191-0/+42
| | | | | | | | | | Fix llvm#39641 Recommit of r366413 Differential Revision: https://reviews.llvm.org/D63877 llvm-svn: 366588
* [compiler-rt] Complete revert of r366413Matthew Voss2019-07-181-42/+0
| | | | | | | Incomplete revert. Mea culpa. This test is failing on sanitizer-x86_64-linux and our internal CI. llvm-svn: 366482
OpenPOWER on IntegriCloud