[tsan] Fix crash in objc_sync_enter/objc_sync_exit when using an Obj-C tagged pointer
authorKuba Mracek <mracek@apple.com>
Tue, 24 Jul 2018 16:19:06 +0000 (16:19 +0000)
committerKuba Mracek <mracek@apple.com>
Tue, 24 Jul 2018 16:19:06 +0000 (16:19 +0000)
commitdc36389ea8adbcc60db3055ed9999937a0b5b601
tree13110a86c2a8115826fcae4da5024bcc40d87e1b
parent634f851766eeead719dbf971b8d449921f3a0bdb
[tsan] Fix crash in objc_sync_enter/objc_sync_exit when using an Obj-C tagged pointer

Objective-C tagged pointers (either bottom-most or top-most bit is 1) are valid Obj-C objects but are not valid pointers. Make sure we don't crash on them when used in objc_sync_enter/objc_sync_exit. Instead, let's synchronize on a global object.

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

llvm-svn: 337837
compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cc
compiler-rt/test/tsan/Darwin/objc-synchronize-tagged.mm [new file with mode: 0644]