Loading...
tests/xzone_corruption.c libmalloc-792.80.2 libmalloc-521.120.7
--- libmalloc/libmalloc-792.80.2/tests/xzone_corruption.c
+++ libmalloc/libmalloc-521.120.7/tests/xzone_corruption.c
@@ -5,14 +5,14 @@
 
 #if CONFIG_XZONE_MALLOC
 
-T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true), T_META_TAG_VM_NOT_PREFERRED);
+T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
 
 // Ensure that all allocations get the same bucketing
 MALLOC_NOINLINE
 static void *
 malloc_wrapper(size_t n)
 {
-	return malloc_type_malloc(n, (malloc_type_id_t)42);
+	return malloc(n);
 }
 
 static bool
@@ -25,8 +25,11 @@
 	return chunk_a == chunk_b;
 }
 
-static void
-test_freelist_corruption(bool linkage)
+T_DECL(tiny_freelist_corruption, "Crash on corruption of tiny freelist",
+		T_META_ENVVAR("MallocXzoneSlotConfig=0"),
+		T_META_IGNORECRASHES("xzone_corruption"),
+		T_META_TAG_XZONE_ONLY,
+		T_META_ENABLED(__has_feature(ptrauth_calls)))
 {
 	pid_t child_pid = fork();
 	T_ASSERT_NE(child_pid, -1, "fork()");
@@ -62,11 +65,7 @@
 					free(p2);
 
 					xzm_block_t block = p2;
-					if (linkage) {
-						block->xzb_linkage.xzbl_next_value ^= (1ull << bit_to_flip);
-					} else {
-						block->xzb_cookie ^= (1ull << bit_to_flip);
-					}
+					block->xzb_linkage.xzbl_next_value ^= (1ull << bit_to_flip);
 
 					p2 = malloc_wrapper(1024);
 				}
@@ -88,30 +87,10 @@
 	}
 }
 
-T_DECL(tiny_freelist_cookie_corruption,
-		"Crash on corruption of tiny freelist cookie",
-		T_META_ENVVAR("MallocXzoneSlotConfig=0"),
-		T_META_IGNORECRASHES("xzone_corruption"),
-		T_META_TAG_XZONE_ONLY)
-{
-	test_freelist_corruption(false);
-}
-
-T_DECL(tiny_freelist_linkage_corruption,
-		"Crash on corruption of tiny freelist linkage",
-		T_META_ENVVAR("MallocXzoneSlotConfig=0"),
-		T_META_IGNORECRASHES("xzone_corruption"),
-		T_META_TAG_XZONE_ONLY,
-		T_META_ENABLED(__has_feature(ptrauth_calls)))
-{
-	test_freelist_corruption(true);
-}
-
 #else // CONFIG_XZONE_MALLOC
 
 T_DECL(tiny_freelist_corruption, "Crash on corruption of tiny freelist",
-		T_META_ENABLED(false), T_META_TAG_VM_PREFERRED,
-		T_META_TAG_NO_ALLOCATOR_OVERRIDE)
+		T_META_ENABLED(false))
 {
 	T_SKIP("Nothing to test for !CONFIG_XZONE_MALLOC");
 }