Loading...
--- libmalloc/libmalloc-715.140.5/tests/malloc_realloc_large.c
+++ libmalloc/libmalloc-521.120.7/tests/malloc_realloc_large.c
@@ -39,8 +39,7 @@
}
T_DECL(realloc_large_huge, "call realloc on LARGE and HUGE allocations",
- T_META_TAG_XZONE_ONLY,
- T_META_TAG_VM_NOT_ELIGIBLE)
+ T_META_TAG_XZONE_ONLY)
{
// Large allocation shrink in place
size_t size1 = LARGE_BLOCK_SIZE_MAX;
@@ -50,14 +49,7 @@
void *ptr2 = realloc(ptr1, size2);
T_ASSERT_TRUE(memchk(ptr2, 'A', size2), "contents unchanged after realloc");
T_ASSERT_LE(size2, malloc_size(ptr2), "realloc LARGE smaller");
-
- bool has_sanitizer = false;
-#if CONFIG_SANITIZER
- has_sanitizer = malloc_sanitizer_is_enabled();
-#endif
- if (!has_sanitizer) {
- T_ASSERT_EQ(ptr1, ptr2, "realloc LARGE smaller in-place");
- }
+ T_ASSERT_EQ(ptr1, ptr2, "realloc LARGE smaller in-place");
free(ptr2);
// Large allocation grow in place
@@ -81,12 +73,7 @@
T_ASSERT_TRUE(memchk(ptr2, 'C', size2), "contents unchanged after realloc");
T_ASSERT_LE(size2, malloc_size(ptr2),
"realloc HUGE smaller");
-
-#if MALLOC_TARGET_EXCLAVES
- T_LOG("exclaves don't support resizing mappings, skipping realloc in-place");
-#else
T_ASSERT_EQ(ptr1, ptr2, "realloc HUGE smaller in-place");
-#endif // !MALLOC_TARGET_EXCLAVES
free(ptr2);
// Huge allocation grow in place
@@ -124,6 +111,7 @@
T_ASSERT_TRUE(memchk(ptr2, 'E', size2), "contents unchanged after realloc");
T_ASSERT_LE(size2, malloc_size(ptr2),
"realloc LARGE aligned");
+ T_ASSERT_NE(ptr1, ptr2, "realloc aligned allocation not in-place");
free(ptr2);
// Large allocation to huge reallocation
@@ -162,7 +150,6 @@
free(ptr2);
}
-
T_DECL(realloc_overlap_mmap,
"Make sure that realloc in place doesn't overwrite existing mmap",
T_META_TAG_XZONE_ONLY)
@@ -173,17 +160,6 @@
// mmap some anonymous memory just past the end of that allocation
void *map_addr = (void*)((uintptr_t)ptr + LARGE_BLOCK_SIZE_MAX * 3);
-#if MALLOC_TARGET_EXCLAVES
- plat_map_t plat_map = { 0 };
- _liblibc_map_type_t type = LIBLIBC_MAP_TYPE_PRIVATE |
- LIBLIBC_MAP_TYPE_FIXED | LIBLIBC_MAP_TYPE_NORAND;
- // liblibc errors if you try to mmap with PROT_NONE
- void *map = mmap_plat(&plat_map, (uintptr_t)map_addr, LARGE_BLOCK_SIZE_MAX,
- PROT_READ, type, 0, 0);
- if (map == NULL) {
- T_SKIP("VM isn't setup to mmap after the huge allocation");
- }
-#else // MALLOC_TARGET_EXCLAVES
void *map = mmap(map_addr, LARGE_BLOCK_SIZE_MAX, PROT_NONE, MAP_ANON | MAP_PRIVATE, 0, 0);
if (map == MAP_FAILED || map != map_addr) {
// Couldn't map memory just past the end of the huge allocation, due to
@@ -195,7 +171,6 @@
// test if we get really unlucky here.
T_SKIP("VM isn't setup to mmap after the huge allocation");
}
-#endif // MALLOC_TARGET_EXCLAVES
T_ASSERT_EQ(map_addr, map, "mmap'd at expected address");
@@ -205,10 +180,5 @@
T_ASSERT_NE(ptr2, ptr, "realloc overwrote existing mmap");
memset(ptr2, 0xaa, LARGE_BLOCK_SIZE_MAX * 4);
free(ptr2);
-
-#if MALLOC_TARGET_EXCLAVES
- munmap_plat(&plat_map, map, LARGE_BLOCK_SIZE_MAX);
-#else
munmap(map, LARGE_BLOCK_SIZE_MAX);
-#endif // MALLOC_TARGET_EXCLAVES
}