This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Store the pointer to ThreadState in TLS slot on Android.
ClosedPublic

Authored by yabinc on Dec 7 2015, 12:47 PM.

Details

Summary
  1. Android doesn't support __thread keyword. So allocate ThreadState

dynamically and store its pointer in one TLS slot provided by Android.

  1. On Android, intercepted functions can be called before ThreadState

is initialized. So add test of thr_->is_inited in some places.

  1. On Android, intercepted functions can be called after ThreadState

is destroyed. So add a fake dead_thread_state to represent all
destroyed ThreadStates. And that is also why we don't store the pointer
to ThreadState in shadow memory of pthread_self().

Diff Detail

Event Timeline

yabinc updated this revision to Diff 42095.Dec 7 2015, 12:47 PM
yabinc retitled this revision from to [tsan] Store the pointer to ThreadState in TLS slot on Android..
yabinc updated this object.
yabinc added a subscriber: llvm-commits.
dvyukov accepted this revision.Dec 18 2015, 2:18 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Dec 18 2015, 2:18 AM
yabinc closed this revision.Jan 14 2016, 7:42 PM