[PATCH] D72108: [TSan] Initialize injected mach threads
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 14:00:20 PST 2020
yln created this revision.
Herald added subscribers: llvm-commits, Sanitizers, jfb.
Herald added projects: Sanitizers, LLVM.
Previously, TSan was crashing on the first call to malloc from an
injected mach thread. Such threads are created via the
`thread_create_running` and then turned into a pthread via the
`pthread_create_from_mach_thread` SPI.
The reason for this is that TSan needs to do some initialization to
avoid crashing later inside interceptors. We identify a mach thread by
checking whether we have seen this thread before on "thread_start". All
other threads will be known (`ThreadTid` returns a valid thread
identifier); only mach threads, which don't receive the "thread_create"
event, haven't been registered with TSan yet.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72108
Files:
compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h
compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
compiler-rt/lib/tsan/rtl/tsan_report.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72108.235945.patch
Type: text/x-patch
Size: 5022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200102/1b867e0e/attachment.bin>
More information about the llvm-commits
mailing list