[PATCH] D70762: scudo: Add initial memory tagging support.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 10:10:59 PST 2019


hctim added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/allocator_config.h:43
   // 1GB regions
-  typedef SizeClassAllocator64<SizeClassMap, 30U> Primary;
+  typedef SizeClassAllocator64<SizeClassMap, 30U, true> Primary;
 #else
----------------
Maybe:
`typedef SizeClassAllocator64<SizeClassMap, 30U, /*MaySupportMemoryTagging=*/ true> Primary;`?


================
Comment at: compiler-rt/lib/scudo/standalone/memtag.h:97
+  // purpose of catching linear overflows in this case.
+  uptr UntaggedEnd = untagPointer(TaggedEnd);
+  if (UntaggedEnd != BlockEnd)
----------------
`Size % 16 == 0` always here, so this could just be `UntaggedEnd = Ptr + Size`?


================
Comment at: compiler-rt/lib/scudo/standalone/memtag.h:108
+  if (RoundOldPtr >= NewPtr) {
+    // If the allocation is shrinking we just need to set the tag past the end
+    // of the allocation to 0. See explanation in prepareTaggedChunk above.
----------------
13.8% of chromium fuzzing-found heap OOB are > 16 bytes stride. Given that this is primary-only, the cost  of  retagging the `OldChunk - NewChunk` might be an acceptable performance penalty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70762





More information about the llvm-commits mailing list