Loading...
--- libmalloc/libmalloc-792.80.2/tests/nano_tests.c
+++ libmalloc/libmalloc-646.0.13/tests/nano_tests.c
@@ -85,16 +85,22 @@
 
 static void *allocations[ALLOCATION_COUNT];
 
-T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
+T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true), T_META_TAG_VM_NOT_PREFERRED);
 
 T_DECL(nano_active_test, "Test that Nano is activated",
 		T_META_ENVVAR("MallocNanoZone=1"), T_META_ENVVAR("MallocProbGuard=0"),
-		T_META_TAG_ALL_ALLOCATORS, T_META_TAG_VM_PREFERRED)
-{
-#if CONFIG_NANOZONE
+		T_META_TAG_XZONE, T_META_TAG_NANO_ON_XZONE)
+{
+#if CONFIG_NANOZONE
+	bool nano_on_xzone = getenv("MallocNanoOnXzone");
+	if (nano_on_xzone) {
+		T_ASSERT_NE(malloc_engaged_secure_allocator(), 0,
+				"Secure allocator engaged");
+	}
+
 	T_ASSERT_NE(malloc_engaged_nano(), 0, "Nano mode engaged");
 
-	if (!malloc_engaged_secure_allocator()) {
+	if (nano_on_xzone || !malloc_engaged_secure_allocator()) {
 		void *ptr = malloc(16);
 		T_LOG("Nano ptr is %p\n", ptr);
 		T_ASSERT_EQ(NANOZONE_SIGNATURE, (uint64_t)((uintptr_t)ptr) >> SHIFT_NANO_SIGNATURE,
@@ -108,7 +114,7 @@
 
 T_DECL(nano_enumerator_test, "Test the Nanov2 enumerator",
 		T_META_ENVVAR("MallocNanoZone=V2"), T_META_ENVVAR("MallocProbGuard=0"),
-		T_META_TAG_ALL_ALLOCATORS, T_META_TAG_VM_PREFERRED)
+		T_META_TAG_XZONE)
 {
 #if CONFIG_NANOZONE
 	if (malloc_engaged_secure_allocator()) {
@@ -214,8 +220,7 @@
 const char * const data = "abcdefghijklm";
 
 T_DECL(realloc_nano_size_class_change, "realloc with size class change",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"))
 {
 #if CONFIG_NANOZONE
 	void *ptr = malloc(16);
@@ -239,8 +244,7 @@
 }
 
 T_DECL(realloc_nano_ptr_change, "realloc with pointer change",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"))
 {
 #if CONFIG_NANOZONE
 	void *ptr = malloc(32);
@@ -259,8 +263,7 @@
 }
 
 T_DECL(realloc_nano_to_other, "realloc with allocator change (nano)",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_NANO_ON_XZONE)
 {
 #if CONFIG_NANOZONE
 	void *ptr = malloc(32);					// From Nano
@@ -280,8 +283,7 @@
 }
 
 T_DECL(realloc_nano_to_zero_size, "realloc with target size zero",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"))
 {
 #if CONFIG_NANOZONE
 	void *ptr = malloc(16);
@@ -299,8 +301,7 @@
 }
 
 T_DECL(realloc_nano_shrink, "realloc to smaller size",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"))
 {
 #if CONFIG_NANOZONE
 	void *ptr = malloc(64);
@@ -326,8 +327,7 @@
 }
 
 T_DECL(nano_memalign_trivial, "Test that nano serves trivial memalign allocations",
-	   T_META_ENVVAR("MallocNanoZone=1"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=1"))
 {
 #if CONFIG_NANOZONE
 	size_t size = 16;
@@ -355,8 +355,7 @@
 
 T_DECL(overspill_arena, "force overspill of an arena",
 	   T_META_ENVVAR("MallocNanoZone=V2"),
-	   T_META_ENVVAR("MallocGuardEdges=all"),
-	   T_META_TAG_VM_PREFERRED, T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocGuardEdges=all"))
 {
 #if CONFIG_NANOZONE
 	void **ptrs = calloc(ALLOCS_PER_ARENA, sizeof(void *));
@@ -401,8 +400,7 @@
 
 #if NANOV2_MULTIPLE_REGIONS
 T_DECL(overspill_region, "force overspill of a region",
-	   T_META_ENVVAR("MallocNanoZone=V2"), T_META_TAG_VM_PREFERRED,
-	   T_META_TAG_MAGAZINE_ONLY)
+	   T_META_ENVVAR("MallocNanoZone=V2"))
 {
 	void **ptrs = calloc(ALLOCS_PER_REGION, sizeof(void *));
 	T_QUIET; T_ASSERT_NOTNULL(ptrs, "Unable to allocate pointers");
@@ -440,7 +438,7 @@
 		T_META_ENVVAR("MallocNanoZone=V2"),
 		T_META_ENVVAR("MallocNanoMaxRegion=1"),
 		T_META_ENVVAR("MallocProbGuard=0"),
-		T_META_TAG_VM_PREFERRED, T_META_TAG_MAGAZINE_ONLY)
+		T_META_TAG_NANO_ON_XZONE)
 {
 	int index;
 	bool spilled_to_tiny = false;
@@ -549,8 +547,7 @@
 T_DECL(region_holes, "ensure correct handling of holes between regions",
 		T_META_ENVVAR("MallocNanoZone=V2"),
 		// Region reservation does not allow for holes between regions
-		T_META_ENABLED(!CONFIG_NANO_RESERVE_REGIONS),
-		T_META_TAG_VM_NOT_PREFERRED, T_META_TAG_MAGAZINE_ONLY)
+		T_META_ENABLED(!CONFIG_NANO_RESERVE_REGIONS))
 {
 	srandom(time(NULL));