[compiler-rt] [scudo] [MTE] resize stack depot for allocation ring buffer (PR #74515)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 23:21:35 PST 2024


================
@@ -1526,6 +1573,10 @@ class Allocator {
                              RawRingBufferMap.getCapacity());
     }
     RawRingBuffer = nullptr;
+    if (RawStackDepot) {
+      RawStackDepotMap.unmap(RawStackDepotMap.getBase(),
+                             RawStackDepotMap.getCapacity());
+    }
----------------
fmayer wrote:

> As above, what does this mean? I don't see how this affects object bounds. To be fair, this code is incredibly hard to follow because of the way you are slicing memory and doing the casting and checking.

That's why I would suggest not allocating one big piece, but allocating separate pieces for each individual item. If you are worried about wasting memory, how much memory do you think you would waste? I think maybe it would get you an extra page or two at most. It would make the code easier to follow.

This isn't going to work. This is read by an external process here: https://cs.android.com/android/platform/superproject/main/+/main:system/core/debuggerd/libdebuggerd/scudo.cpp;l=47;drc=cdf55585a788d5b7ad4e4804046549c54d5c1791. This is why this has to be a single contiguous allocation.

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


More information about the llvm-commits mailing list