This is an archive of the discontinued LLVM Phabricator instance.

Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)
ClosedPublic

Authored by rprichard on Dec 11 2018, 2:24 PM.

Details

Summary

The TLS_SLOT_TSAN slot is available starting in N, but its location (8)
is incompatible with the proposed solution for implementing ELF TLS on
Android (i.e. bump ARM/AArch64 alignment to reserve an 8-word TCB).

Instead, starting in Q, Bionic replaced TLS_SLOT_DLERROR(6) with
TLS_SLOT_SANITIZER(6). Switch compiler-rt to the new slot.

Event Timeline

rprichard created this revision.Dec 11 2018, 2:24 PM
Herald added subscribers: Restricted Project, llvm-commits, delcypher and 4 others. · View Herald TranscriptDec 11 2018, 2:24 PM
eugenis accepted this revision.Dec 11 2018, 3:22 PM

LGTM, thanks.

This revision is now accepted and ready to land.Dec 11 2018, 3:22 PM
eugenis requested changes to this revision.Dec 11 2018, 4:45 PM

Hmm, this is not enough, you also need to update instrumentation in HWAddressSanitizer::getHwasanThreadSlotPtr

This revision now requires changes to proceed.Dec 11 2018, 4:45 PM

I switched HWAddressSanitizer::getHwasanThreadSlotPtr over:
https://reviews.llvm.org/D55592

I searched for other references of thread_pointer and only found the (TLS_SLOT_SAFESTACK == 9) reference that presumably isn't in use. The CL adding TLS_SLOT_SAFESTACK to Bionic is still in progress (https://android-review.googlesource.com/c/platform/bionic/+/170988). If it's revived, it'll need to use a different slot value (probably negative on AArch64).

eugenis accepted this revision.Dec 12 2018, 2:00 PM

LGTM

This revision is now accepted and ready to land.Dec 12 2018, 2:00 PM

And of course, this broke the android O bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/17949

I'll try swapping the device with a current aosp master build.

Thanks for looking at the buildbot failure. Let me know if I need to revert my two commits.

I've reverted both commits.
The aosp build I've tried is broken in a different way.
I'll reapply the changes once the bot can handle them.