summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_flags.inc
AgeCommit message (Collapse)Author
2017-11-29[sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib ↵Kuba Mracek
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[Sanitizers] Set default allocator_release_to_os_interval_ms to 5 secondsAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316683 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13[compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15[asan] Fix typo in doc string.Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305436 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-15[asan] Return allow_user_segv_handler=0 to fix compatibility issues.Vitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305433 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-02[sanitizer-coverage] nuke more stale codeKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304508 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01[asan] Add strndup/__strndup interceptors.Pierre Gousseau
Recommit of r302781 with Vitaly Buka's fix for non zero terminated strings. Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Make print_module_map description consistent with the rest.Vitaly Buka
Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D33160 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303892 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka
Breaks sanitizer-x86_64-linux-fuzzer bot. This reverts commit r303729. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka
Failed libFuzzer tests on Windows. This reverts commit r303476. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303476 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-19[compiler-rt] Switch handle_<signal> flags from bool to enum.Vitaly Buka
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18Revert r302781 and subsequent attempts to disable part of it.Daniel Jasper
The Msan unit tests are still broken and by this point, I think we should start over. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303339 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11[asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau
Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02Revert r301904 causing tsan test failure in x86_64-linux-autoconfPierre Gousseau
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02[asan] Add strndup/__strndup interceptors if targeting linux.Pierre Gousseau
Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01[sanitizer-coverage] remove more stale codeKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301845 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-06Enable builds of darwin lsan by defaultFrancis Ricci
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30Enable leak detection on linux-i686 by defaultFrancis Ricci
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299082 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23[asan] Add an interceptor for strtokAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13[asan] Split SIGSEGV / SIGBUS handling so we can handle only one of them and ↵Filipe Cabecinhas
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31[lsan] Renable LSan for x86 LinuxMaxim Ostapenko
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-23Revert "[lsan] Enable LSan for x86 Linux."Evgeniy Stepanov
Breaks tests on i686/Linux due to missing clang driver support: error: unsupported option '-fsanitize=leak' for target 'i386-unknown-linux-gnu' git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292844 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-23[lsan] Enable LSan for x86 Linux.Maxim Ostapenko
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292775 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06[sanitizer] Add a 'print_module_map' flag which prints modules with UUIDs on ↵Kuba Mracek
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291277 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-29Return memory to OS right after free (not in the async thread).Evgeniy Stepanov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28tsan: set disable_coredump=0 by default for GoDmitry Vyukov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28sanitizer_common: fix description of disable_coredump flagDmitry Vyukov
s/disable_core/disable_coredump/ Add missing space in text. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285401 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14[asan] add heap_profile=1 to asan to periodically print the heap profile. So ↵Kostya Serebryany
far this is a very basic heap-profile functionality git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281546 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany
madvise. Requires quite some tuning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279887 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11[asan] abort_on_error=1 by default on Android.Evgeniy Stepanov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05[sanitizers] trace buffer API to use user-allocated buffer.Mike Aizatsky
Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D23186 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277858 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03[ASan] Report illegal instruction exceptions in ASanReid Kleckner
Summary: Respect the handle_sigill common flag and handle_segv flags while we're at it. We still handle signals/exceptions differently on Unix and Windows. The installation process is tricky on Windows, and difficult to push down into sanitizer_common without concerning it with the different static/dynamic CRT models on Windows. Reviewers: kcc, etienneb Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23098 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-15[sanitizers] add interceptor for memmem; add weak hooks for strncasecmp, ↵Kostya Serebryany
strcasecmp, strstr, strcasestr, memmem git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-20Hide send/sendto/sendmsg interptors under a flag.Evgeniy Stepanov
A runtime flag to enable checking in send* interceptors. Checking is enabled by default. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-28[sanitizers] introduce a common run-time option dedup_token_length to help ↵Kostya Serebryany
with report deduplication, off by default for now. See https://github.com/google/sanitizers/issues/684 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03[sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky
Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Resubmit of http://reviews.llvm.org/D19875 with win build fixes. Reviewers: aizatsky, eugenis Subscribers: tberghammer, llvm-commits, danalbert, vitalybuka, bruening, srhines, kubabrecka, kcc Differential Revision: http://reviews.llvm.org/D19890 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03Revert "[sanitizer] Move stat/__xstat to the common interceptors"Mike Aizatsky
This reverts commit 268440 because it breaks the windows bot. http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21425/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03[sanitizer] Move stat/__xstat to the common interceptorsMike Aizatsky
Summary: Adds stat/__xstat to the common interceptors. Removes the now-duplicate stat/__xstat interceptor from msan/tsan/esan. This adds stat/__xstat to asan, which previously did not intercept it. Reviewers: aizatsky, eugenis Subscribers: tberghammer, danalbert, srhines, kubabrecka, llvm-commits, vitalybuka, eugenis, kcc, bruening Differential Revision: http://reviews.llvm.org/D19875 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-25[sanitizer] Add memset, memmove, and memcpy to the common interceptorsDerek Bruening
Summary: Currently, sanitizer_common_interceptors.inc has an implicit, undocumented assumption that the sanitizer including it has previously declared interceptors for memset and memmove. Since the memset, memmove, and memcpy routines require interception by many sanitizers, we add them to the set of common interceptions, both to address the undocumented assumption and to speed future tool development. They are intercepted under a new flag intercept_intrin. The tsan interceptors are removed in favor of the new common versions. The asan and msan interceptors for these are more complex (they incur extra interception steps and their function bodies are exposed to the compiler) so they opt out of the common versions and keep their own. Reviewers: vitalybuka Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18465 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-23[sanitizer] Add strnlen to the common interceptorsDerek Bruening
Summary: Adds strnlen to the common interceptors, under the existing flag intercept_strlen. Removes the now-duplicate strnlen interceptor from asan and msan. This adds strnlen to tsan, which previously did not intercept it. Adds a new test of strnlen to the sanitizer_common test cases. Reviewers: samsonov Subscribers: zhaoqin, llvm-commits, kcc Differential Revision: http://reviews.llvm.org/D18397 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@264195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-21[sanitizer] Add strchr* to the common interceptorsEvgeniy Stepanov
Adds strchr, strchrnul, and strrchr to the common interceptors, under a new common flag intercept_strchr. Removes the now-duplicate strchr interceptor from asan and all 3 interceptors from tsan. Previously, asan did not intercept strchrnul, but does now; previously, msan did not intercept strchr, strchrnul, or strrchr, but does now. http://reviews.llvm.org/D18329 Patch by Derek Bruening! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-11[sanitizer] Add strlen to the common interceptorsAlexey Samsonov
Summary: Adds strlen to the common interceptors, under a new common flag intercept_strlen. This provides better sharing of interception code among sanitizers and cleans up the inconsistent type declarations of the previously duplicated interceptors. Removes the now-duplicate strlen interceptor from asan, msan, and tsan. The entry check semantics are normalized now for msan and asan, whose private strlen interceptors contained multiple layers of checks that included impossible-to-reach code. The new semantics are identical to the old: bypass interception if in the middle of init or if both on Mac and not initialized; else, call the init routine and proceed. Patch by Derek Bruening! Reviewers: samsonov, vitalybuka Subscribers: llvm-commits, kcc, zhaoqin Differential Revision: http://reviews.llvm.org/D18020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27[sanitizers] generating html report on coverage dumpMike Aizatsky
Subscribers: tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D16374 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258999 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18[asan] Optionally print reproducer cmdline in ASan reports.Maxim Ostapenko
Differential Revision: http://reviews.llvm.org/D16070 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258037 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05[sancov] coverage pc bufferMike Aizatsky
Differential Revision: http://reviews.llvm.org/D15871 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15[asan] add option: handle_sigillKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@255588 91177308-0d34-0410-b5e6-96231b3b80d8