summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[sancov] introducing SANCOV_OPTIONS"Mike Aizatsky2017-01-055-135/+4
| | | | | | | | and related changes https://llvm.org/svn/llvm-project/compiler-rt/trunk@291068 llvm-svn: 291141
* [sancov] force default flags for windowsMike Aizatsky2017-01-051-0/+6
| | | | llvm-svn: 291089
* [sancov] introducing SANCOV_OPTIONSMike Aizatsky2017-01-055-4/+129
| | | | | | | | | | | | | | Summary: At this point SANCOV_OPTIONS are not functional but it is our intent to move here sanitizer coverage flags from various sanitizers _OPTIONS. Reviewers: kcc Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28311 llvm-svn: 291068
* break overly long line in sanitizer_win.ccBob Haarman2017-01-051-1/+2
| | | | llvm-svn: 291062
* fix warning about noreturn in sanitizer_win's internal__exit()Bob Haarman2017-01-051-1/+15
| | | | | | | | | | | | | | Summary: A previous fix used __assume(0), but not all compilers know that control will not pass that. This patch uses a macro which works in more compilers. Reviewers: rnk Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D28268 llvm-svn: 291042
* [asan] Fix handling of %m in printf interceptor.Evgeniy Stepanov2016-12-272-4/+7
| | | | llvm-svn: 290632
* [compiler-rt] Fix compilation error after r290626Vitaly Buka2016-12-271-1/+3
| | | | llvm-svn: 290629
* [compiler-rt] Move logic which replace memcpy interceptor with memmove from ↵Vitaly Buka2016-12-272-12/+41
| | | | | | | | | | | | asan to sanitizer_common. Reviewers: eugenis Subscribers: kubabrecka, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D28074 llvm-svn: 290626
* [sanitizer] Define some CPU type symbols (like CPU_SUBTYPE_X86_64_H) when ↵Kuba Mracek2016-12-251-0/+14
| | | | | | | | | | they're not available. This allows compiler-rt to be built on older macOS SDKs, where there symbols are not defined. Patch by Jeremy Huddleston Sequoia <jeremyhu@apple.com>. llvm-svn: 290521
* [compiler-rt] Define COMMON_INTERCEPT_FUNCTION_MEMCPY for tsan and esanVitaly Buka2016-12-231-0/+4
| | | | | | | | | | Reviewers: eugenis Subscribers: kubabrecka, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D28072 llvm-svn: 290396
* Fix interceptors setup broken after r290382Vitaly Buka2016-12-231-1/+1
| | | | | | | | | | | | Summary: We setup these interceptors twice which hangs test on windows. Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D28070 llvm-svn: 290393
* Replace WRAP in interceptors with memset, memmove and memcpy implementationVitaly Buka2016-12-221-50/+94
| | | | | | | | | | | | | | Summary: According https://reviews.llvm.org/D27659#625093 WRAP adds confusing stack frame. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28039 llvm-svn: 290382
* Expose thread local quarantine size as ASAN option.Evgeniy Stepanov2016-12-221-0/+1
| | | | | | | | | | | | | | Summary: Make thread local quarantine size an option so it can be turned off to save memory. Reviewers: eugenis Patch by Alex Shlyapnikov. Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28027 llvm-svn: 290373
* Fix build breakage on FreeBSD after rL289878/rL289881Dimitry Andric2016-12-203-3/+5
| | | | | | | | | | | | | | | | | | Summary: After rL289878/rL289881, the build on FreeBSD is broken, because sanitizer_platform_limits_posix.cc attempts to include <utmp.h> and use `struct utmp`, neither of which are supported anymore on FreeBSD. Fix this by adding `&& !SANITIZER_FREEBSD` in a few places, and stop intercepting utmp functions altogether for FreeBSD. Reviewers: kubabrecka, emaste, eugenis, ed Subscribers: ed, llvm-commits Differential Revision: https://reviews.llvm.org/D27902 llvm-svn: 290167
* Ifdef out utmp.h on Darwin to un-break the build after r289878 ([msan] ↵Kuba Mracek2016-12-152-1/+5
| | | | | | Intercept getutent and friends). llvm-svn: 289881
* [msan] Intercept getutent and friends.Evgeniy Stepanov2016-12-154-0/+84
| | | | | | Differential Revision: https://reviews.llvm.org/D27791 llvm-svn: 289878
* Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che ↵Hans Wennborg2016-12-152-39/+0
| | | | | | | | Wu (https://reviews.llvm.org/D27659)" It breaks programs on Mac. See comments on the code review for details. llvm-svn: 289864
* sanitizers: silence -pedantic warningSaleem Abdulrasool2016-12-151-1/+1
| | | | | | | | | | projects/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc:142:2: warning: extra ';' [-Wpedantic] }; // namespace ^ Identified by gcc 6. llvm-svn: 289851
* [sanitizers] dont dump coverage if not asked toMike Aizatsky2016-12-151-1/+1
| | | | llvm-svn: 289835
* [sanitizer] intercept bstring functions, patch by Kuang-che Wu ↵Kostya Serebryany2016-12-142-0/+39
| | | | | | (https://reviews.llvm.org/D27659) llvm-svn: 289690
* Corrected D27428: Do not use the alignment-rounded-up size with secondaryKostya Kortchinsky2016-12-131-1/+15
| | | | | | | | | | | | | | | | | | | | Summary: I atually had an integer overflow on 32-bit with D27428 that didn't reproduce locally, as the test servers would manage allocate addresses in the 0xffffxxxx range, which led to some issues when rounding addresses. At this point, I feel that Scudo could benefit from having its own combined allocator, as we don't get any benefit from the current one, but have to work around some hurdles (alignment checks, rounding up that is no longer needed, extraneous code). Reviewers: kcc, alekseyshl Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D27681 llvm-svn: 289572
* Fix warning for noreturn functionReid Kleckner2016-12-131-0/+1
| | | | llvm-svn: 289568
* [sancov] __sanitizer_dump_coverage apiMike Aizatsky2016-12-125-5/+184
| | | | | | | | Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D26758 llvm-svn: 289498
* symbolizer: Add lseek64 to global symbol list.Peter Collingbourne2016-12-121-0/+1
| | | | llvm-svn: 289449
* [sanitizer] Make sure libmalloc doesn't remove the sanitizer zone from ↵Kuba Mracek2016-12-111-0/+23
| | | | | | | | | | malloc_zones[0] In certain OS versions, it was possible that libmalloc replaced the sanitizer zone from being the default zone (i.e. being in malloc_zones[0]). This patch introduces a failsafe that makes sure we always stay the default zone. No testcase for this, because this doesn't reproduce under normal circumstances. Differential Revision: https://reviews.llvm.org/D27083 llvm-svn: 289376
* [sanitizer] Handle malloc_destroy_zone() on DarwinKuba Mracek2016-12-111-0/+13
| | | | | | | | We currently have a interceptor for malloc_create_zone, which returns a new zone that redirects all the zone requests to our sanitizer zone. However, calling malloc_destroy_zone on that zone will cause libmalloc to print out some warning messages, because the zone is not registered in the list of zones. This patch handles this and adds a testcase for that. Differential Revision: https://reviews.llvm.org/D27083 llvm-svn: 289375
* Reverting rL289088 while investigating some test issue on the build serversKostya Kortchinsky2016-12-091-14/+1
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D27605 llvm-svn: 289180
* [sanitizer] Add workaround for empty stringsVitaly Buka2016-12-081-18/+14
| | | | | | | | | | | | Summary: I see crashes on this check when some reports are being generated. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D27574 llvm-svn: 289145
* [sanitizer] Do not use the alignment-rounded-up size when using the secondaryKostya Kortchinsky2016-12-081-1/+14
| | | | | | | | | | | | | | | | | | Summary: The combined allocator rounds up the requested size with regard to the alignment, which makes sense when being serviced by the primary as it comes with alignment guarantees, but not with the secondary. For the rare case of large alignments, it wastes memory, and entices unnecessarily large fields for the Scudo header. With this patch, we pass the non-alignement-rounded-up size to the secondary, and adapt the Scudo code for this change. Reviewers: alekseyshl, kcc Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D27428 llvm-svn: 289088
* [sanitizers] __sanitizer_get_module_and_offset_for_pc interface functionMike Aizatsky2016-12-052-1/+23
| | | | | | | | | | | | Summary: The function computes full module name and coverts pc into offset. Reviewers: kcc Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26820 llvm-svn: 288711
* Remove a couple of memset usages from TSan, introduced in r288624.Daniel Jasper2016-12-051-2/+4
| | | | | | | | | | | | TSan runtime shouldn't contain memset, so internal_memset is used instead and syntax that emits memset is avoided. This doesn't fail in-tree due to TSan being build with -03, but it fails when TSan is built with -O0, and is (I think) a true positive. Patch by Sam McCall, review: https://reviews.llvm.org/D27407 llvm-svn: 288672
* [sanitizer] Make atos stdin a non-tty pipe to make sure it's not stuck ↵Kuba Mracek2016-12-041-37/+68
| | | | | | | | | | waiting for user input On macOS, we often symbolicate using atos (when llvm-symbolizer is not found). The current way we invoke atos involves creating a pseudo-terminal to make sure atos doesn't buffer its output. This however also makes atos think that it's stdin is interactive and in some error situations it will ask the user to enter some input instead of just printing out an error message. For example, when Developer Mode isn't enabled on a machine, atos cannot examine processes, and it will ask the user to enter an administrator's password, which will make the sanitized process get stuck. This patch only connects the pseudo-terminal to the stdout of atos, and uses a regular pipe as its stdin. Differential Revision: https://reviews.llvm.org/D27239 llvm-svn: 288624
* [sanitizer] Track architecture and UUID of modules in LoadedModuleKuba Mracek2016-12-027-18/+136
| | | | | | | | | | When we enumerate loaded modules, we only track the module name and base address, which then has several problems on macOS. Dylibs and executables often have several architecture slices and not storing which architecture/UUID is actually loaded creates problems with symbolication: A file path + offset isn't enough to correctly symbolicate, since the offset can be valid in multiple slices. This is especially common for Haswell+ X86_64 machines, where x86_64h slices are preferred, but if one is not available, a regular x86_64 is loaded instead. But the same issue exists for i386 vs. x86_64 as well. This patch adds tracking of arch and UUID for each LoadedModule. At this point, this information isn't used in reports, but this is the first step. The goal is to correctly identify which slice is loaded in symbolication, and also to output this information in reports so that we can tell which exact slices were loaded in post-mortem analysis. Differential Revision: https://reviews.llvm.org/D26632 llvm-svn: 288537
* [sanitizer] Add a bunch of ifdefs for sparc targets to avoid build failures.Maxim Ostapenko2016-12-022-3/+71
| | | | | | Differential Revision: https://reviews.llvm.org/D27301 llvm-svn: 288488
* Release memory to OS only when the requested range covers the entire pageEvgeniy Stepanov2016-11-304-13/+12
| | | | | | | | | | | | | | | | | Summary: The current code was sometimes attempting to release huge chunks of memory due to undesired RoundUp/RoundDown interaction when the requested range is fully contained within one memory page. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27228 llvm-svn: 288271
* Return memory to OS right after free (not in the async thread).Evgeniy Stepanov2016-11-299-74/+103
| | | | | | | | | | | | | | | | | | 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
* [sanitizers] Get the proper printf/scanf version when long double transition ↵Marcin Koscielnicki2016-11-281-16/+16
| | | | | | | | | | | is involved. See D19555 for rationale. As it turns out, this treatment is also necessary for scanf/printf. Differential Revision: https://reviews.llvm.org/D27118 llvm-svn: 288064
* [asan] Support handle_sigill on DarwinKuba Mracek2016-11-261-0/+2
| | | | | | | | Handling SIGILL on Darwin works fine, so let's just make this feature work and re-enable the ill.cc testcase. Differential Revision: https://reviews.llvm.org/D27141 llvm-svn: 287959
* [asan] Add a "dump_registers" flag to print out CPU registers after a SIGSEGVKuba Mracek2016-11-264-0/+60
| | | | | | | | This patch prints out all CPU registers after a SIGSEGV. These are available in the signal handler context. Only implemented for Darwin. Can be turned off with the dump_registers flag. Differential Revision: https://reviews.llvm.org/D11365 llvm-svn: 287957
* tsan: fix build after 287632Dmitry Vyukov2016-11-221-0/+4
| | | | | | | | | | 1. Mac does not have MAP_32BIT. Define it to 0 if it is not defined. 2. We are lacking nolibc stub for ListOfModules::init. Add it. llvm-svn: 287634
* tsan: switch libignore from /proc/self/maps to dl_iterate_phdrDmitry Vyukov2016-11-221-15/+16
| | | | | | | | | | /proc/self/maps can't be read atomically, this leads to episodic crashes in libignore as it thinks that a module is loaded twice. See the new test for an example. dl_iterate_phdr does not have this problem. Switch libignore to dl_iterate_phdr. llvm-svn: 287632
* rename InternalBinarySearch to InternalLowerBoundMike Aizatsky2016-11-183-22/+22
| | | | | | | | | | | | Summary: The new name better corresponds to its logic. Reviewers: kcc Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26821 llvm-svn: 287377
* [sanitizers] specifying style for global constantMike Aizatsky2016-11-171-0/+4
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26755 llvm-svn: 287268
* adding operator* to help working with primitive valuesMike Aizatsky2016-11-161-0/+12
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26756 llvm-svn: 287144
* fixing binary search for cases when element is not in arrayMike Aizatsky2016-11-163-12/+52
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D26707 llvm-svn: 287078
* [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initializationReid Kleckner2016-11-143-7/+81
| | | | | | | | | | | | | | | | | | | | | | | Summary: ASan needs to initialize before ucrtbase.dll so that it can intercept all of its heap allocations. New versions of dbghelp.dll depend on ucrtbase.dll, which means both of those DLLs will initialize before the dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we avoid the issue. Eventually, I would like to remove our dbghelp.dll dependency in favor of always using llvm-symbolizer.exe, but this seems like an acceptable interim solution. Fixes PR30903 Reviewers: etienneb Subscribers: kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D26473 llvm-svn: 286848
* [asan] Fix strncmp and strncasecmp interceptorsVitaly Buka2016-11-121-9/+21
| | | | | | | | | | | | | | | | | | | | | | | Summary: In non-strict mode we will check memory access for both strings from beginning to either: 1. 0-char 2. size 3. different chars In strict mode we will check from beginning to either: 1. 0-char 2. size Previously in strict mode we always checked up to the 0-char. Reviewers: kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D26574 llvm-svn: 286708
* [asan/win] Fix wrong TerminateProcess exit codeReid Kleckner2016-11-111-1/+1
| | | | | | Add a test for it. llvm-svn: 286608
* [asan/win] Move breakpoint from Abort to internal__exitReid Kleckner2016-11-101-2/+4
| | | | | | | | Now that we use TerminateProcess, the debugger doesn't stop on program exit. Add this breakpoint so that the debugger stops after asan reports an error and is prepared to exit the program. llvm-svn: 286501
* [lsan] fix a rare lsan false positive: ensure that we don't re-sort the ↵Kostya Serebryany2016-11-101-12/+19
| | | | | | chunks_ array while iterating over it. A test is hard to create, but I've added a consistency check that fires w/o the fix on existing tests. The bug analysis and the initial patch were provided by Pierre Bourdon llvm-svn: 286478
OpenPOWER on IntegriCloud