[PATCH] D41200: [scudo] Refactor ScudoChunk

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 13:30:53 PST 2017


cryptoad created this revision.
cryptoad added reviewers: alekseyshl, flowerhack.
Herald added a subscriber: Sanitizers.

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`).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D41200

Files:
  lib/scudo/scudo_allocator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41200.126828.patch
Type: text/x-patch
Size: 21148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171213/54afc2f3/attachment.bin>


More information about the llvm-commits mailing list