This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Refactor ScudoChunk
ClosedPublic

Authored by cryptoad on Dec 13 2017, 1:30 PM.

Details

Summary

The initial implementation used an ASan like Chunk class that was deriving from
a Header class. Due to potential races, we ended up working with local copies
of the Header and never using the parent class fields. ScudoChunk was never
constructed but cast, and we were using this as the pointer needed for our
computations. This was meh.

So we refactored ScudoChunk to be now a series of static functions within the
namespace __scudo::Chunk that take a "user" pointer as first parameter (former
this). A compiled binary doesn't really change, but the code is more sensible.

Clang tends to inline all those small function (in -O2), but GCC left a few not
inlined, so we add the INLINE keyword to all.

Since we don't have ScudoChunk pointers anymore, a few variables were renamed
here and there to introduce a clearer distinction between a user pointer
(usually Ptr) and a backend pointer (BackendPtr).

Diff Detail

Event Timeline

cryptoad created this revision.Dec 13 2017, 1:30 PM
Herald added a subscriber: Restricted Project. · View Herald TranscriptDec 13 2017, 1:30 PM
alekseyshl accepted this revision.Dec 14 2017, 11:44 AM
This revision is now accepted and ready to land.Dec 14 2017, 11:44 AM
This revision was automatically updated to reflect the committed changes.