[PATCH] D87739: [WIP] scudo: Add an API for disabling memory initialization per-thread.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 11:51:47 PDT 2020


pcc added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:496
     if (Options.DeallocTypeMismatch) {
-      if (Header.Origin != Origin) {
+      if (Header.OriginOrWasZeroed != Origin) {
         // With the exception of memalign'd chunks, that can be still be free'd.
----------------
hctim wrote:
> Isn't this now broken under `dealloc_type_mismatch` and MTE?
No, because the field is intended to only have the "was zeroed" meaning while the chunk is not allocated. Note that the field is read before the call to `quarantineOrDeallocateChunk` later in this function causes it to take the "was zeroed" meaning.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:554
     if (Options.DeallocTypeMismatch) {
-      if (UNLIKELY(OldHeader.Origin != Chunk::Origin::Malloc))
+      if (UNLIKELY(OldHeader.OriginOrWasZeroed != Chunk::Origin::Malloc))
         reportDeallocTypeMismatch(AllocatorAction::Reallocating, OldPtr,
----------------
hctim wrote:
> same here, broken under dealloc_type_mismatch when memory is zeroed?
This is before the call to `quarantineOrDeallocateChunk`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87739/new/

https://reviews.llvm.org/D87739



More information about the llvm-commits mailing list