summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-12-06[TSan] Make more TSan interceptors symbolizer-aware.Alex Shlyapnikov
Summary: Switching the rest of intercepted allocs to InternalAlloc (well, except __libc_memalign) when current thread is 'in_symbolizer'. Symbolizer might (and does) use allocation functions other than malloc/calloc/realloc. posix_memalign is the one actually used, others switched just in case (since the failure is obscure and not obvious to diagnose). Reviewers: dvyukov Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D40877 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[Sanitizers] Use SANITIZER_* macros in lib/interceptionKamil Rytarowski
Summary: Unlike the rest of the sanitizer code, lib/interception uses native macros like __linux__ to check for specific targets instead of the common ones like SANITIZER_LINUX. When working on the Solaris port of the sanitizers, the current style was found to not only be inconsistent, but clumsy to use because the canonical way to check for Solaris is to check for __sun__ && __svr4__ which is a mouthful. Therefore, this patch switches to use SANITIZER_* macros instead. Tested on x86_64-pc-linux-gnu. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: #sanitizers, srhines, krytarowski, llvm-commits, fedor.sergeev Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39798 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319906 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[scudo] Correct performance regression in SecondaryKostya Kortchinsky
Summary: This wasn't noticed: `RoundUpTo` doesn't produce a constant expression, so the sizes were not constant either. Enforce them to be static const, replace `RoundUpTo` by its expression. The compiler can now optimize the associated computations accordingly. Also looking at the produced assembly, `PageSize` was fetched multiple times during `Allocate`, so keep a local value of it. As a result it's fetched once and kept in a register. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40862 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319903 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06[compiler-rt][xray][cmake] Fix a build issue caused by set/item mixupSimon Dardis
r319165 introduced a change to CMakeLists.txt for xray where the set of supported architectures for XRay was iterated over, tested if they could be targeted then passed to add_compiler_rt_object_libraries. However all targets were passed, rather than the architecture that was just tested. For cases such as MIPS, where mips and mips64 are supported, cmake would then test if mips64 could be targetted resulting in an attempt to produce multiple identical logical target names, falling afowl of CMP0002. Reviewers: dberris Differential Revision: https://reviews.llvm.org/D40890 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319893 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06Fix typo fcvr -> fcvt and attempt to unbreak MSan/!NetBSDKamil Rytarowski
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06Fix typo gcvr -> gcvt and attempt to unbreak MSan/!NetBSDKamil Rytarowski
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06Support pthread_key_create symbol alias in MSan/NetBSDKamil Rytarowski
Summary: NetBSD uses indirection symbol for a set of threading functions. Add alias to handle __libc_thr_keycreate the same way as pthread_key_create. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40767 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319868 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06Disable absent functions in MSan/NetBSD interceptorsKamil Rytarowski
Summary: Disable for NetBSD missing functions missing in this OS: - mempcpy, - __libc_memalign, - malloc_usable_size, - stpcpy, - gcvt, - wmempcpy, - fcvt. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc Reviewed By: vitalybuka Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40764 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319866 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[msan] Fix formattingVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319844 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[msan] add strtouq msan interceptorVitaly Buka
Summary: Fixes https://github.com/google/sanitizers/issues/892 Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40853 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05Revert test case change for r319794Xinliang David Li
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[PGO] fix test case for D40702Xinliang David Li
Differential Revision: http://reviews.llvm.org/D40702 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[libFuzzer] Make redirects happen in proper sequence.Matt Morehouse
"> file" must come before "2>&1" to have redirection occur correctly in all cases. Fixes a regression on minimize_two_crashes.test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319792 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[scudo] Get rid of the thread local PRNG & header saltKostya Kortchinsky
Summary: It was deemed that the salt in the chunk header didn't improve security significantly (and could actually decrease it). The initial idea was that the same chunk would different headers on different allocations, allowing for less predictability. The issue is that gathering the same chunk header with different salts can give information about the other "secrets" (cookie, pointer), and that if an attacker leaks a header, they can reuse it anyway for that same chunk anyway since we don't enforce the salt value. So we get rid of the salt in the header. This means we also get rid of the thread local Prng, and that we don't need a global Prng anymore as well. This makes everything faster. We reuse those 8 bits to store the `ClassId` of a chunk now (0 for a secondary based allocation). This way, we get some additional speed gains: - `ClassId` is computed outside of the locked block; - `getActuallyAllocatedSize` doesn't need the `GetSizeClass` call; - same for `deallocatePrimary`; We add a sanity check at init for this new field (all sanity checks are moved in their own function, `init` was getting crowded). Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40796 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319791 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[XRay][compiler-rt] Use __sanitizer::Atexit() instead of atexit()Dean Michael Berris
Follow-up to D40828. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319764 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[XRay][compiler-rt] Implement XRay Basic Mode FilteringDean Michael Berris
Summary: This change implements the basic mode filtering similar to what we do in FDR mode. The implementation is slightly simpler in basic-mode filtering because we have less details to remember, but the idea is the same. At a high level, we do the following to decide when to filter function call records: - We maintain a per-thread "shadow stack" which keeps track of the XRay instrumented functions we've encountered in a thread's execution. - We push an entry onto the stack when we enter an XRay instrumented function, and note the CPU, TSC, and type of entry (whether we have payload or not when entering). - When we encounter an exit event, we determine whether the function being exited is the same function we've entered recently, was executing in the same CPU, and the delta of the recent TSC and the recorded TSC at the top of the stack is less than the equivalent amount of microseconds we're configured to ignore -- then we un-wind the record offset an appropriate number of times (so we can overwrite the records later). We also support limiting the stack depth of the recorded functions, so that we don't arbitrarily write deep function call stacks. Reviewers: eizan, pelikan, kpw, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40828 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319762 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-05[XRay][compiler-rt] Implement logging implementation registrationDean Michael Berris
Summary: This change allows for registration of multiple logging implementations through a central mechanism in XRay, mapping an implementation to a "mode". Modes are strings that are used as keys to determine which implementation to install through a single API. This mechanism allows users to choose which implementation to install either from the environment variable 'XRAY_OPTIONS' with the `xray_mode=` flag, or programmatically using the `__xray_select_mode(...)` function. Here, we introduce two API functions for the XRay logging: __xray_log_register_mode(Mode, Impl): Associates an XRayLogImpl to a string Mode. We can only have one implementation associated with a given Mode. __xray_log_select_mode(Mode): Finds the associated Impl for Mode and installs it as if by calling `__xray_set_log_impl(...)`. Along with these changes, we also deprecate the xray_naive_log and xray_fdr_log flags and encourage users to instead use the xray_mode flag. Reviewers: kpw, dblaikie, eizan, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40703 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319759 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[libFuzzer] Remove const from ignoreRemainingArgs return value.Matt Morehouse
In this case const does nothing but trigger a warning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[libFuzzer] Remove FuzzerCommand.cpp from build sources.Matt Morehouse
FuzzerCommand.cpp was not introduced in r319680. Instead, it was implemented in the header file. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319682 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Disable invalid-pointer-pairs-threads.cc on Darwin.Alex Shlyapnikov
pthread barriers are not available on OS X Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319681 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[libFuzzer] Encapsulate commands in a class.Matt Morehouse
Summary: To be more portable (especially w.r.t. platforms without system()), commands should be managed programmatically rather than via string manipulation on the command line. This change introduces Fuzzer::Command, with methods to manage arguments and flags, set output options, and execute the command. Patch By: aarongreen Reviewers: kcc, morehouse Reviewed By: kcc, morehouse Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40103 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319680 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[sanitizer] 64-bit allocator's PopulateFreeArray partial refactorKostya Kortchinsky
Summary: This is an attempt at making `PopulateFreeArray` less obscure, more consistent, and a tiny bit faster in some circumstances: - use more consistent variable names, that work both for the user & the metadata portions of the code; the purpose of the code is mostly the same for both regions, so it makes sense that the code should be mostly similar as well; - replace the while sum loops with a single `RoundUpTo`; - mask most of the metadata computations behind kMetadataSize, allowing some blocks to be completely optimized out if not use metadata; - `const` the constant variables; - add a `LIKELY` as the branch it applies to will almost always be taken. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D40754 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319673 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Fix test/asan/TestCases/Posix/invalid-pointer-pairs-threads.ccAlex Shlyapnikov
Explicitly add pthread for asan-dynamic config. Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04Handle NetBSD symbol renaming in sanitizer_common_interceptors.incKamil Rytarowski
Summary: NetBSD renames symbols for historical and compat reasons. Add required symbol renames in sanitizer_common_interceptors.inc: - clock_gettime -> __clock_gettime50 - clock_getres -> __clock_getres50 - clock_settime -> __clock_settime50 - setitimer -> __setitimer50 - getitimer -> __getitimer50 - opendir -> __opendir30 - readdir -> __readdir30 - time -> __time50 - localtime_r -> __localtime_r50 - gmtime_r -> __gmtime_r50 - gmtime -> __gmtime50 - ctime -> __ctime50 - ctime_r -> __ctime_r50 - mktime -> __mktime50 - getpwnam -> __getpwnam50 - getpwuid -> __getpwuid50 - getpwnam_r -> __getpwnam_r50 - getpwuid_r -> __getpwuid_r50 - getpwent -> __getpwent50 - glob -> __glob30 - wait3 -> __wait350 - wait4 -> __wait450 - readdir_r -> __readdir_r30 - setlocale -> __setlocale50 - scandir -> __scandir30 - sigtimedwait -> __sigtimedwait50 - sigemptyset -> __sigemptyset14 - sigfillset -> __sigfillset14 - sigpending -> __sigpending14 - sigprocmask -> __sigprocmask14 - shmctl -> __shmctl50 - times -> __times13 - stat -> __stat50 - getutent -> __getutent50 - getutxent -> __getutxent50 - getutxid -> __getutxid50 - getutxline -> __getutxline50 Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, cryptoad, dvyukov Reviewed By: cryptoad Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40765 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04These tests require x86 80-bit doubles. Mark them so.Sterling Augustine
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319669 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Enhance libsanitizer support for invalid-pointer-pair.Alex Shlyapnikov
Following patch adds support of all memory origins in CheckForInvalidPointerPair function. For small difference of pointers, it's directly done in shadow memory (the limit was set to 2048B). Then we search for origin of first pointer and verify that the second one has the same origin. If so, we verify that it points either to a same variable (in case of stack memory or a global variable), or to a same heap segment. Committing on behanf of marxin and jakubjelinek. Reviewers: alekseyshl, kcc Subscribers: llvm-commits Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04Move __tsan::Vector to __sanitizerKamil Rytarowski
Summary: The low-fat STL-like vector container will be reused in MSan. It is needed to implement an atexit(3) interceptor on NetBSD/amd64 in MSan. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc Reviewed By: dvyukov Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40726 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[libFuzzer] add a flag -malloc_limit_mbKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319590 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[ubsan] Re-commit: lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. The original attempt, r319525 was reverted in r319526 due to the failures in compiler-rt standalone builds. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[libFuzzer] remove stale flags; NFCKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319572 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[libFuzzer] add an experimental search heuristic flag -reduce_depthKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319571 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[compiler-rt] Remove out of date commentShoaib Meenai
Per beanz, building compiler-rt standalone is a pretty important use case, so the comment is very out of date. Differential Revision: https://reviews.llvm.org/D40740 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319570 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[compiler-rt] Add install-*-stripped targetsShoaib Meenai
These targets strip during installation, and are required to support install-distribution-stripped in LLVM (to support a stripped distribution). LLVM has an add_llvm_install_targets function for this purpose, but we can't rely on LLVM being present. Differential Revision: https://reviews.llvm.org/D40687 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319569 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01Add missing signal.h header:Ismail Donmez
/havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:20: error: variable has incomplete type 'struct sigaction' struct sigaction act = {}; ^ /havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:10: note: forward declaration of 'sigaction' struct sigaction act = {}; ^ /havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:160:17: error: use of undeclared identifier 'SIGPROF' if (sigaction(SIGPROF, &act, 0)) { ^ 2 errors generated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01Revert "[ubsan] lit changes for lld testing, future lto testing."Roman Lebedev
This reverts commit r319525. This change has introduced a problem with the Lit tests build for compiler-rt using Gold: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/6047/steps/test%20standalone%20compiler-rt/logs/stdio llvm-lit: /b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg', traceback: Traceback (most recent call last): File "/b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path exec(compile(data, path, 'exec'), cfg_globals, None) File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 37, in <module> if root.host_os not in ['Linux'] or not is_gold_linker_available(): File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 27, in is_gold_linker_available stderr = subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[ubsan] lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[msan] Fix return type of mbrtowcVitaly Buka
Summary: Fixes https://github.com/google/oss-fuzz/issues/1009 Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40676 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319484 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Add powerpc64 to compiler-rt build infrastructure.Sterling Augustine
Now that we have disabled the run-forever tests, and cleaned up the intel 80-bit float based tests, we should be able to enable testing compiler-rt for powerpc64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319474 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Move x86-specific sources to x86-specific source lists.Sterling Augustine
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30[PGO] Add a test case for infinite loopsXinliang David Li
Differential Revision: http://reviews.llvm.org/D40663 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319463 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Fix the MIPS baremetal buildAlexander Richardson
Summary: Currently sys/cachectl.h is used unconditionally on MIPS although it is only available on Linux and will fail the build when targeting baremetal Reviewers: petarj Reviewed By: petarj Subscribers: sdardis, krytarowski Differential Revision: https://reviews.llvm.org/D40659 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319455 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-30Linux needs to include sys/uio.h for readv, preadvStephan Bergmann
...at least when building against glibc-2.26-16.fc27.x86_64 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319412 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternativeDean Michael Berris
Summary: In cases where we can't use the .preinit_array section (as in Darwin for example) we instead use dynamic initialisation. We know that this alternative approach will race with the initializers of other objects at global scope, but this is strictly better than nothing. Reviewers: kubamracek, nglevin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40599 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319366 91177308-0d34-0410-b5e6-96231b3b80d8
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-11-29[scudo] Allow for compile-time choice of the SizeClassMapKostya Kortchinsky
Summary: With this change, we allow someone to chose the `SizeClassMap` they want to use at compile time via a define. I feel somewhat unimaginative with the name of the defines, so if someone has a better idea, let me know. I have been alternating between those and `SCUDO_USE_xxx_SIZECLASSMAP` which is clearer but also longer. The issue with those is that it wouldn't be consistent with `SCUDO_TSD_EXCLUSIVE` that should probably become `SCUDO_USE_EXCLUSIVE_TSD` maybe? Anyway, naming is hard, and I am not sure what makes more sense! Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D40521 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[compiler-rt] Switch from deprecated TARGET_IPHONE_SIMULATOR to ↵Kuba Mracek
TARGET_OS_SIMULATOR Differential Revision: https://reviews.llvm.org/D39987 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319349 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[asan] Fix macOS FindDynamicShadowStart to consider the last gap in the VM mapKuba Mracek
It looks FindDynamicShadowStart has a bug: When iterating over the memory map, we will not consider the very last gap in the address space. Let's fix that. Differential Revision: https://reviews.llvm.org/D39989 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319348 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[asan] Don't crash on fclose(NULL)Kuba Mracek
It's explicitly forbidden to call fclose with NULL, but at least on Darwin, this succeeds and doesn't segfault. To maintain binary compatibility, ASan should survice fclose(NULL) as well. Differential Revision: https://reviews.llvm.org/D40053 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[asan] Allow getpwnam(NULL) for binary compatibilityKuba Mracek
Calling getpwnam(NULL) is probably a bug, but at least on Darwin, such a call succeeds without segfaulting. I have some existing code that relies on that. To maintain binary compatibility, ASan should also survive a call to getpwnam with NULL. Differential Revision: https://reviews.llvm.org/D40052 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319344 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[sanitizer] Refactor how assembly files are handledKuba Mracek
This renames ASM_TSAN_SYMBOL and ASM_TSAN_SYMBOL_INTERCEPTOR to just ASM_SYMBOL and ASM_SYMBOL_INTERCEPTOR, because they can be useful in more places than just TSan. Also introduce a CMake function to add ASM sources to a target. Differential Revision: https://reviews.llvm.org/D40143 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319339 91177308-0d34-0410-b5e6-96231b3b80d8