[TSan] Support Objective-C @synchronized with tagged pointers
authorJulian Lettner <jlettner@apple.com>
Mon, 7 Jan 2019 19:19:23 +0000 (19:19 +0000)
committerJulian Lettner <jlettner@apple.com>
Mon, 7 Jan 2019 19:19:23 +0000 (19:19 +0000)
commita6d29024edb02516728fe8c2983841e1fb66e993
treee6388494612f7e6d0d609d526964b07743951821
parente34f2bb807b2de98a60134a22ff26c9d39ff4859
[TSan] Support Objective-C @synchronized with tagged pointers

Summary:
Objective-C employs tagged pointers, that is, small objects/values may be encoded directly in the pointer bits. The resulting pointer is not backed by an allocation/does not point to a valid memory. TSan infrastructure requires a valid address for `Acquire/Release` and `Mutex{Lock/Unlock}`.
This patch establishes such a mapping via a "dummy allocation" for each encountered tagged pointer value.

Reviewers: dcoughlin, kubamracek, dvyukov, delcypher

Reviewed By: dvyukov

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D56238

llvm-svn: 350556
compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cc
compiler-rt/test/tsan/Darwin/objc-synchronize-cycle-tagged.mm