From 34b00f896966e3993b8570542dfe77c2002ce185 Mon Sep 17 00:00:00 2001 From: Alex Lapenkou Date: Fri, 22 Oct 2021 17:23:09 -0700 Subject: [PATCH] San: Avoid running san tests with prof enabled With prof enabled, number of page aligned allocations doesn't match the number of slab "ends" because prof allocations skew the addresses. It leads to 'pages' array overflow and hard to debug failures. --- test/unit/san.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/san.c b/test/unit/san.c index 1baa26e9..93e292f6 100644 --- a/test/unit/san.c +++ b/test/unit/san.c @@ -14,6 +14,8 @@ verify_extent_guarded(tsdn_t *tsdn, void *ptr) { void *small_alloc[MAX_SMALL_ALLOCATIONS]; TEST_BEGIN(test_guarded_small) { + test_skip_if(opt_prof); + tsdn_t *tsdn = tsd_tsdn(tsd_fetch()); unsigned npages = 16, pages_found = 0, ends_found = 0; VARIABLE_ARRAY(uintptr_t, pages, npages); @@ -27,6 +29,8 @@ TEST_BEGIN(test_guarded_small) { small_alloc[n_alloc] = ptr; verify_extent_guarded(tsdn, ptr); if ((uintptr_t)ptr % PAGE == 0) { + assert_u_lt(pages_found, npages, + "Unexpectedly large number of page aligned allocs"); pages[pages_found++] = (uintptr_t)ptr; } if (((uintptr_t)ptr + (uintptr_t)sz) % PAGE == 0) {