summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-5/+19
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343554
* Switch syscall(2)/__syscall(2) calls to libc calls on NetBSDKamil Rytarowski2018-10-013-51/+350
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When possible, switch syscall(2)/__syscall(2) calls to direct calls of internal libc symbols. Add a new function to detect address of a libc symbol of a function that could be intercepted. With the address detector in GetRealLibcAddress(), an optional interceptor of libc call will be bypassed. The original approach with syscall(2)/__syscall(2) wasn't portable across supported ABIs and CPU architectures. The indirect syscall interface is also a candidate for removal in future revisions of NetBSD, as the C language ABI is not a good domain for serialization of arbitrary functions arguments. Switch the following functions to libc calls: - internal_mmap() - internal_munmap() - internal_mprotect() - internal_close() - internal_open() - internal_read() - internal_write() - internal_ftruncate() - internal_stat() - internal_lstat() - internal_fstat() - internal_dup2() - internal_readlink() - internal_unlink() - internal_rename() - internal_sched_yield() - internal__exit() - internal_sleep() - internal_execve() - NanoTime() - internal_clock_gettime() - internal_waitpid() - internal_getpid() - internal_getppid() - internal_getdents() - internal_lseek() - internal_sigaltstack() - internal_fork() - internal_sigprocmask() - internal_sysctl() - internal_sigemptyset() - internal_sigfillset() - GetTid() - TgKill() This revision leaves room for refactoring in subsequent commits. Reviewers: vitalybuka, kcc, joerg Reviewed By: vitalybuka Subscribers: mgorny, fedor.sergeev, jfb, loverszhaokai, devnexen, kubamracek, llvm-commits, ro, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D51419 llvm-svn: 343523
* [NFC] Fix `-Wcast-qual` warnings in Darwin `internal_sysctl(...)` ↵Dan Liew2018-10-011-2/+2
| | | | | | | | | | | | | | implementation. Summary: The warnings were introduced in r341187 and r341192. Reviewers: kubamracek, george.karpenkov, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52717 llvm-svn: 343496
* Switch sanitizer_procmaps_bsd to internal_sysctlKamil Rytarowski2018-09-291-4/+4
| | | | | | | | | | | | | | | | | | | | Summary: Stop using directly sysctl(3) routines in sanitizer_procmaps_bsd and replace it with internal_sysctl(). This will allow to install interceptors for sysctl(3). Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D52646 llvm-svn: 343370
* [sanitizer] Disable failing Android test after D52371Kostya Kortchinsky2018-09-271-4/+5
| | | | | | | | | | | | | | | | | Summary: The default values used for Space/Size for the new SizeClassMap do not work with Android. The Compact map appears to be in the same boat. Disable the test on Android for now to turn the bots green, but there is no reason Compact & Dense should not have an Android test. Added a FIXME, I will revisit this soon. Reviewers: eugenis Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52623 llvm-svn: 343252
* [sanitizer] Introduce a new SizeClassMap with minimal amount of cached entriesKostya Kortchinsky2018-09-272-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: _Note_: I am not attached to the name `DenseSizeClassMap`, so if someone has a better idea, feel free to suggest it. The current pre-defined `SizeClassMap` hold a decent amount of cached entries, either in cheer number of, or in amount of memory cached. Empirical testing shows that more compact per-class arrays (whose sizes are directly correlated to the number of cached entries) are beneficial to performances, particularly in highly threaded environments. The new proposed `SizeClassMap` has the following properties: ``` c00 => s: 0 diff: +0 00% l 0 cached: 0 0; id 0 c01 => s: 16 diff: +16 00% l 4 cached: 8 128; id 1 c02 => s: 32 diff: +16 100% l 5 cached: 8 256; id 2 c03 => s: 48 diff: +16 50% l 5 cached: 8 384; id 3 c04 => s: 64 diff: +16 33% l 6 cached: 8 512; id 4 c05 => s: 80 diff: +16 25% l 6 cached: 8 640; id 5 c06 => s: 96 diff: +16 20% l 6 cached: 8 768; id 6 c07 => s: 112 diff: +16 16% l 6 cached: 8 896; id 7 c08 => s: 128 diff: +16 14% l 7 cached: 8 1024; id 8 c09 => s: 144 diff: +16 12% l 7 cached: 7 1008; id 9 c10 => s: 160 diff: +16 11% l 7 cached: 6 960; id 10 c11 => s: 176 diff: +16 10% l 7 cached: 5 880; id 11 c12 => s: 192 diff: +16 09% l 7 cached: 5 960; id 12 c13 => s: 208 diff: +16 08% l 7 cached: 4 832; id 13 c14 => s: 224 diff: +16 07% l 7 cached: 4 896; id 14 c15 => s: 240 diff: +16 07% l 7 cached: 4 960; id 15 c16 => s: 256 diff: +16 06% l 8 cached: 4 1024; id 16 c17 => s: 320 diff: +64 25% l 8 cached: 3 960; id 49 c18 => s: 384 diff: +64 20% l 8 cached: 2 768; id 50 c19 => s: 448 diff: +64 16% l 8 cached: 2 896; id 51 c20 => s: 512 diff: +64 14% l 9 cached: 2 1024; id 48 c21 => s: 640 diff: +128 25% l 9 cached: 1 640; id 49 c22 => s: 768 diff: +128 20% l 9 cached: 1 768; id 50 c23 => s: 896 diff: +128 16% l 9 cached: 1 896; id 51 c24 => s: 1024 diff: +128 14% l 10 cached: 1 1024; id 48 c25 => s: 1280 diff: +256 25% l 10 cached: 1 1280; id 49 c26 => s: 1536 diff: +256 20% l 10 cached: 1 1536; id 50 c27 => s: 1792 diff: +256 16% l 10 cached: 1 1792; id 51 c28 => s: 2048 diff: +256 14% l 11 cached: 1 2048; id 48 c29 => s: 2560 diff: +512 25% l 11 cached: 1 2560; id 49 c30 => s: 3072 diff: +512 20% l 11 cached: 1 3072; id 50 c31 => s: 3584 diff: +512 16% l 11 cached: 1 3584; id 51 c32 => s: 4096 diff: +512 14% l 12 cached: 1 4096; id 48 c33 => s: 5120 diff: +1024 25% l 12 cached: 1 5120; id 49 c34 => s: 6144 diff: +1024 20% l 12 cached: 1 6144; id 50 c35 => s: 7168 diff: +1024 16% l 12 cached: 1 7168; id 51 c36 => s: 8192 diff: +1024 14% l 13 cached: 1 8192; id 48 c37 => s: 10240 diff: +2048 25% l 13 cached: 1 10240; id 49 c38 => s: 12288 diff: +2048 20% l 13 cached: 1 12288; id 50 c39 => s: 14336 diff: +2048 16% l 13 cached: 1 14336; id 51 c40 => s: 16384 diff: +2048 14% l 14 cached: 1 16384; id 48 c41 => s: 20480 diff: +4096 25% l 14 cached: 1 20480; id 49 c42 => s: 24576 diff: +4096 20% l 14 cached: 1 24576; id 50 c43 => s: 28672 diff: +4096 16% l 14 cached: 1 28672; id 51 c44 => s: 32768 diff: +4096 14% l 15 cached: 1 32768; id 48 c45 => s: 40960 diff: +8192 25% l 15 cached: 1 40960; id 49 c46 => s: 49152 diff: +8192 20% l 15 cached: 1 49152; id 50 c47 => s: 57344 diff: +8192 16% l 15 cached: 1 57344; id 51 c48 => s: 65536 diff: +8192 14% l 16 cached: 1 65536; id 48 c49 => s: 81920 diff: +16384 25% l 16 cached: 1 81920; id 49 c50 => s: 98304 diff: +16384 20% l 16 cached: 1 98304; id 50 c51 => s: 114688 diff: +16384 16% l 16 cached: 1 114688; id 51 c52 => s: 131072 diff: +16384 14% l 17 cached: 1 131072; id 48 c53 => s: 64 diff: +0 00% l 0 cached: 8 512; id 4 Total cached: 864928 (152/432) ``` It holds a bit less of 1MB of cached entries at most, and the cache fits in a page. The plan is to use this map by default for Scudo once we make sure that there is no unforeseen impact for any of current use case. Benchmarks give the most increase in performance (with Scudo) when looking at highly threaded/contentious environments. For example, rcp2-benchmark experiences a 10K QPS increase (~3%), and a decrease of 50MB for the max RSS (~10%). On platforms like Android where we only have a couple of caches, performance remain similar. Reviewers: eugenis, kcc Reviewed By: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52371 llvm-svn: 343246
* [sanitizer] AndroidGetApiLevel for static executables.Evgeniy Stepanov2018-09-261-1/+14
| | | | | | | | | | A version of AndroidGetApiLevel for static executables that is completely compile-time. The generic version uses dl_iterate_phdr which, even though it works in static executables, crashes if called before libc is initialized. llvm-svn: 343153
* Try to fix cosmetics to keep lines below 80 chars. NFC.Martin Storsjo2018-09-251-1/+1
| | | | | | | This should fix following buildbot errors: http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/20371 llvm-svn: 343031
* [Sanitizers] [MinGW] Produce undecorated symbols for /export: directives ↵Martin Storsjo2018-09-251-2/+12
| | | | | | | | | | | | | | | when in MinGW mode In MinGW mode, the /export: directives in object files are interpreted differently; the symbols are not assumed to be decorated. Since the GNU linker doesn't support the /alternatename and /include directives, there's no such distinction for them in lld. This assumes that the resulting sanitizer libraries will be linked by lld. Differential Revision: https://reviews.llvm.org/D51882 llvm-svn: 343015
* [Sanitizers] [MinGW] Check for __i386__ in addition to _M_IX86 for i386 ↵Martin Storsjo2018-09-251-4/+4
| | | | | | | | | | | | | | | specific details The MinGW headers do define _M_IX86 (contrary to clang-cl and MSVC where it is a compiler predefined macro), but the headers that define it aren't included here. Also check these defines for setting the symbol prefix, instead of inconsistently using _WIN64 for that. Differential Revision: https://reviews.llvm.org/D51883 llvm-svn: 343013
* [hwasan] Record and display stack history in stack-based reports.Evgeniy Stepanov2018-09-242-1/+102
| | | | | | | | | | | | | | | | | | | | | Summary: Display a list of recent stack frames (not a stack trace!) when tag-mismatch is detected on a stack address. The implementation uses alignment tricks to get both the address of the history buffer, and the base address of the shadow with a single 8-byte load. See the comment in hwasan_thread_list.h for more details. Developed in collaboration with Kostya Serebryany. Reviewers: kcc Subscribers: srhines, kubamracek, mgorny, hiraditya, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52249 llvm-svn: 342923
* Revert "[hwasan] Record and display stack history in stack-based reports."Evgeniy Stepanov2018-09-242-102/+1
| | | | | | This reverts commit r342921: test failures on clang-cmake-arm* bots. llvm-svn: 342922
* [hwasan] Record and display stack history in stack-based reports.Evgeniy Stepanov2018-09-242-1/+102
| | | | | | | | | | | | | | | | | | | | | Summary: Display a list of recent stack frames (not a stack trace!) when tag-mismatch is detected on a stack address. The implementation uses alignment tricks to get both the address of the history buffer, and the base address of the shadow with a single 8-byte load. See the comment in hwasan_thread_list.h for more details. Developed in collaboration with Kostya Serebryany. Reviewers: kcc Subscribers: srhines, kubamracek, mgorny, hiraditya, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52249 llvm-svn: 342921
* Fix the configuration of the Primary allocator for Darwin ARM64 byDan Liew2018-09-241-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | changing the value of `SANITIZER_MMAP_RANGE_SIZE` to something more sensible. The available VMA is at most 64GiB and not 256TiB that was previously being used. This change gives us several wins: * Drastically improves LeakSanitizer performance on Darwin ARM64 devices. On a simple synthentic benchmark this took leak detection time from ~30 seconds to 0.5 seconds due to the `ForEachChunk(...)` method enumerating a much smaller number of regions. Previously we would pointlessly iterate over a large portion of the SizeClassAllocator32's ByteMap that would could never be set due it being configured for a much larger VM space than is actually availble. * Decreases the memory required for the Primary allocator. Previously the ByteMap inside the the allocator used an array of pointers that took 512KiB of space. Now the required space for the array is 128 bytes. rdar://problem/43509428 Differential Revision: https://reviews.llvm.org/D51173 llvm-svn: 342868
* [sanitizer] Move __sanitizer_set_death_callback to a more appropriate fileKostya Kortchinsky2018-09-212-5/+9
| | | | | | | | | | | | | | | | | | Summary: `__sanitizer_set_death_callback` is a public interface function wrapping `SetUserDieCallback`. Said function is defined in `sanitizer_termination.cc`, which is not included in all the RT. Moving the interface function to that file allows to not have a spurious public fuinction in RT that don't use it. Reviewers: eugenis Reviewed By: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52363 llvm-svn: 342747
* [sanitizer] Make __sanitizer::CheckFailed not publicKostya Kortchinsky2018-09-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As far as I can tell, there is no reason why `__sanitizer::CheckFailed` should be exported. Looking back in time, it was added with the FIXME with the following by @timurrrr: ``` [*San/RTL] Fix minor breakage Grumbling: this hasn't been caught by running 'make check-{a,l,t}san check-sanitizer' ``` I can't find any detail about the breakage, all tests seem to work for me, so maybe Windows (@rnk?) or something I have no setup for. The reason to make it private (past the FIXME) is that Scudo defines its own (without callback) and I am trying to make the .so be loadable with the UBsan one (that has its own public `CheckFailed`) with as little drama as possible. Reviewers: eugenis, rnk Reviewed By: eugenis, rnk Subscribers: kubamracek, delcypher, #sanitizers, timurrrr, rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D52279 llvm-svn: 342651
* [sanitizer][fuchsia] Fix VMAR leakKostya Kortchinsky2018-09-191-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Destroy and close a range's vmar if all its memory was unmapped. This addresses some performance regression due to the proliferation of vmars when Secondary backed allocations are concerned with Scudo on Fuchsia. When a Secondary backed allocation was freed, the associated `ReservedAddressRange` was going away after unmapping the entirety of the mapping, but without getting rid of the associated vmar properly (which was created specifically for that mapping). This resulted in an increase of defunct vmars, that in turn slowed down further new vmar allocations. This appears to solve ZX-2560/ZX-2642, at least on QEMU. Reviewers: flowerhack, mcgrathr, phosek, mseaborn Reviewed By: mcgrathr Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52242 llvm-svn: 342584
* [sanitizer_common] Fuchsia now supports .preinit_arrayPetr Hosek2018-09-171-2/+2
| | | | | | | | | Support for .preinit_array has been implemented in Fuchsia's libc, add Fuchsia to the list of platforms that support this feature. Differential Revision: https://reviews.llvm.org/D52155 llvm-svn: 342357
* [hwasan] Remove allocator interceptors.Evgeniy Stepanov2018-09-061-0/+1
| | | | | | | | | | | | | | | | | | Summary: When building without COMPILER_RT_HWASAN_WITH_INTERCEPTORS, skip interceptors for malloc/free/etc and only export their versions with __sanitizer_ prefix. Also remove a hack in mallinfo() interceptor that does not apply to hwasan. Reviewers: kcc Subscribers: kubamracek, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D51711 llvm-svn: 341598
* [hwasan] introduce __hwasan_print_memory_usageKostya Serebryany2018-09-061-4/+4
| | | | llvm-svn: 341592
* [hwasan] when verbose_threads==1, print the memory usage per threadKostya Serebryany2018-09-051-0/+3
| | | | llvm-svn: 341507
* Add glibc_prereq to platform limits mmsghdrBrian Cain2018-09-051-4/+5
| | | | | | | | | sendmmsg requires glibc >= 2.14. Fixes PR38589. Review: https://reviews.llvm.org/D51538 llvm-svn: 341442
* [sanitizer] optimize internal_memset for the most performance critical case ↵Kostya Serebryany2018-09-041-0/+12
| | | | | | (16-byte-aligned) llvm-svn: 341420
* Fix buildbot testDavid Carlier2018-09-021-1/+1
| | | | llvm-svn: 341286
* [Sanitizer] openbsd build fixDavid Carlier2018-09-021-0/+6
| | | | | | | | | | | | sysctl has a different signature under OpenBSD Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D51572 llvm-svn: 341285
* Try to unbreak internal_sysctl() for MacOSXKamil Rytarowski2018-08-311-1/+2
| | | | | | Cast the 5th argument to (void *), removing cast. llvm-svn: 341192
* Try to fix internal_sysctl() for MacOSXKamil Rytarowski2018-08-311-1/+1
| | | | | | Cast the first argument to (int *) removing const. llvm-svn: 341187
* Improve portability of internal_sysctl()Kamil Rytarowski2018-08-312-2/+2
| | | | | | Add an explicit cast from uptr to size_t to prevent potential type mismatch. llvm-svn: 341183
* Add internal_sysctl() used by FreeBSD, NetBSD, OpenBSD and MacOSXKamil Rytarowski2018-08-315-18/+34
| | | | | | | | | | | | | | | | | | | | | | | Summary: Switch local sysctl(2) calls to internal_sysctl(). This is a preparation for introduction of interceptors for the sysctl*() family of functions and switching `internal_sysctl*()` to libc calls bypassing interceptors. No functional change intended with this revision. Reviewers: vitalybuka, joerg, kcc Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D51425 llvm-svn: 341181
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-301-6/+47
| | | | | | | | | | | | | | | | | | | | Summary: Port libFuzzer to windows-msvc. This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well. It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch. It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them. Patch By: metzman Reviewers: morehouse, rnk Reviewed By: morehouse, rnk Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 341082
* [sanitizer] Transition to new _zx_vmar_... callsPetr Hosek2018-08-302-18/+16
| | | | | | | | | Now that all _zx_vmar_... calls have been updated, we can undo the change made in r337801 and switch over to the new calls. Differential Revision: https://reviews.llvm.org/D51468 llvm-svn: 341011
* [sanitizer] reapply r340884 'Add a RingBuffer class to sanitizer_common', ↵Kostya Serebryany2018-08-294-0/+159
| | | | | | with fixes for Windows llvm-svn: 340969
* [sanitizer] Revert D50940Kostya Kortchinsky2018-08-293-10/+7
| | | | | | | | | | | | | | | | | Summary: The previous version of the patch makes some code unable to distinguish failure to map address 0 and error. Revert to turn the bots back to green while figuring out a new approach. Reviewers: eugenis Reviewed By: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D51451 llvm-svn: 340957
* Revert "[libFuzzer] Port to Windows"Matt Morehouse2018-08-291-47/+6
| | | | | | This reverts r340949 due to bot breakage again. llvm-svn: 340954
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-291-6/+47
| | | | | | | | | | | | | | | | | | Summary: Port libFuzzer to windows-msvc. This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well. It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch. It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them. Reviewers: morehouse, rnk Reviewed By: morehouse, rnk Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 340949
* Revert r340884 "Add a RingBuffer class to sanitizer_common"Hans Wennborg2018-08-294-166/+0
| | | | | | | | | | | | | | | | | | | The test doesn't pass on Windows, where sizeof(long) == 4 also on 64-bit, and so it isn't a multiple of sizeof(void*). This also reverts the follow-up r340886. > Summary: a constrained RingBuffer optimized for fast push > > Reviewers: eugenis > > Reviewed By: eugenis > > Subscribers: kubamracek, mgorny, delcypher, #sanitizers, llvm-commits > > Differential Revision: https://reviews.llvm.org/D51196 llvm-svn: 340924
* Introduce new type for inteceptors UINTMAX_TKamil Rytarowski2018-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: The UINTMAX_T type will be used in new interceptors. While there, correct the type of strtoumax(3) from INTMAX_T to UINTMAX_T. Original patch from Yang Zheng. Reviewers: vitalybuka, kcc, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, tomsun.0.7, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D51106 llvm-svn: 340907
* [sanitizer] fix a testKostya Serebryany2018-08-281-19/+20
| | | | llvm-svn: 340886
* Add a RingBuffer class to sanitizer_commonKostya Serebryany2018-08-284-0/+165
| | | | | | | | | | | | | | Summary: a constrained RingBuffer optimized for fast push Reviewers: eugenis Reviewed By: eugenis Subscribers: kubamracek, mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D51196 llvm-svn: 340884
* Revert "[libFuzzer] Port to Windows"Matt Morehouse2018-08-281-47/+6
| | | | | | This reverts commit r340860 due to failing tests. llvm-svn: 340867
* [libFuzzer] Port to WindowsMatt Morehouse2018-08-281-6/+47
| | | | | | | | | | | | | | | | | | | | Summary: Port libFuzzer to windows-msvc. This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well. It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch. It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them. Patch By: metzman Reviewers: morehouse, rnk Reviewed By: morehouse, rnk Subscribers: morehouse, kcc, eraman Differential Revision: https://reviews.llvm.org/D51022 llvm-svn: 340860
* [sanitizer][fuzzer] Transition back to ZX_TIME_INFINITEPetr Hosek2018-08-271-4/+1
| | | | | | | | | | Now that all Zircon calls have been transitioned to take time as signed value, we can transition back to ZX_TIME_INFINITE, undoing the change made in r337802. Differential Revision: https://reviews.llvm.org/D51266 llvm-svn: 340764
* [Sanitizer] implementing remaining function under OSXDavid Carlier2018-08-242-5/+8
| | | | | | | | | | | | | - GetRandom and GetnumberOfCPUs using sys call for the former. - enabling unit tests for the other oses. Reviewers: kubamracek Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D50937 llvm-svn: 340621
* [sanitizer] Don't call task_for_pid(mach_task_self). NFC.Kuba Mracek2018-08-231-7/+1
| | | | | | | | | | Calling task_for_pid with mach_task_self is just returning mach_task_self anyway, but it also triggers system warnings (task_for_pid is only supposed to be used by high-privileged executables). NFC. rdar://problem/39198248 Differential Revision: https://reviews.llvm.org/D51119 llvm-svn: 340587
* [sanitizer] Change Mmap*NoAccess to return nullptr on errorKostya Kortchinsky2018-08-233-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `MmapNoAccess` & `MmapFixedNoAccess` return directly the result of `internal_mmap`, as opposed to other Mmap functions that return nullptr. This inconsistency leads to some confusion for the callers, as some check for `~(uptr)0` (`MAP_FAILED`) for failure (while it can fail with `-ENOMEM` for example). Two potential solutions: change the callers, or make the functions return `nullptr` on failure to follow the precedent set by the other functions. The second option looked more appropriate to me. Correct the callers that were wrongly checking for `~(uptr)0` or `MAP_FAILED`. TODO for follow up CLs: - There are a couple of `internal_mmap` calls in XRay that check for MMAP_FAILED as a result as well (cc: @dberris); they should use `internal_iserror`; Reviewers: eugenis, alekseyshl, dberris, kubamracek Reviewed By: alekseyshl Subscribers: kristina, kubamracek, delcypher, #sanitizers, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D50940 llvm-svn: 340576
* [tsan] Adjust setjmp/longjmp handling on Darwin for macOS MojaveKuba Mracek2018-08-212-0/+8
| | | | | | | | | | On macOS Mojave, the OS started using the XOR-by-a-secret-key scheme (same as glibc is alread doing) for storing the SP value in setjmp environment. We need to adjust for that to keep supporting setjmp/longjmp on latest Darwin. The patch is basically doing the same what we're already doing for glibc. rdar://problem/43542596 Differential Revision: https://reviews.llvm.org/D51064 llvm-svn: 340350
* [sanitizer] Use private futex operations for BlockingMutexKostya Kortchinsky2018-08-201-2/+6
| | | | | | | | | | | | | | | | | | Summary: Use `FUTEX_PRIVATE_FLAG` in conjunction with the wait & wake operations employed by `BlockingMutex`. As far as I can tell, the mutexes are process-private, and there is an actual performance benefit at employing the private operations. There should be no downside to switching to it. Reviewers: eugenis, alekseyshl, dvyukov Reviewed By: dvyukov Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D50910 llvm-svn: 340178
* [sanitizer] When setting up shadow memory on iOS, fix handling the return ↵Kuba Mracek2018-08-171-2/+2
| | | | | | | | | | value of task_info on older OS versions task_vm_info is a "revisioned" structure, new OS versions add fields to the end, and compatibility is based on the reported size. On older OS versions, min_address/max_address is not filled back. Let's handle that case. Unfortunately, we can't really write a test (as the failure only happens when on a specific OS version). Differential Revision: https://reviews.llvm.org/D50275 llvm-svn: 340058
* [Sanitizer] Fix build openbsdDavid Carlier2018-08-161-1/+10
| | | | | | | | | | | | | | - The alternative syscall exists only on FreeBSD. - Adding OpenBSD's equivalent and while at it other remaining oses ones. Reviewers: vitalybuka, krytarowsky, hiraditya Reviewed By: hiraditya Differential Revision: https://reviews.llvm.org/D50760 llvm-svn: 339886
* Reland "SafeStack: Delay thread stack clean-up""Vlad Tsyrklevich2018-08-142-0/+9
| | | | | | | | | | This relands commit r339405 (reverted in commit r339408.) The original revert was due to tests failing on a darwin buildbot; however, after looking at the affected code more I realized that the Darwin safestack support has always been broken and disabled it in r339719. This relands the original commit. llvm-svn: 339723
OpenPOWER on IntegriCloud