summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] Add CMake hook to override shadow scale in compiler_rtWalter Lee2017-11-133-0/+7
| | | | | | | | | | | | Allow user to override shadow scale in compiler_rt by passing -DCOMPILER_RT_ASAN_SHADOW_SCALE=n to CMake. Propagate the override shadow scale value via a compiler define to compiler-rt and asan tests. Tests will use the define to partially disable unsupported tests. Set "-mllvm -asan-mapping-scale=<n>" for compiler_rt tests. Differential Revision: https://reviews.llvm.org/D39469 llvm-svn: 318038
* [asan] Use dynamic shadow on 32-bit Android.Evgeniy Stepanov2017-11-106-3/+142
| | | | | | | | | | | | | | | | | | | Summary: The following kernel change has moved ET_DYN base to 0x4000000 on arm32: https://marc.info/?l=linux-kernel&m=149825162606848&w=2 Switch to dynamic shadow base to avoid such conflicts in the future. Reserve shadow memory in an ifunc resolver, but don't use it in the instrumentation until PR35221 is fixed. This will eventually let use save one load per function. Reviewers: kcc Subscribers: aemerson, srhines, kubamracek, kristof.beyls, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D39393 llvm-svn: 317943
* [sanitizer] Remove unused <signal.h> which conflicts with asan declarationsVitaly Buka2017-11-101-1/+0
| | | | llvm-svn: 317871
* [sanitizer] Remove unneeded forward declaration of real_sigactionVitaly Buka2017-11-101-4/+0
| | | | llvm-svn: 317869
* [sanitizer] Remove unneeded forward declarationsVitaly Buka2017-11-101-4/+0
| | | | llvm-svn: 317868
* [sanitizer] Remove unused <signal.h> which conflicts with asan declarationsVitaly Buka2017-11-101-1/+0
| | | | llvm-svn: 317867
* [sanitizer] Allow sanitizers to redefine implementation of signal interceptorsVitaly Buka2017-11-091-2/+7
| | | | | | | | | | Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D39870 llvm-svn: 317843
* [sanitizers] Rename GetStackTraceWithPcBpAndContextVitaly Buka2017-11-092-28/+23
| | | | | | Name does not need to enumerate arguments. llvm-svn: 317774
* [Sanitizers, CMake] Also use version script for libclang_rt.asan-i386.soEvgeniy Stepanov2017-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building LLVM on x86_64-pc-linux-gnu (Fedora 25) with the bundled gcc 6.4.1 which uses gld 2.26.1-1.fc25, the dynamic/Asan-i386-calls-Dynamic-Test and dynamic/Asan-i386-inline-Dynamic-Test tests failed to link with /usr/bin/ld: /var/scratch/gcc/llvm/dist/lib/clang/6.0.0/lib/linux/libclang_rt.asan-i386.so: fork: invalid version 21 (max 0) /var/scratch/gcc/llvm/dist/lib/clang/6.0.0/lib/linux/libclang_rt.asan-i386.so: error adding symbols: Bad value I tried building with a self-compiled gcc 7.1.0 using gld 2.28, but the error remained. It seems the error has been hit before (cf. https://reviews.llvm.org/rL314085), but no real explanation has been found. However, the problem goes away when linking the i386 libclang_rt.asan with a version script just like every other variant is. Not using the version script in this single case dates back to the initial introduction of the version script in r236551, but this change was just checked in without any explanation AFAICT. Since I've not found any other workaround and no reason for not always using the version script, I propose to do so. Tested on x86_64-pc-linux-gnu. Patch by Rainer Orth. Differential Revision: https://reviews.llvm.org/D39795 llvm-svn: 317738
* (NFC) Rename GetMax{,User}VirtualAddress.Evgeniy Stepanov2017-11-072-2/+2
| | | | | | | Future change will introduce GetMaxVirtualAddress that will not take the kernel area into account. llvm-svn: 317638
* [Sanitizers] ASan: detect new/delete calls with mismatched alignment.Alex Shlyapnikov2017-10-259-87/+130
| | | | | | | | | | | | | | | | | | | ASan allocator stores the requested alignment for new and new[] calls and on delete and delete[] verifies that alignments do match. The representable alignments are: default alignment, 8, 16, 32, 64, 128, 256 and 512 bytes. Alignments > 512 are stored as 512, hence two different alignments > 512 will pass the check (possibly masking the bug), but limited memory requirements deemed to be a resonable tradeoff for relaxed conditions. The feature is controlled by new_delete_type_mismatch flag, the same one protecting new/delete matching size check. Differential revision: https://reviews.llvm.org/D38574 Issue: https://github.com/google/sanitizers/issues/799 llvm-svn: 316595
* [asan] Don't print rows of shadow bytes outside shadow memoryReid Kleckner2017-10-251-2/+7
| | | | | | | | | | | | | | | | | | | Summary: They might not be mapped on some platforms such as Win64. In particular, this happens if the user address is null. There will not be any shadow memory 5*16 bytes before the user address. This happens on Win64 in the error_report_callback.cc test case. It's not clear why this isn't a problem on Linux as well. Fixes PR35058 Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39260 llvm-svn: 316589
* On FreeBSD, skip the first entry in the dl_iterate_phdr list.Dimitry Andric2017-10-241-1/+1
| | | | | | | | | | | | | | | | | Summary: Similar to NetBSD, in FreeBSD, the first returned entry when callbacks are done via dl_iterate_phdr will return the main program. Ignore that entry when checking that the dynamic ASan lib is loaded first. Reviewers: eugenis, krytarowski, emaste, joerg Reviewed By: eugenis, krytarowski Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39253 llvm-svn: 316487
* [Sanitizers] New sanitizer API to purge allocator quarantine.Alex Shlyapnikov2017-10-231-0/+20
| | | | | | | | | | | | | | | | Summary: Purging allocator quarantine and returning memory to OS might be desired between fuzzer iterations since, most likely, the quarantine is not going to catch bugs in the code under fuzz, but reducing RSS might significantly prolong the fuzzing session. Reviewers: cryptoad Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39153 llvm-svn: 316347
* [Sanitizers] Add more details to ASan allocator stats report.Alex Shlyapnikov2017-10-131-0/+3
| | | | | | | | | | | | Summary: . Reviewers: cryptoad Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38834 llvm-svn: 315730
* [cmake] [asan] Remove unnecessary gtest dep from dynamic testsMichal Gorny2017-10-121-1/+1
| | | | | | | | | | | | | | | | Remove the redundant dependency on 'gtest' target from the dynamic tests in non-MSVC environment. The tests reuse compiled objects from ASAN_INST_TEST_OBJECTS, and therefore they have been built against gtest already. This both fixes the spurious dependency on 'gtest' target that breaks stand-alone builds, and brings the dynamic tests more in line with regular tests which do not pass this dependency to add_compiler_rt_test() through generate_compiler_rt_tests(). Differential Revision: https://reviews.llvm.org/D38840 llvm-svn: 315620
* [asan] Disable wcslen test on 32-bit Android.Evgeniy Stepanov2017-10-071-2/+4
| | | | llvm-svn: 315132
* [sanitizer] Move cxx-abi library earlier in link flags.Evgeniy Stepanov2017-10-041-3/+1
| | | | | | | | | | | | | | | | | | | | Summary: This change moves cxx-abi library in asan/ubsan/dd link command line ahead of other libraries, such as pthread/rt/dl/c/gcc. Given that cxx-abi may be the full libstdc++/libc++, it makes sense for it to be ahead of libc and libgcc, at least. The real motivation is Android, where in the arm32 NDK toolchain libstdc++.a is actually a linker script that tries to sneak LLVM's libunwind ahead of libgcc's. Wrong library order breaks unwinding. Reviewers: srhines, danalbert Subscribers: aemerson, kubamracek, mgorny, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D38520 llvm-svn: 314948
* [asan] Fix the bug number in the error message.Evgeniy Stepanov2017-09-281-1/+1
| | | | | | | The link in the "Shadow memory range interleaves with an existing memory mapping" error message was pointing to the wrong bug. llvm-svn: 314441
* [asan] Unpoison global metadata on dlclose.Benjamin Kramer2017-09-281-0/+3
| | | | | | | | dlclose itself might touch it, so better return it to the state it was before. I don't know how to create a test for this as it would require chaning dlclose itself. llvm-svn: 314415
* ASan allocates a global data initialization array at the tail end of eachDmitry Mikulin2017-09-271-0/+4
| | | | | | | | | | | | | | | | compunit's .data section. This vector is not poisoned. Because of this the first symbol of the following section has no left red zone. As a result, ASan cannot detect underflow for such symbols. Poison ASan allocated metadata, it should not be accessible to user code. This fix does not eliminate the problem with missing left red zones but it reduces the set of vulnerable symbols from first symbols in each input data section to first symbols in the output section of the binary. Differential Revision: https://reviews.llvm.org/D38056 llvm-svn: 314365
* [lsan] Add __lsan_default_optionsVitaly Buka2017-09-221-0/+4
| | | | | | For consistency with asan, msan, tsan and ubsan. llvm-svn: 314048
* [sanitizer] Replace thread id with GetThreadSelfVitaly Buka2017-09-221-5/+1
| | | | | | This allows to avoid constructor parameter llvm-svn: 314040
* [sanitizer] Move report locking code from asan into commonVitaly Buka2017-09-221-44/+11
| | | | llvm-svn: 314008
* [asan] Fix unlocking order for CommonSanitizerReportMutex and ↵Vitaly Buka2017-09-221-1/+1
| | | | | | reporting_thread_tid_ llvm-svn: 314007
* [asan/lsan] Make LSan compliant with recovery mode when running on top of ASanMaxim Ostapenko2017-09-221-1/+4
| | | | | | | | | | | 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. Patch by Slava Barinov. Differential Revision: https://reviews.llvm.org/D38026 llvm-svn: 313966
* [asan] Fix nested error detectionVitaly Buka2017-09-201-53/+34
| | | | | | | | | | | | Summary: Fixes https://github.com/google/sanitizers/issues/858 Reviewers: eugenis, dvyukov Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38019 llvm-svn: 313835
* [asan] Resolve FIXME by converting gtest into lit testVitaly Buka2017-09-201-17/+0
| | | | llvm-svn: 313727
* [asan] Remove ScopedDeadlySignalVitaly Buka2017-09-184-28/+8
| | | | | | | This is used only to make fast = true in GetStackTraceWithPcBpAndContext on SANITIZER_FREEBSD and SANITIZER_NETBSD and can be done explicitly. llvm-svn: 313517
* [sanitizer] Move signal interceptors from asan to sanitizer_commonVitaly Buka2017-09-162-50/+4
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D37889 llvm-svn: 313449
* [sanitizer] Move stack overflow and signal reporting from Asan into common.Vitaly Buka2017-09-141-49/+14
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D37844 llvm-svn: 313310
* [asan] Remove ErrorStackOverflowVitaly Buka2017-09-145-86/+62
| | | | | | | | | | | | | | | | Summary: The only difference from ErrorDeadlySignal is reporting code and it lives in sanitizer common. Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl, filcab Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37868 llvm-svn: 313309
* [sanitizer] Move IsStackOverflow into SignalContextVitaly Buka2017-09-141-1/+1
| | | | llvm-svn: 313227
* [asan] Add const into ScarinessScoreBase::PrintVitaly Buka2017-09-141-1/+1
| | | | llvm-svn: 313225
* [compiler-rt] Cleanup SignalContext initializationVitaly Buka2017-09-142-2/+2
| | | | | | | | | | Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris Differential Revision: https://reviews.llvm.org/D37827 llvm-svn: 313223
* [asan] Fix Windows buildVitaly Buka2017-09-131-1/+1
| | | | llvm-svn: 313177
* [compiler-rt] Use SignalContext in ErrorStackOverflow and ErrorDeadlySignalVitaly Buka2017-09-132-43/+28
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl, filcab Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37793 llvm-svn: 313168
* [compiler-rt] Add siginfo into SignalContextVitaly Buka2017-09-134-7/+7
| | | | | | | | | | | | | | | Summary: Information stored there is often been passed along with SignalContext. Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37792 llvm-svn: 313167
* [compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka2017-09-133-37/+0
| | | | | | | | | | | | | | sanitizer_common Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37766 llvm-svn: 313117
* [compiler-rt] Move *Sanitizer:DEADLYSIGNAL printing into common partVitaly Buka2017-09-131-5/+1
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37764 llvm-svn: 313115
* [Fuchsia] Magenta -> ZirconPetr Hosek2017-09-131-7/+7
| | | | | | | | | | Fuchsia's lowest API layer has been renamed from Magenta to Zircon. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D37770 llvm-svn: 313106
* [compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka2017-09-121-44/+1
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 llvm-svn: 312987
* Revert "[compiler-rt] Move IsStackOverflow from asan into sanitizer_common"Vitaly Buka2017-09-121-1/+44
| | | | | | | | Windows is broken. This reverts commit r312951 llvm-svn: 312984
* [compiler-rt] Move IsStackOverflow from asan into sanitizer_commonVitaly Buka2017-09-111-44/+1
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37536 llvm-svn: 312951
* [compiler-rt] Cleanup decoratorsVitaly Buka2017-09-114-31/+25
| | | | | | | | | | | | | | Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 llvm-svn: 312950
* [asan] Use more generic string in error messageVitaly Buka2017-09-091-1/+3
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37609 llvm-svn: 312858
* [asan] Add a note to shadow memory setup error.Evgeniy Stepanov2017-09-071-0/+10
| | | | | | Point to https://github.com/google/sanitizers/issues/856 as a possible cause of the failed mapping. llvm-svn: 312687
* Remove ld.config.txt for Android O.Evgeniy Stepanov2017-09-051-6/+20
| | | | | | | | | | ld.config.txt defines linker namespaces in a way that is incompatible with ASan. Remove the file when installing ASan on an Android O (8.0.x) device. Patch by Jiyong Park. llvm-svn: 312581
* Fix constant-logical-operand warning.David Blaikie2017-09-011-2/+3
| | | | llvm-svn: 312394
* Finalize ASAN/NetBSDKamil Rytarowski2017-08-301-1/+1
| | | | | | | | | | | | | | | | | | | Summary: This revision contains various cleanups. Sponsored by <The NetBSD Foundation> Reviewers: kcc, vitalybuka, joerg, eugenis Reviewed By: kcc Subscribers: emaste, srhines, llvm-commits, kubamracek, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37244 llvm-svn: 312188
OpenPOWER on IntegriCloud