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

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 14:19:01 PDT 2019


hctim 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);
----------------
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?


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