[compiler-rt] [scudo] Move the chunk update into functions (PR #83493)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 15:52:05 PDT 2024
================
@@ -1162,31 +1219,23 @@ class Allocator {
Header->State = Chunk::State::Available;
else
Header->State = Chunk::State::Quarantined;
- Header->OriginOrWasZeroed = useMemoryTagging<Config>(Options) &&
- Header->ClassId &&
- !TSDRegistry.getDisableMemInit();
- Chunk::storeHeader(Cookie, Ptr, Header);
- if (UNLIKELY(useMemoryTagging<Config>(Options))) {
- u8 PrevTag = extractTag(reinterpret_cast<uptr>(TaggedPtr));
- storeDeallocationStackMaybe(Options, Ptr, PrevTag, Size);
- if (Header->ClassId) {
- if (!TSDRegistry.getDisableMemInit()) {
- uptr TaggedBegin, TaggedEnd;
- const uptr OddEvenMask = computeOddEvenMaskForPointerMaybe(
- Options, reinterpret_cast<uptr>(getBlockBegin(Ptr, Header)),
- Header->ClassId);
- // Exclude the previous tag so that immediate use after free is
- // detected 100% of the time.
- setRandomTag(Ptr, Size, OddEvenMask | (1UL << PrevTag), &TaggedBegin,
- &TaggedEnd);
- }
- }
+ void *BlockBegin;
----------------
ChiaHungDuan wrote:
My question is, it seems that we have the different logic here. If `BypassQuarantine == true` && `allocatorSupportsMemoryTagging<Config>() == false`, it doesn't untag the pointer (the case of `BypassQuarantine == false` was trying to mention the same thing).
Maybe it's something we can simplify but I would like to make it as close to the same logic as possible.
https://github.com/llvm/llvm-project/pull/83493
More information about the llvm-commits
mailing list