summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-28[CMake] Updating Apple CMake cache fileChris Bieneman
Changing the Apple CMake cache file to better match the way Apple Clang builds are built. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267913 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28[CMake] Adding some missing CMake includes. NFC.Chris Bieneman
This happens to be working now because the includes exist in another CMake file that is included before this one. That will change with upcoming refactoring. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267912 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28[test/asan] Update a test case to work with old Darwin SDK'sVedant Kumar
On Darwin, MAP_ANONYMOUS is a synonym for MAP_ANON. However, some SDK's don't define MAP_ANONYMOUS. Use MAP_ANON to work around this. (As a point of interest, the situation is exactly reversed on Linux.) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28Update visibility flags for CFI tests.Peter Collingbourne
Differential Revision: http://reviews.llvm.org/D18813 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28[tsan] Fix Darwin GCD support after separation of Processor and ThreadStateKuba Brecka
Recent TSan changes (r267678) which factor out parts of ThreadState into a Processor structure broke worker threads on OS X. This fixes it by properly calling ProcCreate for GCD worker threads and by replacing some CHECKs with RAW_CHECK in early process initialization. CHECK() in TSan calls the allocator, which requires a valid Processor. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267864 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[MSan] [PowerPC] Dereference function descriptors when recording stack origins.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19543 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizers] Get the proper symbol version when long double transition is ↵Marcin Koscielnicki
involved. On linux, some architectures had an ABI transition from 64-bit long double (ie. same as double) to 128-bit long double. On those, glibc symbols involving long doubles come in two versions, and we need to pass the correct one to dlvsym when intercepting them. A few more functions we intercept are also versioned (all printf, scanf, strtold variants), but there's no need to fix these, as the REAL() versions are never called. Differential Revision: http://reviews.llvm.org/D19555 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267794 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizer] Add early call handling to strchr + strrchr interceptorsDerek Bruening
Summary: The strchr and strrchr interceptors are sometimes invoked too early for their REAL() counterparts to be initialized. We have seen this in hooks invoked from tcmalloc on the dlsym() used in initializing interceptors. A special check is added to use internal_ routines for this situation. Reviewers: vitalybuka, aizatsky, filcab Subscribers: filcab, llvm-commits, eugenis, kcc, zhaoqin, aizatsky, kubabrecka Differential Revision: http://reviews.llvm.org/D19607 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267793 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizers] read/write page fault detection on mac.Mike Aizatsky
Summary: Resubmit of http://reviews.llvm.org/D19495 enabled only on intel. Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D19561 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267750 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143.Marcin Koscielnicki
In short, CVE-2016-2143 will crash the machine if a process uses both >4TB virtual addresses and fork(). ASan, TSan, and MSan will, by necessity, map a sizable chunk of virtual address space, which is much larger than 4TB. Even worse, sanitizers will always use fork() for llvm-symbolizer when a bug is detected. Disable all three by aborting on process initialization if the running kernel version is not known to contain a fix. Unfortunately, there's no reliable way to detect the fix without crashing the kernel. So, we rely on whitelisting - I've included a list of upstream kernel versions that will work. In case someone uses a distribution kernel or applied the fix themselves, an override switch is also included. Differential Revision: http://reviews.llvm.org/D19576 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27Un-XFAIL tests on Windows after fixing PR27492Reid Kleckner
Private symbols in PDBs do not have parameter types in their names so we have to drop the parens from the lambda call operator. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267735 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows supportDmitry Vyukov
UnmapOrDie used to do MEM_DECOMMIT and so worked on partial regions. But r263160 changed it to use MEM_RELEASE and MEM_RELEASE can only work with whole regions mapped by VirtualAlloc. This broke windows as: FATAL: ThreadSanitizer CHECK failed: gotsan.cc:8296 "((mbi.AllocationBase == addr && "Windows cannot unmap part of a previous mapping")) != (0)" (0x0, 0x0) Restore the previous behavior. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267730 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix darwin Go supportDmitry Vyukov
os_trace turns out to be a macro that creates static object. Function-static objects use __cxa_atexit and __dso_handle which are not present in Go runtime. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267720 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows Go supportDmitry Vyukov
Unmap can't unmap arbitrary regions on windows. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix darwin Go buildDmitry Vyukov
syslog_lock is not defined in Go build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267714 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: make windows shadow mapping a bijectionDmitry Vyukov
CheckShadowMapping function started catching that mem->shadow->mem mapping is not bijection. Make it bijection. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267713 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix build Dmitry Vyukov
error: implicit declaration of function 'abort' is invalid in C99 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267710 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix darwin Go buildDmitry Vyukov
Ifdef out global variables with destructors. This requires runtime support that is not provided by Go runtime (in particular _dso_handle symbol). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: change tsan/Go interface for obtaining the current ProcessorDmitry Vyukov
Current interface assumes that Go calls ProcWire/ProcUnwire to establish the association between thread and proc. With the wisdom of hindsight, this interface does not work very well. I had to sprinkle Go scheduler with wire/unwire calls, and any mistake leads to hard to debug crashes. This is not something one wants to maintian. Fortunately, there is a simpler solution. We can ask Go runtime as to what is the current Processor, and that question is very easy to answer on Go side. Switch to such interface. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267703 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows buildDmitry Vyukov
warning: '__sanitizer::uptr __sanitizer::GetPreferredBase(const char*)' defined but not used git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix windows buildDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267681 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: add missing fileDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267680 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: fix compiler warningDmitry Vyukov
tsan_debugging.cc: In function ‘void* __tsan_get_current_report()’: tsan_debugging.cc:61:18: warning: cast from type ‘const __tsan::ReportDesc*’ to type ‘void*’ casts away qualifiers [-Wcast-qual] return (void *)rep; git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267679 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27tsan: split thread into logical and physical stateDmitry Vyukov
This is reincarnation of http://reviews.llvm.org/D17648 with the bug fix pointed out by Adhemerval (zatrazz). Currently ThreadState holds both logical state (required for race-detection algorithm, user-visible) and physical state (various caches, most notably malloc cache). Move physical state in a new Process entity. Besides just being the right thing from abstraction point of view, this solves several problems: Cache everything on P level in Go. Currently we cache on a mix of goroutine and OS thread levels. This unnecessary increases memory consumption. Properly handle free operations in Go. Frees are issue by GC which don't have goroutine context. As the result we could not do anything more than just clearing shadow. For example, we leaked sync objects and heap block descriptors. This will allow to get rid of libc malloc in Go (now we have Processor context for internal allocator cache). This in turn will allow to get rid of dependency on libc entirely. Potentially we can make Processor per-CPU in C++ mode instead of per-thread, which will reduce resource consumption. The distinction between Thread and Processor is currently used only by Go, C++ creates Processor per OS thread, which is equivalent to the current scheme. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267678 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-27[Compiler-rt][CFI] Enabling CFI for MIPS64Mohit K. Bhakkad
Reviewers: eugenis Subscribers: jaydeep, sagar, Sanitizers Differential Revision: http://reviews.llvm.org/D19531 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267674 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizers] rewriting test assuming assert() changes coverage.Mike Aizatsky
Summary: On windows platform assert() call creates two distinct CFG edges which are coverage-instrumented. Simply calling assert would change coverage numbers on the platform. Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D19514 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizers] [NFC] Add defines for the various PowerPC ABIs.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App ↵Chris Bieneman
Store. This change modifies find_darwin_sdk_dir to set a variable if a Darwin "Internal" SDK is present which allows CMake to disable components that require internal-only APIs. This mechanism is then used to disable TSan when an internal SDK is not present. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267575 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizer] [SystemZ] Add ptrace support bits.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19134 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267548 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[sanitizer] [SystemZ] Implement internal_clone.Marcin Koscielnicki
Differential Revision: http://reviews.llvm.org/D19159 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26Revert "[sanitizers] read/write page fault detection on mac."Mehdi Amini
This reverts commit r267477. It broke our bots that enables the AArch64 backends, it seems that this code is using a Darwin *X86 specific* field. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25[MSan] Use COMMON_INTERCEPTOR_ENTER in libdl interceptors.Marcin Koscielnicki
This fixes fails in test/msan/dlerror.cc - when real dlerror calls strcmp, our strcmp interceptor now skips poison checking, since it's called in interceptor context. Strictly speaking, only the dlerror change is necessary to fix the fail, but let's also change the other two just in case. Differential Revision: http://reviews.llvm.org/D19499 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267486 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25[sanitizers] read/write page fault detection on mac.Mike Aizatsky
Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D19495 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267477 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25[esan] Fix uninitialized warning from interception contextDerek Bruening
The interception context is not used by esan, but the compiler complains about it being uninitialized all the same. We set it to null to avoid the warning. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23[esan] EfficiencySanitizer libc interceptorsDerek Bruening
Summary: Adds libc interceptors to the runtime library for the new EfficiencySanitizer ("esan") family of tools. The interceptors cover the memory operations in most common library calls and will be shared among all esan tools. Reviewers: aizatsky Subscribers: zhaoqin, tberghammer, danalbert, srhines, llvm-commits, vitalybuka, eugenis, kcc Differential Revision: http://reviews.llvm.org/D19411 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267293 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23[sanitizer] add a function MmapNoAccess that mmaps a protected region ↵Kostya Serebryany
*somewhere*; use MmapNoAccess in the Allocator when SpaceBeg is not a constant. In this mode the allocator will be a bit more hardened git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267256 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] rename MmapNoAccess to MmapFixedNoAccess; NFCKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] partially un-revert r267094: Allow the sanitizer allocator to ↵Kostya Serebryany
use a non-fixed address range. An allocator with a non-fixed address range will be attack-resistan. NFC for the sanitizers at this point. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] revert r267203 as it breaks aarch64 botsKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] allow zero first parameter in MmapNoAccess; This is a part of ↵Kostya Serebryany
r267094 that has been reverted git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22Revert "[LSAN] Fix test swapcontext.cc on MIPS"Renato Golin
This reverts commit r266716, as it breaks the self-hosting on Thumb2 buildbot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267158 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22Revert "[sanitizer] Allow the sanitizer allocator to use a non-fixed address ↵Renato Golin
range. An allocator with a non-fixed address range will be attack-resistan. NFC for the sanitizers at this point." This reverts commit r267094, because it broke a lot of MSAN tests in AArch64. Being NFC and all, this needs some deeper investigation before it goes in again. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[ASAN] Use struct instead of array in sancov.pySagar Thakur
Summary: When using 32-bit python with 64-bit asan the pc array in sancov.py cannot fit in 64-bit pc's because the type-code 'L' for arrays in python corresponds to the C type long which is only of 4 bytes. Because of this some of the coverage tool tests fail on mips. To fix these test possible solutions are to use 64-bit python or use struct.unpack with the 'Q' type-code. We have used struct.unpack with 'Q' type code since it is not appropriate to have a 64-bit python on all hosts. Reviewed by kcc, aizatsky Differential: http://reviews.llvm.org/D18817 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[sanitizer] Allow the sanitizer allocator to use a non-fixed address range. ↵Kostya Serebryany
An allocator with a non-fixed address range will be attack-resistan. NFC for the sanitizers at this point. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267094 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22[asan] Disable one test on windows.Evgeniy Stepanov
Patch by Vitaly Buka. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-22Enable stack-use-after-scope tests.Evgeniy Stepanov
Fix and enable working stack-use-after-scope tests. Add more failing tests for the feature, for fix later. PR27453. Patch by Vitaly Buka. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21[esan] EfficiencySanitizer base runtime libraryDerek Bruening
Summary: Adds the initial version of a runtime library for the new EfficiencySanitizer ("esan") family of tools. The library includes: + Slowpath code via callouts from the compiler instrumentation for each memory access. + Registration of atexit() to call finalization code. + Runtime option flags controlled by the environment variable ESAN_OPTIONS. The common sanitizer flags are supported such as verbosity and log_path. + An initial simple test. Still TODO: common code for libc interceptors and shadow memory mapping, and tool-specific code for shadow state updating. Reviewers: eugenis, vitalybuka, aizatsky, filcab Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc Differential Revision: http://reviews.llvm.org/D19168 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21[asan] Mark strdup test as unsupported on arm/linux.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267028 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21[tsan] Rename ReportThread->pid to ReportThread->os_idKuba Brecka
The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it. Differential Revision: http://reviews.llvm.org/D19365 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266994 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-21[sanitizer] Use pthread_threadid_np as thread ID on OS XKuba Brecka
Let's use pthread_threadid_np which returns a more reasonable ID than pthread_self (which is actually a stack pointer). The numbers from pthread_threadid_np are already used in other tools, e.g. in LLDB, and often appear in logs, so it's much more useful than pthread_self. Differential Revision: http://reviews.llvm.org/D18951 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266991 91177308-0d34-0410-b5e6-96231b3b80d8