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

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 11:28:53 PDT 2019


cryptoad added inline comments.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:260
+// Verify that a block located on an iteration boundary is not mis-accounted.
+TEST(ScudoWrappersCTest, MallocIterateBoundary) {
+  const size_t BlockDelta = FIRST_32_SECOND_64(8U, 16U);
----------------
hctim wrote:
> `BoundaryP` and `Counter` should be zeroed in the initialisation sequence for this test to make it end-to-end.
Ack.


================
Comment at: lib/scudo/standalone/tests/wrappers_c_test.cpp:265
+
+  std::vector<void *> V;
+  while (V.size() < 512U) {
----------------
hctim wrote:
> Nit: `std::vector<std::unique_ptr>`? to avoid manual cleanup later.
Ack.


================
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:
> 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.


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