summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_mutex.h
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Pacify sanitizer lint script that still does not run on WindowsReid Kleckner2018-07-311-1/+1
| | | | llvm-svn: 338334
* [asan/win] Use SRW locks to fix a race in BlockingMutexReid Kleckner2018-07-301-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before my change, BlockingMutex used Windows critial sections. Critical sections can only be initialized by calling InitializeCriticalSection, dynamically. The primary sanitizer allocator expects to be able to reinterpret zero initialized memory as a BlockingMutex and immediately lock it. RegionInfo contains a mutex, and it placement new is never called for it. These objects are accessed via: RegionInfo *GetRegionInfo(uptr class_id) const { DCHECK_LT(class_id, kNumClasses); RegionInfo *regions = reinterpret_cast<RegionInfo *>(SpaceEnd()); return &regions[class_id]; } The memory comes from the OS without any other initialization. For various reasons described in the comments, BlockingMutex::Lock would check if the object appeared to be zero-initialized, and it would lazily call the LinkerInitialized constructor to initialize the critical section. This pattern is obviously racy, and the code had a bunch of FIXMEs about it. The best fix here is to use slim reader writer locks, which can start out zero-initialized. They are available starting in Windows Vista. I think it's safe to go ahead and use them today. Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D49893 llvm-svn: 338331
* [Sanitizers] Basic sanitizer Solaris support (PR 33274)Kamil Rytarowski2017-12-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first mostly working version of the Sanitizer port to 32-bit Solaris/x86. It is currently based on Solaris 11.4 Beta. This part was initially developed inside libsanitizer in the GCC tree and should apply to both. Subsequent parts will address changes to clang, the compiler-rt build system and testsuite. I'm not yet sure what the right patch granularity is: if it's profitable to split the patch up, I'd like to get guidance on how to do so. Most of the changes are probably straightforward with a few exceptions: * The Solaris syscall interface isn't stable, undocumented and can change within an OS release. The stable interface is the libc interface, which I'm using here, if possible using the internal _-prefixed names. * While the patch primarily target 32-bit x86, I've left a few sparc changes in. They cannot currently be used with clang due to a backend limitation, but have worked fine inside the gcc tree. * Some functions (e.g. largefile versions of functions like open64) only exist in 32-bit Solaris, so I've introduced a separate SANITIZER_SOLARIS32 to check for that. The patch (with the subsequent ones to be submitted shortly) was tested on i386-pc-solaris2.11. Only a few failures remain, some of them analyzed, some still TBD: AddressSanitizer-i386-sunos :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos :: TestCases/malloc-no-intercept.c AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/concurrent_overflow.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/start-deactivated.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/default_options.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/log-path_test.cc AddressSanitizer-i386-sunos-dynamic :: TestCases/malloc-no-intercept.c SanitizerCommon-Unit :: ./Sanitizer-i386-Test/MemoryMappingLayout.DumpListOfModules SanitizerCommon-Unit :: ./Sanitizer-i386-Test/SanitizerCommon.PthreadDestructorIterations Maybe this is good enough the get the ball rolling. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, jyknight, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40898 llvm-svn: 320740
* Remove strict tid checks from the mac implementation of BlockingMutexFrancis Ricci2017-02-091-0/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch unifies the behavior of BlockingMutex on linux and mac, resolving problems that can arise when BlockingMutex is used in code shared by the two platforms but has different behavior depending on the platform. No longer requires that the calling thread own the mutex for CheckLocked calls to pass. Reviewers: dvyukov, kubamracek Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29728 llvm-svn: 294614
* [Sanitizer] Make BlockingMutex really linker initialized.Yury Gribov2015-01-301-0/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D7171 llvm-svn: 227560
* tsan: better addr->object hashmapDmitry Vyukov2014-03-181-0/+84
| | | | | | still experimental llvm-svn: 204126
* tsan: weaken concurrency guarantees in deadlock detector mutex hashmapDmitry Vyukov2014-03-061-84/+0
| | | | | | read locking on every access is too expensive llvm-svn: 203112
* tsan: fix windows buildDmitry Vyukov2014-03-041-7/+7
| | | | llvm-svn: 202831
* tsan: add concurrent hashmap for standalone deadlock detectorDmitry Vyukov2014-03-041-0/+84
| | | | llvm-svn: 202826
* Rename SpinMutex::AssertHeld to CheckLocked, for consistency with BlockingMutex.Peter Collingbourne2013-10-251-1/+1
| | | | llvm-svn: 193447
* [asan] Fix a deadlock between asan's allocator and lsanKostya Serebryany2013-10-171-0/+4
| | | | | | | | | | | | | | | | Summary: This fixes a deadlock which happens in lsan on a large memalign-allocated chunk that resides in lsan's root set. Reviewers: samsonov, earthdok Reviewed By: earthdok CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1957 llvm-svn: 192885
* [Sanitizer] Add default constructor for BlockingMutexAlexey Samsonov2013-03-141-0/+1
| | | | llvm-svn: 177072
* [Sanitizer] Implement BlockingMutex::CheckLocked()Alexey Samsonov2013-03-111-0/+1
| | | | llvm-svn: 176805
* asan: fix compilation errors in mutexDmitry Vyukov2013-01-141-0/+1
| | | | llvm-svn: 172385
* asan/tsan: move blocking mutex from asan to sanitizer_commonDmitry Vyukov2013-01-141-0/+10
| | | | llvm-svn: 172380
* asan: faster quarantineDmitry Vyukov2013-01-111-1/+5
| | | | llvm-svn: 172192
* asan/tsan: first version of "stack depot"Dmitry Vyukov2012-08-301-3/+11
| | | | llvm-svn: 162897
* asan/tsan: improve SpinMutexDmitry Vyukov2012-07-021-3/+17
| | | | llvm-svn: 159518
* tsan/asan: add mutex to 64-bit allocatorDmitry Vyukov2012-07-021-0/+2
| | | | llvm-svn: 159516
* tsan/asan: add SpinMutex to sanitizer_commonDmitry Vyukov2012-06-291-0/+26
| | | | llvm-svn: 159439
* tsan/asan: unify ScopedLockDmitry Vyukov2012-06-291-0/+58
llvm-svn: 159438
OpenPOWER on IntegriCloud