[compiler-rt] [scudo] Split the code paths which enable memory tagging (PR #83493)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 20:23:38 PDT 2024


================
@@ -1213,6 +1255,38 @@ class Allocator {
     }
   }
 
+  NOINLINE void *unTagBlock(const Options &Options, void *TaggedPtr,
+                            void *HeaderTaggedPtr,
+                            Chunk::UnpackedHeader *Header, const uptr Size,
+                            bool BypassQuarantine) {
+    DCHECK(useMemoryTagging<Config>(Options));
+    void *Ptr = HeaderTaggedPtr;
+
+    const u8 PrevTag = extractTag(reinterpret_cast<uptr>(TaggedPtr));
+    storeDeallocationStackMaybe(Options, Ptr, PrevTag, Size);
+    if (Header->ClassId) {
+      if (!TSDRegistry.getDisableMemInit()) {
----------------
cferris1000 wrote:

I know that the original code does this, but it would be better to have a single if instead of the two ifs since neither if has an else.

https://github.com/llvm/llvm-project/pull/83493


More information about the llvm-commits mailing list