[PATCH] D43949: [scudo] Secondary allocator overhaul to support Windows

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 08:07:14 PST 2018


cryptoad added inline comments.


================
Comment at: lib/scudo/scudo_allocator_secondary.h:108
     const uptr Ptr = UserBeg - Chunk::getHeaderSize();
-    ReservedAddressRange *StoredRange = getReservedAddressRange(Ptr);
-    *StoredRange = AddressRange;
+    LargeChunkHeader *H = LargeChunk::getHeader(Ptr);
+    H->StoredRange = AddressRange;
----------------
alekseyshl wrote:
> This is definitely confusing. One getHeader() expects user mem ptr, another expects chunk header ptr. Not sure what's the best way to improve it yet.
Initially I was going to add a comment with some chunk layout, eg:
```+------------------+
| Guard page(s)    |
+------------------+
| Unused space*    |
+------------------+
| LargeChunkHeader |
+------------------+
| PackedHeader     |
+------------------+
| Data             |
+------------------+
| Unused space**   |
+------------------+
| Guard page(s)    |
+------------------+```
The frontend deals with the {Unp,P}ackedHeader, and the Secondary being part of the Backend deals with the LargeChunkHeader.
While I agree that the distinction can be tenuous to make, it makes sense to me that the 2 `getHeader` work on different pointers.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D43949





More information about the llvm-commits mailing list