summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
Commit message (Collapse)AuthorAgeFilesLines
* [sanitizer_common] Create max_allocation_size_mb flag.Matt Morehouse2019-10-301-0/+3
| | | | | | | | | | | | | | | | | Summary: The flag allows the user to specify a maximum allocation size that the sanitizers will honor. Any larger allocations will return nullptr or crash depending on allocator_may_return_null. Reviewers: kcc, eugenis Reviewed By: kcc, eugenis Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69576
* [sanitizer] Decorate /proc/self/maps better.Evgeniy Stepanov2019-02-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Refactor the way /proc/self/maps entries are annotated to support most (all?) posix platforms, with a special implementation for Android. Extend the set of decorated Mmap* calls. Replace shm_open with internal_open("/dev/shm/%s"). Shm_open is problematic because it calls libc open() which may be intercepted. Generic implementation has limits (max number of files under /dev/shm is 64K on my machine), which can be conceivably reached when sanitizing multiple programs at once. Android implemenation is essentially free, and enabled by default. The test in sanitizer_common is copied to hwasan and not reused directly because hwasan fails way too many common tests at the moment. Reviewers: pcc, vitalybuka Subscribers: srhines, kubamracek, jfb, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D57720 llvm-svn: 353255
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [asan] Support running without /procEvgeniy Stepanov2019-01-081-0/+3
| | | | | | | | | | | | | | | | | | Summary: This patch lets ASan run when /proc is not accessible (ex. not mounted yet). It includes a special test-only flag that emulates this condition in an unpriviledged process. This only matters on Linux, where /proc is necessary to enumerate virtual memory mappings. Reviewers: vitalybuka, pcc, krytarowski Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D56141 llvm-svn: 350590
* Revert "[asan] Support running without /proc.", +1Evgeniy Stepanov2018-12-281-3/+0
| | | | | | | | | Revert r350104 "[asan] Fix build on windows." Revert r350101 "[asan] Support running without /proc." These changes break Mac build, too. llvm-svn: 350112
* [asan] Support running without /proc.Evgeniy Stepanov2018-12-271-0/+3
| | | | | | | | | | | | | | | | | | Summary: This patch lets ASan run when /proc is not accessible (ex. not mounted yet). It includes a special test-only flag that emulates this condition in an unpriviledged process. This only matters on Linux, where /proc is necessary to enumerate virtual memory mappings. Reviewers: pcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55874 llvm-svn: 350101
* tsan: align default value of detect_deadlocks flag with actual behaviorDmitry Vyukov2018-12-191-1/+1
| | | | | | | | | | | | | | I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.) I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this This changes aligns the default value of the flag with the actual default behavior. Author: yln (Julian Lettner) Reviewed in: https://reviews.llvm.org/D55846 llvm-svn: 349609
* Silence a -Wconstant-logical-operand warning.Douglas Yung2018-06-071-3/+3
| | | | llvm-svn: 334214
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-211-0/+3
| | | | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 328151
* Revert "Mmap interceptor new option, Write Exec runtime detector"Vitaly Buka2018-03-171-3/+0
| | | | | | | | Breaks Android bot. This reverts commit r327747. llvm-svn: 327762
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-161-0/+3
| | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 327747
* Revert "Mmap interceptor new option, Write Exec runtime detector"Jonas Devlieghere2018-03-161-3/+0
| | | | | | | | | This reverts r327696 because it is failing on GreenDragon. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/ llvm-svn: 327719
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-161-0/+3
| | | | | | | | | | | | | | | | Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 llvm-svn: 327696
* [hwasan] Fix inline instrumentation.Evgeniy Stepanov2018-02-211-0/+2
| | | | | | | | | | | | | | | This patch changes hwasan inline instrumentation: Fixes address untagging for shadow address calculation (use 0xFF instead of 0x00 for the top byte). Emits brk instruction instead of hlt for the kernel and user space. Use 0x900 instead of 0x100 for brk immediate (0x100 - 0x800 are unavailable in the kernel). Fixes and adds appropriate tests. Patch by Andrey Konovalov. Differential Revision: https://reviews.llvm.org/D43135 llvm-svn: 325711
* [sanitizer] Implement NanoTime & MonotonicNanoTime for WindowsKostya Kortchinsky2018-02-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Implement `MonotonicNanoTime` using `QueryPerformanceCounter`. This function is used by Scudo & the 64-bit Primary allocator. Implementing it now means that the release-to-OS mechanism of the Primary will kick in (it never did since the function returned 0 always), but `ReleaseMemoryPagesToOS` is still not currently implemented for Windows. Performance wise, this adds a syscall & a 64-bit division per call to `MonotonicNanoTime` so the impact might not be negligible, but I don't think there is a way around it. Reviewers: rnk, alekseyshl, amccarth Reviewed By: alekseyshl, amccarth Subscribers: amccarth, flowerhack, kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42579 llvm-svn: 324011
* [sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib ↵Kuba Mracek2017-11-291-0/+3
| | | | | | | | | | from DYLD_INSERT_LIBRARIES On macOS, we usually don't require launching the target with DYLD_INSERT_LIBRARIES anymore. However, it is still necessary when running a target that is not instrumented (and e.g. dlopen's an instrument library later). In any case, ASan and TSan currently remove themselves from the DYLD_INSERT_LIBRARIES environment variable to avoid passing it onto children. This works well e.g. when instrumenting a shell. A problem arises when the target is a non-instrumented shim (e.g. "xcrun") that either re-execs or launches a child that is supposed to get DYLD_INSERT_LIBRARIES propagated. To support this mode, this patch introduces 'strip_env' flag that can be used to keep DYLD_INSERT_LIBRARIES untouched. Differential Revision: https://reviews.llvm.org/D39991 llvm-svn: 319365
* [Sanitizers] Set default allocator_release_to_os_interval_ms to 5 secondsAlex Shlyapnikov2017-10-261-5/+5
| | | | | | | | | | | | | | | | | | | | | Summary: With new release to OS approach (see D38245) it's reasonable to enable it by default. Setting allocator_release_to_os_interval_ms to 5000 seems to be a reasonable default (might be tuned later, based on the feedback). Also delaying the first release to OS in each bucket for at least allocator_release_to_os_interval_ms after the first allocation to prevent just allocated memory to be madvised back to OS and let short lived processes to avoid release to OS overhead altogether. Reviewers: cryptoad Subscribers: kubamracek, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D39318 llvm-svn: 316683
* [compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka2017-09-131-0/+5
| | | | | | | | | | | | | | 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
* [asan] Fix typo in doc string.Vitaly Buka2017-06-151-1/+1
| | | | llvm-svn: 305436
* [asan] Return allow_user_segv_handler=0 to fix compatibility issues.Vitaly Buka2017-06-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: After r303941 it was not possible to setup ASAN_OPTIONS to have the same behavior for pre r303941 and post r303941 builds. Pre r303941 Asan does not accept handle_sigbus=2. Post r303941 Asan does not accept allow_user_segv_handler. This fix ignores allow_user_segv_handler=1, but for allow_user_segv_handler=0 it will upgrade flags like handle_sigbus=1 to handle_sigbus=2. So user can set ASAN_OPTIONS=allow_user_segv_handler=0 and have same behavior on old and new clang builds (except range from r303941 to this revision). In future users which need to prevent third party handlers should switch to handle_sigbus=2 and remove allow_user_segv_handler as soon as suport of older builds is not needed. Related bugs: https://github.com/google/oss-fuzz/issues/675 https://bugs.chromium.org/p/chromium/issues/detail?id=731130 Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34227 llvm-svn: 305433
* [sanitizer-coverage] nuke more stale codeKostya Serebryany2017-06-021-10/+0
| | | | llvm-svn: 304508
* [asan] Add strndup/__strndup interceptors.Pierre Gousseau2017-06-011-0/+3
| | | | | | | | Recommit of r302781 with Vitaly Buka's fix for non zero terminated strings. Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 304399
* [compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka2017-05-251-4/+2
| | | | | | | | | | | | | | Summary: allow_user_segv_handler had confusing name did not allow to control behavior for signals separately. Reviewers: eugenis, alekseyshl, kcc Subscribers: llvm-commits, dberris, kubamracek Differential Revision: https://reviews.llvm.org/D33371 llvm-svn: 303941
* [compiler-rt] Make print_module_map description consistent with the rest.Vitaly Buka2017-05-251-2/+2
| | | | | | | | | | Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D33160 llvm-svn: 303892
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-251-1/+1
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303842
* Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka2017-05-241-1/+1
| | | | | | | | Breaks sanitizer-x86_64-linux-fuzzer bot. This reverts commit r303729. llvm-svn: 303795
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-241-1/+1
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303729
* Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka2017-05-201-1/+1
| | | | | | | | Failed libFuzzer tests on Windows. This reverts commit r303476. llvm-svn: 303481
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-201-1/+1
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303476
* [compiler-rt] Switch handle_<signal> flags from bool to enum.Vitaly Buka2017-05-191-10/+14
| | | | | | | | | | | | Summary: We are going to make it tri-state and remove allow_user_segv_handler. Reviewers: eugenis, alekseys, kcc Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D33159 llvm-svn: 303464
* Revert r302781 and subsequent attempts to disable part of it.Daniel Jasper2017-05-181-3/+0
| | | | | | | The Msan unit tests are still broken and by this point, I think we should start over. llvm-svn: 303339
* [asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau2017-05-111-0/+3
| | | | | | | | | Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 302781
* Revert r301904 causing tsan test failure in x86_64-linux-autoconfPierre Gousseau2017-05-021-3/+0
| | | | llvm-svn: 301909
* [asan] Add strndup/__strndup interceptors if targeting linux.Pierre Gousseau2017-05-021-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 301904
* [sanitizer-coverage] remove more stale codeKostya Serebryany2017-05-011-6/+0
| | | | llvm-svn: 301845
* Enable builds of darwin lsan by defaultFrancis Ricci2017-04-061-1/+1
| | | | | | | | | | | | Summary: Testing and asan leak detection are disabled by default. Reviewers: kubamracek, kcc Subscribers: srhines, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D31307 llvm-svn: 299669
* Enable leak detection on linux-i686 by defaultFrancis Ricci2017-03-301-2/+1
| | | | | | | | | | | | | | Summary: This is already assumed by the test suite, and by asan_flags.cc. Reviewers: m.ostapenko, vitalybuka, kubamracek, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31462 llvm-svn: 299082
* [asan] Add an interceptor for strtokAlex Shlyapnikov2017-03-231-0/+3
| | | | | | | | | | | | | | | | Summary: This change addresses https://github.com/google/sanitizers/issues/766. I tested the change with make check-asan and the newly added test case. Reviewers: ygribov, kcc, alekseyshl Subscribers: kubamracek, llvm-commits Patch by mrigger Differential Revision: https://reviews.llvm.org/D30384 llvm-svn: 298650
* [asan] Split SIGSEGV / SIGBUS handling so we can handle only one of them and ↵Filipe Cabecinhas2017-03-131-1/+3
| | | | | | | | | | | | | | not the other. Summary: This is useful in some platforms where one of these signals is special. Reviewers: kubamracek, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30783 llvm-svn: 297665
* [lsan] Renable LSan for x86 LinuxMaxim Ostapenko2017-01-311-1/+2
| | | | | | | | | The missed clang part was committed at https://reviews.llvm.org/rL293609 thus we can reenable LSan for x86 Linux. Differential Revision: https://reviews.llvm.org/D28609 llvm-svn: 293610
* Revert "[lsan] Enable LSan for x86 Linux."Evgeniy Stepanov2017-01-231-2/+1
| | | | | | | Breaks tests on i686/Linux due to missing clang driver support: error: unsupported option '-fsanitize=leak' for target 'i386-unknown-linux-gnu' llvm-svn: 292844
* [lsan] Enable LSan for x86 Linux.Maxim Ostapenko2017-01-231-1/+2
| | | | | | | | | | | | | People keep asking LSan to be available on 32 bit targets (e.g. https://github.com/google/sanitizers/issues/403) despite the fact that false negative ratio might be huge (up to 85%). This happens for big real world applications that may contain random binary data (e.g. browser), but for smaller apps situation is not so terrible and LSan still might be useful. This patch adds initial support for x86 Linux (disabled by default), ARM32 is in TODO list. We used this patch (well, ported to GCC) on our 32 bit mobile emulators and it worked pretty fine thus I'm posting it here to initiate further discussion. Differential Revision: https://reviews.llvm.org/D28609 llvm-svn: 292775
* [sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on ↵Kuba Mracek2017-01-061-0/+3
| | | | | | | | | | Darwin This patch add a new sanitizer flag, print_module_map, which enables printing a module map when the process exits, or after each report (for TSan). The output format is very similar to what Crash Reporter produces on Darwin (e.g. the format of module UUIDs). This enables users to use the existing symbol servers to offline symbolicate and aggregate reports. Differential Revision: https://reviews.llvm.org/D27400 llvm-svn: 291277
* Return memory to OS right after free (not in the async thread).Evgeniy Stepanov2016-11-291-3/+5
| | | | | | | | | | | | | | | | | | Summary: In order to avoid starting a separate thread to return unused memory to the system (the thread interferes with process startup on Android, Zygota waits for all threads to exit before fork, but this thread never exits), try to return it right after free. Reviewers: eugenis Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27003 llvm-svn: 288091
* tsan: set disable_coredump=0 by default for GoDmitry Vyukov2016-10-281-1/+1
| | | | | | | | | | | Go maps shadow memory lazily, so we don't have the huge multi-TB mapping. Virtual memory consumption is proportional to normal memory usage. Also in Go core dumps are enabled explicitly with GOTRACEBACK=crash, if user explicitly requests a core that must be on purpose. So don't disable core dumps by default. llvm-svn: 285451
* sanitizer_common: fix description of disable_coredump flagDmitry Vyukov2016-10-281-3/+3
| | | | | | | s/disable_core/disable_coredump/ Add missing space in text. llvm-svn: 285401
* [asan] add heap_profile=1 to asan to periodically print the heap profile. So ↵Kostya Serebryany2016-09-141-0/+1
| | | | | | far this is a very basic heap-profile functionality llvm-svn: 281546
* [asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany2016-08-261-0/+3
| | | | | | madvise. Requires quite some tuning. llvm-svn: 279887
* [asan] abort_on_error=1 by default on Android.Evgeniy Stepanov2016-08-111-1/+1
| | | | | | | | | | | | | With this change, the default behavior on error is to call abort() instead of _exit(). This should help the OS to capture a tombstone of the error. RAM usage of the lit test suite goes up because of all the tombstone gathering, so I'm limiting the parallelism of the test target. Previously it was based on the number of the CPUs on the host machine, which is definitely wrong. llvm-svn: 278308
* [sanitizers] trace buffer API to use user-allocated buffer.Mike Aizatsky2016-08-051-3/+0
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D23186 llvm-svn: 277858
OpenPOWER on IntegriCloud