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

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 12:42:43 PDT 2020


eugenis added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:410
           resizeTaggedChunk(PrevEnd, TaggedUserPtr + Size, BlockEnd);
-          if (Size) {
+          if (UNLIKELY(FillContents != NoFill && !Header.OriginOrWasZeroed)) {
+            // If an allocation needs to be zeroed (i.e. calloc) we can normally
----------------
This implies that MTE mode does not support pattern init - and it's also clear from the rest of the code. Should we have setFillContents do something about that? It does not have a return value, but it could complain in stderr (not sure it's a good idea) or fall back to zero-init.


================
Comment at: compiler-rt/lib/scudo/standalone/combined.h:426
               computeOddEvenMaskForPointerMaybe(BlockUptr, BlockSize);
           TaggedPtr = prepareTaggedChunk(Ptr, Size, OddEvenMask, BlockEnd);
         }
----------------
pcc wrote:
> eugenis wrote:
> > Rename setRandomTag to setRandomTagAndZeroData ?
> Does that really need to be in the name of the function or would a comment be enough? I think most of the functions in memtag.h end up zeroing parts of the memory that they touch.
Thanks. Does not have to be in the function name - it's just was something that made me go and look at the implementation.


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