[PATCH] D66231: [scudo][standalone] Fix malloc_iterate

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 14:36:32 PDT 2019


cryptoad added inline comments.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:266
+  std::vector<void *> V;
+  while (V.size() < 512U) {
+    void *P = malloc(SpecialSize);
----------------
hctim wrote:
> cryptoad wrote:
> > hctim wrote:
> > > From what I see, it looks like the goal of this loop is to (hopefully) get a page-aligned allocation. All the other allocations seem to not be important.
> > > 
> > > Could this test be simplified by guaranteeing a page-aligned pointer through `pvalloc()`? 
> > Unfortunately the `Block` (backend) has to be aligned on a boundary (page is my choice, but it could be anything that matches the iteration), `pvaloc` would guarantee that the `Chunk` (frontend) is aligned. Hence the gymnastics with the delta.
> I see. Is there any way to guarantee that a `Block` is page-aligned without trial-and-error? If we set `SpecialSize = PageSize - BlockDelta`, would this guarantee this?
This is indeed the case if we have a class size of `PageSize`, then all allocations of `PageSize - BlockDelta` would end up in it.
It's the case for the default one, I can go with it, and if the `SizeClassMap` ever changes, add a bailing condition.


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D66231





More information about the llvm-commits mailing list