This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Scudo thread specific data refactor, part 2
ClosedPublic

Authored by cryptoad on Sep 22 2017, 9:50 AM.

Details

Summary

Following D38139, we now consolidate the TSD definition, merging the shared
TSD definition with the exclusive TSD definition. We introduce a boolean set
at initializaton denoting the need for the TSD to be unlocked or not. This
adds some unused members to the exclusive TSD, but increases consistency and
reduces the definitions fragmentation.

We remove the fallback mechanism from scudo_allocator.cpp and add a fallback
TSD in the non-shared version. Since the shared version doesn't require one,
this makes overall more sense.

There are a couple of additional cosmetic changes: removing the header guards
from the remaining .inc files, added error string to a CHECK.

Question to reviewers: I thought about friending getTSDAndLock in ScudoTSD
so that the FallbackTSD could Mutex.Lock() directly instead of lock()
which involved zeroing out the Precedence, which is unused otherwise. Is it
worth doing?

lib/scudo/scudo_tls_android.inc