This is an archive of the discontinued LLVM Phabricator instance.

[TSan] Initialize injected mach threads
AbandonedPublic

Authored by yln on Jan 2 2020, 1:56 PM.

Details

Reviewers
None
Summary

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.

Event Timeline

yln created this revision.Jan 2 2020, 1:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 2 2020, 1:56 PM
Herald added subscribers: llvm-commits, Restricted Project, jfb. · View Herald Transcript
yln abandoned this revision.Jan 10 2020, 6:16 PM

Superseded by D72549.