summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* [CMake] [MinGW] Build address sanitizer for MinGW if building with clangMartin Storsjo2018-09-261-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D51885 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343074 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] [MinGW] Only try to export MSVC specific C++ symbols if building with ↵Martin Storsjo2018-09-261-1/+1
| | | | | | | | a MSVC like compiler Differential Revision: https://reviews.llvm.org/D51878 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343073 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343031 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343015 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] [Windows] Avoid including windows.h in asan_malloc_win.ccMartin Storsjo2018-09-251-2/+11
| | | | | | | | | | Instead provide manual declarations of the used types, to avoid pulling in conflicting declarations of some of the functions that are to be overridden. Differential Revision: https://reviews.llvm.org/D51914 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343014 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@343013 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] Record and display stack history in stack-based reports.Evgeniy Stepanov2018-09-2413-158/+494
| | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342923 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[hwasan] Record and display stack history in stack-based reports."Evgeniy Stepanov2018-09-2413-494/+158
| | | | | | This reverts commit r342921: test failures on clang-cmake-arm* bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342922 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] Record and display stack history in stack-based reports.Evgeniy Stepanov2018-09-2413-158/+494
| | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342921 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] [builtins] Add logb/logbf/logbl methods to compiler-rt to ↵Jordan Rupprecht2018-09-246-10/+77
| | | | | | | | | | | | | | | | | | | | | | | avoid libm dependencies when possible. Summary: The complex division builtins (div?c3) use logb methods from libm to scale numbers during division and avoid rounding issues. However, these come from libm, meaning anyone that uses --rtlib=compiler-rt also has to include -lm. Implement logb* methods for standard ieee 754 floats so we can avoid -lm on those platforms, falling back to the old behavior (using either logb() or `__builtin_logb()`) when not supported. These new methods are defined internally as `__compiler_rt_logb` so as not to conflict with the libm definitions in any way. This fixes just the libm methods mentioned in PR32279 and PR28652. libc is still required, although that seems to not be an issue. Note: this is proposed as an alternative to just adding -lm: D49330. Reviewers: efriedma, compnerd, scanon, echristo Reviewed By: echristo Subscribers: jsji, echristo, nemanjai, dberris, mgorny, kbarton, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49514 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342917 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342868 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Clean up XRay build configurationDean Michael Berris2018-09-242-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change spans both LLVM and compiler-rt, where we do the following: - Add XRay to the LLVMBuild system, to allow for distributing the XRay trace loading library along with the LLVM distributions. - Use `llvm-config` better in the compiler-rt XRay implementation, to depend on the potentially already-distributed LLVM XRay library. While this is tested with the standalone compiler-rt build, it does require that the LLVMXRay library (and LLVMSupport as well) are available during the build. In case the static libraries are available, the unit tests will build and work fine. We're still having issues with attempting to use a shared library version of the LLVMXRay library since the shared library might not be accessible from the standard shared library lookup paths. The larger change here is the inclusion of the LLVMXRay library in the distribution, which allows for building tools around the XRay traces and profiles that the XRay runtime already generates. Reviewers: echristo, beanz Subscribers: mgorny, hiraditya, mboerger, llvm-commits Differential Revision: https://reviews.llvm.org/D52349 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342859 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342747 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] Update use of internal_mmapDean Michael Berris2018-09-214-36/+41
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The implementation of `internal_mmap(...)` deviates from the contract of `mmap(...)` -- i.e. error returns are actually the equivalent of `errno` results. We update how XRay uses `internal_mmap(...)` to better handle these error conditions. In the process, we change the default pointers we're using from `char*` to `uint8_t*` to prevent potential usage of the pointers in the string library functions that expect to operate on `char*`. We also take the chance to "promote" sizes of individual `internal_mmap` requests to at least page size bytes, consistent with the expectations of calls to `mmap`. Reviewers: cryptoad, mboerger Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52361 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342745 91177308-0d34-0410-b5e6-96231b3b80d8
* [fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with ↵Jonathan Metzman2018-09-202-63/+1
| | | | | | | | | | | | | | | | | | | | | FuzzerExtFunctionsWeakAlias.cpp Summary: Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp to get externally defined functions (eg: LLVMFuzzerInitialize, LLVMFuzzerCustomMutator, etc) working again. Also enable tests that depended on these functions (on windows) Reviewers: rnk, morehouse Reviewed By: rnk, morehouse Subscribers: rnk, morehouse, mgorny Differential Revision: https://reviews.llvm.org/D51700 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342698 91177308-0d34-0410-b5e6-96231b3b80d8
* [Hwasan] interceptor macro / extra comma removalDavid Carlier2018-09-201-5/+5
| | | | | | | | | | | | | gcc being pedantic, removing the unnecessary comma. Reviewers: eugenis, kcc Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D52305 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342680 91177308-0d34-0410-b5e6-96231b3b80d8
* [winasan] Unpoison the stack in NtTerminateThreadDavid Major2018-09-201-1/+11
| | | | | | | | | | In long-running builds we've seen some ASan complaints during thread creation that we suspect are due to leftover poisoning from previous threads whose stacks occupied that memory. This patch adds a hook that unpoisons the stack just before the NtTerminateThread syscall. Differential Revision: https://reviews.llvm.org/D52091 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342652 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342651 91177308-0d34-0410-b5e6-96231b3b80d8
* [winasan] Reduce hotpatch prefix check to 8 bytesDavid Major2018-09-201-4/+4
| | | | | | | | | | Same idea as r310419: The 8 byte nop is a suffix of the 9 byte nop, and we need at most 6 bytes. Differential Revision: https://reviews.llvm.org/D51788 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342649 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] FDRLogWriter AbstractionDean Michael Berris2018-09-206-88/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change introduces an `FDRLogWriter` type which is responsible for serialising metadata and function records to character buffers. This is the first step in a refactoring of the implementation of the FDR runtime to allow for more granular testing of the individual components of the implementation. The main contribution of this change is a means of hiding the details of how specific records are written to a buffer, and for managing the extents of these buffers. We make use of C++ features (templates and some metaprogramming) to reduce repetition in the act of writing out specific kinds of records to the buffer. In this process, we make a number of changes across both LLVM and compiler-rt to allow us to use the `Trace` abstraction defined in the LLVM project in the testing of the runtime implementation. This gives us a closer end-to-end test which version-locks the runtime implementation with the loading implementation in LLVM. We also allow using gmock in compiler-rt unit tests, by adding the requisite definitions in the `AddCompilerRT.cmake` module. We also add the terminfo library detection along with inclusion of the appropriate compiler flags for header include lookup. Finally, we've gone ahead and updated the FDR logging implementation to use the FDRLogWriter for the lowest-level record-writing details. Following patches will isolate the state machine transitions which manage the set-up and tear-down of the buffers we're using in multiple threads. Reviewers: mboerger, eizan Subscribers: mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52220 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342617 91177308-0d34-0410-b5e6-96231b3b80d8
* [builtins] Add __emutls_unregister_key functionYi Kong2018-09-201-0/+13
| | | | | | | | | | | | | This is called by Bionic on dlclose to delete the emutls pthread key. The return value of pthread_key_delete is unchecked and behaviour of multiple calls to the method is dependent on the implementation of pthread_key_delete. Differential Revision: https://reviews.llvm.org/D52251 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342608 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[XRay][compiler-rt] FDRLogWriter Abstraction" and 1 more.Evgeniy Stepanov2018-09-196-284/+87
| | | | | | | | Revert the following 2 commits to fix standalone compiler-rt build: * r342523 [XRay] Detect terminfo library * r342518 [XRay][compiler-rt] FDRLogWriter Abstraction git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342596 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342584 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt][TSan] Add TSan runtime support for Go on linux-aarch64.Arnaud A. de Grandmaison2018-09-194-2/+72
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds TSan runtime support for Go on linux-aarch64 platforms. This enables people working on golang to implement their platform/language part of the TSan support. Basic testing is done with lib/tsan/go/buildgo.sh. Additional testing will be done as part of the work done in the Go project. It is intended to support other VMA sizes, except 39 which does not have enough bits to support the Go heap requirements. Patch by Fangming Fang <Fangming.Fang@arm.com>. Reviewers: kubamracek, dvyukov, javed.absar Subscribers: mcrosier, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D52167 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342541 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Detect terminfo libraryDean Michael Berris2018-09-191-1/+6
| | | | | | | | | Instead of assuming `-ltinfo` works, check whether there's terminfo support on the host where LLVMSupport is compiled. Follow-up to D52220. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342523 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay][compiler-rt] FDRLogWriter AbstractionDean Michael Berris2018-09-186-87/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change introduces an `FDRLogWriter` type which is responsible for serialising metadata and function records to character buffers. This is the first step in a refactoring of the implementation of the FDR runtime to allow for more granular testing of the individual components of the implementation. The main contribution of this change is a means of hiding the details of how specific records are written to a buffer, and for managing the extents of these buffers. We make use of C++ features (templates and some metaprogramming) to reduce repetition in the act of writing out specific kinds of records to the buffer. In this process, we make a number of changes across both LLVM and compiler-rt to allow us to use the `Trace` abstraction defined in the LLVM project in the testing of the runtime implementation. This gives us a closer end-to-end test which version-locks the runtime implementation with the loading implementation in LLVM. We also allow using gmock in compiler-rt unit tests, by adding the requisite definitions in the `AddCompilerRT.cmake` module. Finally, we've gone ahead and updated the FDR logging implementation to use the FDRLogWriter for the lowest-level record-writing details. Following patches will isolate the state machine transitions which manage the set-up and tear-down of the buffers we're using in multiple threads. Reviewers: mboerger, eizan Subscribers: mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52220 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342518 91177308-0d34-0410-b5e6-96231b3b80d8
* [builtins] Fix c?zdi2 on sparc64/Linux and ignore riscv32Kristina Brooks2018-09-182-4/+14
| | | | | | | | | | | | | | | On sparc64/Linux, sparc64 isn't defined; the canonical way of checking for sparc64 is sparc && arch64, which also works on the BSDs and Solaris. Since this problem does not occur on 32-bit architectures, riscv32 can be ignored. This fixes and refines rL324593. Patch by jrtc27 (James Clarke) Differential Revision: https://reviews.llvm.org/D43146 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342504 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] Avoid fuzzer symbols being hidden.Matt Morehouse2018-09-171-1/+1
| | | | | | | | Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1490845#c5. Patch By: Mike Hommey git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342423 91177308-0d34-0410-b5e6-96231b3b80d8
* [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342357 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Simplify FDR buffer managementDean Michael Berris2018-09-174-102/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change makes XRay FDR mode use a single backing store for the buffer queue, and have indexes into that backing store instead. We also remove the reliance on the internal allocator implementation in the FDR mode logging implementation. In the process of making this change we found an inconsistency with the way we're returning buffers to the queue, and how we're setting the extents. We take the chance to simplify the way we're managing the extents of each buffer. It turns out we do not need the indirection for the extents, so we co-host the atomic 64-bit int with the buffer object. It also seems that we've not been returning the buffers for the thread running the flush functionality when writing out the files, so we can run into a situation where we could be missing data. We consolidate all the allocation routines now into xray_allocator.h, where we used to have routines defined in xray_buffer_queue.cc. Reviewers: mboerger, eizan Subscribers: jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D52077 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342356 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Fix FDR initializationDean Michael Berris2018-09-171-3/+14
| | | | | | Follow-up to D51606. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342355 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Remove the deprecated __xray_log_init APIPetr Hosek2018-09-155-323/+72
| | | | | | | | | This API has been deprecated three months ago and shouldn't be used anymore, all clients should migrate to the new string based API. Differential Revision: https://reviews.llvm.org/D51606 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342318 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] use a single Printf per line when printing a report (more friendly ↵Kostya Serebryany2018-09-131-5/+8
| | | | | | to android logging) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342164 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] Bug fixes for FDR custom event and arg-loggingDean Michael Berris2018-09-131-18/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change has a number of fixes for FDR mode in compiler-rt along with changes to the tooling handling the traces in llvm. In the runtime, we do the following: - Advance the "last record" pointer appropriately when writing the custom event data in the log. - Add XRAY_NEVER_INSTRUMENT in the rewinding routine. - When collecting the argument of functions appropriately marked, we should not attempt to rewind them (and reset the counts of functions that can be re-wound). In the tooling, we do the following: - Remove the state logic in BlockIndexer and instead rely on the presence/absence of records to indicate blocks. - Move the verifier into a loop associated with each block. Reviewers: mboerger, eizan Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D51965 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342122 91177308-0d34-0410-b5e6-96231b3b80d8
* [TSan] Update test valuesVlad Tsyrklevich2018-09-121-4/+4
| | | | | | | | Similarly to before, D51985 again reduced the number of registers required for the read/write routines causing this test to fail on sanitizer-x86_64-linux-autoconf. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342092 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] On every use-after-free print a developer note: the index of this ↵Kostya Serebryany2018-09-121-5/+12
| | | | | | heap object in the thread's deallocation ring buffer. Mostly useful to hwasan developers, will hopefully let us know the good size of the deallocation ring buffer git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342014 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] [Windows] Include windows.h and psapi.h with lowercaseMartin Storsjo2018-09-112-3/+3
| | | | | | | | | | | | | This fixes building on a case sensitive filesystem with mingw-w64 headers, where all headers are lowercase, and matches how these headers are included elsewhere in compiler-rt. Also include these headers with angle brackets, as they are system headers. Differential Revision: https://reviews.llvm.org/D51913 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341983 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] [Windows] Remove const from _msize function declaration parameterMartin Storsjo2018-09-111-1/+1
| | | | | | | | | This function isn't declared with a const parameter anywhere; neither in MSVC (neither in ucrt or in older msvcrt versions) nor in mingw-w64. Differential Revision: https://reviews.llvm.org/D51876 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341903 91177308-0d34-0410-b5e6-96231b3b80d8
* [Windows] Include BaseTsd.h with lowercaseMartin Storsjo2018-09-101-1/+1
| | | | | | | | | | This fixes building on a case sensitive filesystem with mingw-w64 headers, where all headers are lowercase. This header actually also is named with a lowercase name in the Windows SDK as well. Differential Revision: https://reviews.llvm.org/D51877 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341857 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch to using a reserved identifier for this internal compiler-rt function.Richard Smith2018-09-082-7/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341736 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] Export memory stats through /proc/$PID/maps.Evgeniy Stepanov2018-09-084-7/+46
| | | | | | | Adds a line to /proc/$PID/maps with more or less up-to-date memory stats of the process. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341735 91177308-0d34-0410-b5e6-96231b3b80d8
* [XRay] XRAY_NEVER_INSTRUMENT more functions, consolidate allocatorsDean Michael Berris2018-09-075-101/+144
| | | | | | | | | | | | | | | | | | | | | | Summary: In this change we apply `XRAY_NEVER_INSTRUMENT` to more functions in the profiling implementation to ensure that these never get instrumented if the compiler used to build the library is capable of doing XRay instrumentation. We also consolidate all the allocators into a single header (xray_allocator.h) which sidestep the use of the internal allocator implementation in sanitizer_common. This addresses more cases mentioned in llvm.org/PR38577. Reviewers: mboerger, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51776 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341647 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] Fix malloc overflow detection.Evgeniy Stepanov2018-09-071-7/+9
| | | | | | | | | Check size limit before rounding up, otherwise malloc((size_t)-1) would happily allocate 0 bytes. Steal a nice test case from scudo. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341612 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] change the thread list so that main_thread can also be removedKostya Serebryany2018-09-072-8/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341610 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] Remove allocator interceptors.Evgeniy Stepanov2018-09-063-93/+93
| | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341598 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] fix pthread_exitKostya Serebryany2018-09-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341594 91177308-0d34-0410-b5e6-96231b3b80d8
* [hwasan] introduce __hwasan_print_memory_usageKostya Serebryany2018-09-067-7/+59
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341592 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSan] store origins for variadic function parameters in ↵Alexander Potapenko2018-09-061-0/+6
| | | | | | | | | | | | | | | | | | __msan_va_arg_origin_tls Add the __msan_va_arg_origin_tls TLS array to keep the origins for variadic function parameters. Change the instrumentation pass to store parameter origins in this array. This is a reland of r341528. test/msan/vararg.cc doesn't work on Mips, PPC and AArch64 (because this patch doesn't touch them), XFAIL these arches. Also turned out Clang crashed on i80 vararg arguments because of incorrect origin type returned by getOriginPtrForVAArgument() - fixed it and added a test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341554 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSan] revert r341528 to unbreak the botsAlexander Potapenko2018-09-061-6/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341541 91177308-0d34-0410-b5e6-96231b3b80d8
* ARM: wrap call to __clzsi2 so that the name is correct on MachO.Tim Northover2018-09-061-1/+1
| | | | | | | | MachO symbols are prefixed with an extra '_' (that's 3 in total for this function), so assembly calls have to go through a wrapper to insert any prefix needed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@341540 91177308-0d34-0410-b5e6-96231b3b80d8