[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 15:13:51 PDT 2020


eugenis accepted this revision.
eugenis added a comment.
This revision is now accepted and ready to land.

LGTM



================
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
----------------
pcc wrote:
> eugenis wrote:
> > 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.
> I think it would be fine to allow setting it to `PatternOrZeroFill` to go through without warning. As the name implies, it would be valid to implement it using zero init.
Yes, good point.


================
Comment at: compiler-rt/lib/scudo/standalone/tests/combined_test.cpp:535
+      continue;
+    for (unsigned I = 0; I != 65536; ++I) {
+      Ptrs[I] = Allocator->allocate(Size, Origin);
----------------
make it a named constant, or use Ptrs.size()


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