xref: /xnu-12377.81.4/tests/vm/configurator_vm_allocate.c (revision 043036a2b3718f7f0be807e2870f8f47d3fa0796)
1 /*
2  * Copyright (c) 2024 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 
29 /*
30  * vm/configurator_vm_allocate.c
31  *
32  * Test vm_allocate(FIXED and FIXED|OVERWRITE) with many different VM states.
33  */
34 
35 #include "configurator/vm_configurator_tests.h"
36 #include "configurator/vm_configurator_helpers.h"
37 #include "exc_guard_helper.h"
38 
39 T_GLOBAL_META(
40 	T_META_NAMESPACE("xnu.vm.configurator"),
41 	T_META_RADAR_COMPONENT_NAME("xnu"),
42 	T_META_RADAR_COMPONENT_VERSION("VM"),
43 	T_META_RUN_CONCURRENTLY(true),
44 	T_META_ASROOT(true),  /* required for vm submap sysctls */
45 	T_META_ALL_VALID_ARCHS(true)
46 	);
47 
48 /*
49  * rdar://143341561 vm_allocate(FIXED | OVERWRITE) sometimes provokes EXC_GUARD
50  * Remove this when that bug is fixed.
51  *
52  * normal workaround: run vm_allocate with the EXC_GUARD catcher in place
53  *     when the test is expected to hit rdar://143341561
54  * Rosetta workaround: EXC_GUARD catcher doesn't work on Rosetta, so don't run
55  *     vm_allocate when the test is expected to hit rdar://143341561
56  */
57 #define workaround_rdar_143341561 1
58 
59 /*
60  * Update the checker list after a successful call to vm_allocate().
61  * Any pre-existing checkers inside this range are deleted and replaced.
62  */
63 static void
checker_perform_successful_vm_allocate(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size,uint16_t user_tag)64 checker_perform_successful_vm_allocate(
65 	checker_list_t *checker_list,
66 	mach_vm_address_t start,
67 	mach_vm_size_t size,
68 	uint16_t user_tag)
69 {
70 	/* Make a new checker for the allocation. */
71 	vm_entry_checker_t *new_checker = make_checker_for_vm_allocate(
72 		checker_list, start, size, VM_MAKE_TAG(user_tag));
73 	entry_checker_range_t new_range = { new_checker, new_checker };
74 
75 	/* Find existing checkers in the address range. */
76 	entry_checker_range_t old_range =
77 	    checker_list_find_and_clip_including_holes(checker_list, start, size);
78 
79 	/* Free the old checkers and insert the new checker. */
80 	checker_list_replace_range(checker_list, old_range, new_range);
81 }
82 
83 #if workaround_rdar_143341561
84 /*
85  * Return true if flags has VM_FLAGS_FIXED
86  * This is non-trivial because VM_FLAGS_FIXED is zero;
87  * the real value is the absence of VM_FLAGS_ANYWHERE.
88  */
89 static bool
is_fixed(int flags)90 is_fixed(int flags)
91 {
92 	static_assert(VM_FLAGS_FIXED == 0, "this test requires VM_FLAGS_FIXED be zero");
93 	static_assert(VM_FLAGS_ANYWHERE != 0, "this test requires VM_FLAGS_ANYWHERE be nonzero");
94 	return !(flags & VM_FLAGS_ANYWHERE);
95 }
96 
97 /* Return true if flags has VM_FLAGS_FIXED and VM_FLAGS_OVERWRITE set. */
98 static bool
is_fixed_overwrite(int flags)99 is_fixed_overwrite(int flags)
100 {
101 	return is_fixed(flags) && (flags & VM_FLAGS_OVERWRITE);
102 }
103 #endif  /* workaround_rdar_143341561 */
104 
105 static bool
call_vm_allocate_and_expect_result(mach_vm_address_t start,mach_vm_size_t size,int flags_and_tag,kern_return_t expected_kr)106 call_vm_allocate_and_expect_result(
107 	mach_vm_address_t start,
108 	mach_vm_size_t size,
109 	int flags_and_tag,
110 	kern_return_t expected_kr)
111 {
112 #if workaround_rdar_143341561
113 	__block mach_vm_address_t allocated = start;
114 	__block kern_return_t kr;
115 	exc_guard_helper_info_t exc_info;
116 	bool caught_exception =
117 	    block_raised_exc_guard_of_type_ignoring_translated(GUARD_TYPE_VIRT_MEMORY, &exc_info, ^{
118 		kr = mach_vm_allocate(mach_task_self(), &allocated, size, flags_and_tag);
119 	});
120 	if (caught_exception) {
121 		if (is_fixed_overwrite(flags_and_tag)) {
122 			T_LOG("warning: rdar://143341561 mmap(FIXED) should work "
123 			    "regardless of whether a mapping exists at the addr");
124 		} else {
125 			T_FAIL("unexpected EXC_GUARD during vm_allocate");
126 			return false;
127 		}
128 	}
129 #else  /* not workaround_rdar_143341561 */
130 	mach_vm_address_t allocated = start;
131 	kern_return_t kr =
132 	    mach_vm_allocate(mach_task_self(), &allocated, size, flags_and_tag);
133 #endif /* not workaround_rdar_143341561 */
134 
135 	if (kr != expected_kr) {
136 		T_EXPECT_MACH_ERROR(kr, expected_kr, "mach_vm_allocate(flags 0x%x)", flags_and_tag);
137 		return false;
138 	}
139 	if (allocated != start) {
140 		T_FAIL("mach_vm_allocate(flags 0x%x) returned address 0x%llx (expected 0x%llx)",
141 		    flags_and_tag, allocated, start);
142 		return false;
143 	}
144 
145 	return true;
146 }
147 
148 static bool
call_vm_allocate_and_expect_success(mach_vm_address_t start,mach_vm_size_t size,int flags_and_tag)149 call_vm_allocate_and_expect_success(
150 	mach_vm_address_t start,
151 	mach_vm_size_t size,
152 	int flags_and_tag)
153 {
154 	return call_vm_allocate_and_expect_result(start, size, flags_and_tag, KERN_SUCCESS);
155 }
156 
157 static bool
call_vm_allocate_and_expect_no_space(mach_vm_address_t start,mach_vm_size_t size,int flags_and_tag)158 call_vm_allocate_and_expect_no_space(
159 	mach_vm_address_t start,
160 	mach_vm_size_t size,
161 	int flags_and_tag)
162 {
163 	return call_vm_allocate_and_expect_result(start, size, flags_and_tag, KERN_NO_SPACE);
164 }
165 
166 static test_result_t
successful_vm_allocate_fixed(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)167 successful_vm_allocate_fixed(
168 	checker_list_t *checker_list,
169 	mach_vm_address_t start,
170 	mach_vm_size_t size)
171 {
172 	if (!call_vm_allocate_and_expect_success(start, size, VM_FLAGS_FIXED)) {
173 		return TestFailed;
174 	}
175 	checker_perform_successful_vm_allocate(checker_list, start, size, 0);
176 
177 	return verify_vm_state(checker_list, "after vm_allocate(FIXED)");
178 }
179 
180 
181 static test_result_t
test_permanent_entry_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)182 test_permanent_entry_fixed_overwrite(
183 	checker_list_t *checker_list,
184 	mach_vm_address_t start,
185 	mach_vm_size_t size)
186 {
187 #if workaround_rdar_143341561
188 	if (isRosetta()) {
189 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
190 		return TestSucceeded;
191 	}
192 #endif
193 
194 	if (!call_vm_allocate_and_expect_no_space(
195 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
196 		return TestFailed;
197 	}
198 
199 	/* one permanent entry, it becomes inaccessible */
200 	checker_perform_vm_deallocate_permanent(checker_list, start, size);
201 
202 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
203 }
204 
205 static test_result_t
test_permanent_before_permanent_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)206 test_permanent_before_permanent_fixed_overwrite(
207 	checker_list_t *checker_list,
208 	mach_vm_address_t start,
209 	mach_vm_size_t size)
210 {
211 #if workaround_rdar_143341561
212 	if (isRosetta()) {
213 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
214 		return TestSucceeded;
215 	}
216 #endif
217 
218 	if (!call_vm_allocate_and_expect_no_space(
219 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
220 		return TestFailed;
221 	}
222 
223 	/* two permanent entries, both become inaccessible */
224 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
225 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
226 
227 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
228 }
229 
230 static test_result_t
test_permanent_before_allocation_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)231 test_permanent_before_allocation_fixed_overwrite(
232 	checker_list_t *checker_list,
233 	mach_vm_address_t start,
234 	mach_vm_size_t size)
235 {
236 #if workaround_rdar_143341561
237 	if (isRosetta()) {
238 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
239 		return TestSucceeded;
240 	}
241 #endif
242 
243 	if (!call_vm_allocate_and_expect_no_space(
244 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
245 		return TestFailed;
246 	}
247 
248 	/*
249 	 * one permanent entry, becomes inaccessible
250 	 * one nonpermanent allocation, unchanged
251 	 */
252 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
253 	/* [start + size/2, start + size) unchanged */
254 
255 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
256 }
257 
258 static test_result_t
test_permanent_before_allocation_fixed_overwrite_rdar144128567(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)259 test_permanent_before_allocation_fixed_overwrite_rdar144128567(
260 	checker_list_t *checker_list,
261 	mach_vm_address_t start,
262 	mach_vm_size_t size)
263 {
264 #if workaround_rdar_143341561
265 	if (isRosetta()) {
266 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
267 		return TestSucceeded;
268 	}
269 #endif
270 
271 	if (!call_vm_allocate_and_expect_no_space(
272 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
273 		return TestFailed;
274 	}
275 
276 	/*
277 	 * one permanent entry, becomes inaccessible
278 	 * one nonpermanent allocation, becomes deallocated (rdar://144128567)
279 	 */
280 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
281 	checker_perform_successful_vm_deallocate(checker_list, start + size / 2, size / 2);
282 
283 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
284 }
285 
286 static test_result_t
test_permanent_before_hole_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)287 test_permanent_before_hole_fixed_overwrite(
288 	checker_list_t *checker_list,
289 	mach_vm_address_t start,
290 	mach_vm_size_t size)
291 {
292 #if workaround_rdar_143341561
293 	if (isRosetta()) {
294 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
295 		return TestSucceeded;
296 	}
297 #endif
298 
299 	if (!call_vm_allocate_and_expect_no_space(
300 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
301 		return TestFailed;
302 	}
303 
304 	/*
305 	 * one permanent entry, becomes inaccessible
306 	 * one hole, unchanged
307 	 */
308 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
309 	/* no change for addresses [start + size / 2, start + size) */
310 
311 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
312 }
313 
314 static test_result_t
test_permanent_after_allocation_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)315 test_permanent_after_allocation_fixed_overwrite(
316 	checker_list_t *checker_list,
317 	mach_vm_address_t start,
318 	mach_vm_size_t size)
319 {
320 #if workaround_rdar_143341561
321 	if (isRosetta()) {
322 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
323 		return TestSucceeded;
324 	}
325 #endif
326 
327 	if (!call_vm_allocate_and_expect_no_space(
328 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
329 		return TestFailed;
330 	}
331 
332 	/*
333 	 * one nonpermanent allocation, becomes deallocated
334 	 * one permanent entry, becomes inaccessible
335 	 */
336 	checker_perform_successful_vm_deallocate(checker_list, start, size / 2);
337 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
338 
339 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
340 }
341 
342 static test_result_t
test_permanent_after_hole_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)343 test_permanent_after_hole_fixed_overwrite(
344 	checker_list_t *checker_list,
345 	mach_vm_address_t start,
346 	mach_vm_size_t size)
347 {
348 #if workaround_rdar_143341561
349 	if (isRosetta()) {
350 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
351 		return TestSucceeded;
352 	}
353 #endif
354 
355 	if (!call_vm_allocate_and_expect_no_space(
356 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE)) {
357 		return TestFailed;
358 	}
359 
360 	/*
361 	 * one hole, unchanged
362 	 * one permanent entry, becomes inaccessible
363 	 */
364 	/* no change for addresses [start, start + size / 2) */
365 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
366 
367 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
368 }
369 
370 
371 static test_result_t
test_permanent_entry_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)372 test_permanent_entry_fixed_overwrite_with_neighbor_tags(
373 	checker_list_t *checker_list,
374 	mach_vm_address_t start,
375 	mach_vm_size_t size)
376 {
377 #if workaround_rdar_143341561
378 	if (isRosetta()) {
379 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
380 		return TestSucceeded;
381 	}
382 #endif
383 
384 	uint16_t tag;
385 
386 	/*
387 	 * Allocate with a tag matching the entry to the left,
388 	 */
389 	tag = get_app_specific_user_tag_for_address(start - 1);
390 	if (!call_vm_allocate_and_expect_no_space(
391 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
392 		return TestFailed;
393 	}
394 
395 	/* one permanent entry, it becomes inaccessible */
396 	checker_perform_vm_deallocate_permanent(checker_list, start, size);
397 
398 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
399 }
400 
401 static test_result_t
test_permanent_before_permanent_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)402 test_permanent_before_permanent_fixed_overwrite_with_neighbor_tags(
403 	checker_list_t *checker_list,
404 	mach_vm_address_t start,
405 	mach_vm_size_t size)
406 {
407 #if workaround_rdar_143341561
408 	if (isRosetta()) {
409 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
410 		return TestSucceeded;
411 	}
412 #endif
413 
414 	uint16_t tag;
415 
416 	/*
417 	 * Allocate with a tag matching the entry to the left,
418 	 */
419 	tag = get_app_specific_user_tag_for_address(start - 1);
420 	if (!call_vm_allocate_and_expect_no_space(
421 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
422 		return TestFailed;
423 	}
424 
425 	/* two permanent entries, both become inaccessible */
426 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
427 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
428 
429 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
430 }
431 
432 static test_result_t
test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)433 test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags(
434 	checker_list_t *checker_list,
435 	mach_vm_address_t start,
436 	mach_vm_size_t size)
437 {
438 #if workaround_rdar_143341561
439 	if (isRosetta()) {
440 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
441 		return TestSucceeded;
442 	}
443 #endif
444 
445 	uint16_t tag;
446 
447 	/*
448 	 * Allocate with a tag matching the entry to the left,
449 	 */
450 	tag = get_app_specific_user_tag_for_address(start - 1);
451 	if (!call_vm_allocate_and_expect_no_space(
452 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
453 		return TestFailed;
454 	}
455 
456 	/*
457 	 * one permanent entry, becomes inaccessible
458 	 * one nonpermanent allocation, unchanged
459 	 */
460 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
461 	/* [start + size/2, start + size) unchanged */
462 
463 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
464 }
465 
466 static test_result_t
test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags_rdar144128567(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)467 test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags_rdar144128567(
468 	checker_list_t *checker_list,
469 	mach_vm_address_t start,
470 	mach_vm_size_t size)
471 {
472 	uint16_t tag;
473 
474 	/*
475 	 * Allocate with a tag matching the entry to the left,
476 	 */
477 	tag = get_app_specific_user_tag_for_address(start - 1);
478 	if (!call_vm_allocate_and_expect_no_space(
479 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
480 		return TestFailed;
481 	}
482 
483 	/*
484 	 * one permanent entry, becomes inaccessible
485 	 * one nonpermanent allocation, becomes deallocated (rdar://144128567)
486 	 */
487 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
488 	checker_perform_successful_vm_deallocate(checker_list, start + size / 2, size / 2);
489 
490 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
491 }
492 
493 static test_result_t
test_permanent_before_hole_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)494 test_permanent_before_hole_fixed_overwrite_with_neighbor_tags(
495 	checker_list_t *checker_list,
496 	mach_vm_address_t start,
497 	mach_vm_size_t size)
498 {
499 #if workaround_rdar_143341561
500 	if (isRosetta()) {
501 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
502 		return TestSucceeded;
503 	}
504 #endif
505 
506 	uint16_t tag;
507 
508 	/*
509 	 * Allocate with a tag matching the entry to the left,
510 	 */
511 	tag = get_app_specific_user_tag_for_address(start - 1);
512 	if (!call_vm_allocate_and_expect_no_space(
513 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
514 		return TestFailed;
515 	}
516 
517 	/*
518 	 * one permanent entry, becomes inaccessible
519 	 * one hole, unchanged
520 	 */
521 	checker_perform_vm_deallocate_permanent(checker_list, start, size / 2);
522 	/* no change for addresses [start + size / 2, start + size) */
523 
524 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
525 }
526 
527 static test_result_t
test_permanent_after_allocation_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)528 test_permanent_after_allocation_fixed_overwrite_with_neighbor_tags(
529 	checker_list_t *checker_list,
530 	mach_vm_address_t start,
531 	mach_vm_size_t size)
532 {
533 #if workaround_rdar_143341561
534 	if (isRosetta()) {
535 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
536 		return TestSucceeded;
537 	}
538 #endif
539 
540 	uint16_t tag;
541 
542 	/*
543 	 * Allocate with a tag matching the entry to the left,
544 	 */
545 	tag = get_app_specific_user_tag_for_address(start - 1);
546 	if (!call_vm_allocate_and_expect_no_space(
547 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
548 		return TestFailed;
549 	}
550 
551 	/*
552 	 * one nonpermanent allocation, becomes deallocated
553 	 * one permanent entry, becomes inaccessible
554 	 */
555 	checker_perform_successful_vm_deallocate(checker_list, start, size / 2);
556 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
557 
558 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
559 }
560 
561 static test_result_t
test_permanent_after_hole_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)562 test_permanent_after_hole_fixed_overwrite_with_neighbor_tags(
563 	checker_list_t *checker_list,
564 	mach_vm_address_t start,
565 	mach_vm_size_t size)
566 {
567 #if workaround_rdar_143341561
568 	if (isRosetta()) {
569 		T_LOG("warning: can't work around rdar://143341561 on Rosetta; just passing instead");
570 		return TestSucceeded;
571 	}
572 #endif
573 
574 	uint16_t tag;
575 
576 	/*
577 	 * Allocate with a tag matching the entry to the left,
578 	 */
579 	tag = get_app_specific_user_tag_for_address(start - 1);
580 	if (!call_vm_allocate_and_expect_no_space(
581 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
582 		return TestFailed;
583 	}
584 
585 	/*
586 	 * one hole, unchanged
587 	 * one permanent entry, becomes inaccessible
588 	 */
589 	/* no change for addresses [start, start + size / 2) */
590 	checker_perform_vm_deallocate_permanent(checker_list, start + size / 2, size / 2);
591 
592 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
593 }
594 
595 static test_result_t
fixed_no_space(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)596 fixed_no_space(
597 	checker_list_t *checker_list,
598 	mach_vm_address_t start,
599 	mach_vm_size_t size)
600 {
601 	if (!call_vm_allocate_and_expect_no_space(start, size, VM_FLAGS_FIXED)) {
602 		return TestFailed;
603 	}
604 
605 	/* no checker update here, call should have no side effects */
606 
607 	return verify_vm_state(checker_list, "after vm_allocate(FIXED)");
608 }
609 
610 
611 static test_result_t
successful_vm_allocate_fixed_overwrite_with_tag(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size,uint16_t tag)612 successful_vm_allocate_fixed_overwrite_with_tag(
613 	checker_list_t *checker_list,
614 	mach_vm_address_t start,
615 	mach_vm_size_t size,
616 	uint16_t tag)
617 {
618 	if (!call_vm_allocate_and_expect_success(
619 		    start, size, VM_FLAGS_FIXED | VM_FLAGS_OVERWRITE | VM_MAKE_TAG(tag))) {
620 		return TestFailed;
621 	}
622 	checker_perform_successful_vm_allocate(checker_list, start, size, tag);
623 
624 	return verify_vm_state(checker_list, "after vm_allocate(FIXED | OVERWRITE)");
625 }
626 
627 static test_result_t
successful_vm_allocate_fixed_overwrite(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)628 successful_vm_allocate_fixed_overwrite(
629 	checker_list_t *checker_list,
630 	mach_vm_address_t start,
631 	mach_vm_size_t size)
632 {
633 	return successful_vm_allocate_fixed_overwrite_with_tag(
634 		checker_list, start, size, 0);
635 }
636 
637 static test_result_t
successful_vm_allocate_fixed_overwrite_with_neighbor_tags(checker_list_t * checker_list,mach_vm_address_t start,mach_vm_size_t size)638 successful_vm_allocate_fixed_overwrite_with_neighbor_tags(
639 	checker_list_t *checker_list,
640 	mach_vm_address_t start,
641 	mach_vm_size_t size)
642 {
643 	uint16_t tag;
644 
645 	/*
646 	 * Allocate with a tag matching the entry to the left,
647 	 * to probe simplify behavior.
648 	 */
649 	tag = get_app_specific_user_tag_for_address(start - 1);
650 	if (TestFailed == successful_vm_allocate_fixed_overwrite_with_tag(
651 		    checker_list, start, size, tag)) {
652 		return TestFailed;
653 	}
654 
655 	/*
656 	 * Allocate again, with a tag matching the entry to the right,
657 	 * to probe simplify behavior.
658 	 */
659 	tag = get_app_specific_user_tag_for_address(start + size);
660 	if (TestFailed == successful_vm_allocate_fixed_overwrite_with_tag(
661 		    checker_list, start, size, tag)) {
662 		return TestFailed;
663 	}
664 
665 	return TestSucceeded;
666 }
667 
668 
669 T_DECL(vm_allocate_fixed,
670     "run vm_allocate(FIXED) with various vm configurations")
671 {
672 	vm_tests_t tests = {
673 		.single_entry_1 = fixed_no_space,
674 		.single_entry_2 = fixed_no_space,
675 		.single_entry_3 = fixed_no_space,
676 		.single_entry_4 = fixed_no_space,
677 
678 		.multiple_entries_1 = fixed_no_space,
679 		.multiple_entries_2 = fixed_no_space,
680 		.multiple_entries_3 = fixed_no_space,
681 		.multiple_entries_4 = fixed_no_space,
682 		.multiple_entries_5 = fixed_no_space,
683 		.multiple_entries_6 = fixed_no_space,
684 
685 		.some_holes_1 = fixed_no_space,
686 		.some_holes_2 = fixed_no_space,
687 		.some_holes_3 = fixed_no_space,
688 		.some_holes_4 = fixed_no_space,
689 		.some_holes_5 = fixed_no_space,
690 		.some_holes_6 = fixed_no_space,
691 		.some_holes_7 = fixed_no_space,
692 		.some_holes_8 = fixed_no_space,
693 		.some_holes_9 = fixed_no_space,
694 		.some_holes_10 = fixed_no_space,
695 		.some_holes_11 = fixed_no_space,
696 		.some_holes_12 = fixed_no_space,
697 
698 		.all_holes_1 = successful_vm_allocate_fixed,
699 		.all_holes_2 = successful_vm_allocate_fixed,
700 		.all_holes_3 = successful_vm_allocate_fixed,
701 		.all_holes_4 = successful_vm_allocate_fixed,
702 
703 		.null_entry = fixed_no_space,
704 		.nonresident_entry = fixed_no_space,
705 		.resident_entry = fixed_no_space,
706 
707 		.shared_entry = fixed_no_space,
708 		.shared_entry_discontiguous = fixed_no_space,
709 		.shared_entry_partial = fixed_no_space,
710 		.shared_entry_pairs = fixed_no_space,
711 		.shared_entry_x1000 = fixed_no_space,
712 
713 		.cow_entry = fixed_no_space,
714 		.cow_unreferenced = fixed_no_space,
715 		.cow_nocow = fixed_no_space,
716 		.nocow_cow = fixed_no_space,
717 		.cow_unreadable = fixed_no_space,
718 		.cow_unwriteable = fixed_no_space,
719 
720 		.permanent_entry = fixed_no_space,
721 		.permanent_before_permanent = fixed_no_space,
722 		.permanent_before_allocation = fixed_no_space,
723 		.permanent_before_allocation_2 = fixed_no_space,
724 		.permanent_before_hole = fixed_no_space,
725 		.permanent_after_allocation = fixed_no_space,
726 		.permanent_after_hole = fixed_no_space,
727 
728 		.single_submap_single_entry = fixed_no_space,
729 		.single_submap_single_entry_first_pages = fixed_no_space,
730 		.single_submap_single_entry_last_pages = fixed_no_space,
731 		.single_submap_single_entry_middle_pages = fixed_no_space,
732 		.single_submap_oversize_entry_at_start = fixed_no_space,
733 		.single_submap_oversize_entry_at_end = fixed_no_space,
734 		.single_submap_oversize_entry_at_both = fixed_no_space,
735 
736 		.submap_before_allocation = fixed_no_space,
737 		.submap_after_allocation = fixed_no_space,
738 		.submap_before_hole = fixed_no_space,
739 		.submap_after_hole = fixed_no_space,
740 		.submap_allocation_submap_one_entry = fixed_no_space,
741 		.submap_allocation_submap_two_entries = fixed_no_space,
742 		.submap_allocation_submap_three_entries = fixed_no_space,
743 
744 		.submap_before_allocation_ro = fixed_no_space,
745 		.submap_after_allocation_ro = fixed_no_space,
746 		.submap_before_hole_ro = fixed_no_space,
747 		.submap_after_hole_ro = fixed_no_space,
748 		.submap_allocation_submap_one_entry_ro = fixed_no_space,
749 		.submap_allocation_submap_two_entries_ro = fixed_no_space,
750 		.submap_allocation_submap_three_entries_ro = fixed_no_space,
751 
752 		.protection_single_000_000 = fixed_no_space,
753 		.protection_single_000_r00 = fixed_no_space,
754 		.protection_single_000_0w0 = fixed_no_space,
755 		.protection_single_000_rw0 = fixed_no_space,
756 		.protection_single_r00_r00 = fixed_no_space,
757 		.protection_single_r00_rw0 = fixed_no_space,
758 		.protection_single_0w0_0w0 = fixed_no_space,
759 		.protection_single_0w0_rw0 = fixed_no_space,
760 		.protection_single_rw0_rw0 = fixed_no_space,
761 
762 		.protection_pairs_000_000 = fixed_no_space,
763 		.protection_pairs_000_r00 = fixed_no_space,
764 		.protection_pairs_000_0w0 = fixed_no_space,
765 		.protection_pairs_000_rw0 = fixed_no_space,
766 		.protection_pairs_r00_000 = fixed_no_space,
767 		.protection_pairs_r00_r00 = fixed_no_space,
768 		.protection_pairs_r00_0w0 = fixed_no_space,
769 		.protection_pairs_r00_rw0 = fixed_no_space,
770 		.protection_pairs_0w0_000 = fixed_no_space,
771 		.protection_pairs_0w0_r00 = fixed_no_space,
772 		.protection_pairs_0w0_0w0 = fixed_no_space,
773 		.protection_pairs_0w0_rw0 = fixed_no_space,
774 		.protection_pairs_rw0_000 = fixed_no_space,
775 		.protection_pairs_rw0_r00 = fixed_no_space,
776 		.protection_pairs_rw0_0w0 = fixed_no_space,
777 		.protection_pairs_rw0_rw0 = fixed_no_space,
778 	};
779 
780 	run_vm_tests("vm_allocate_fixed", __FILE__, &tests, argc, argv);
781 }
782 
783 
784 T_DECL(vm_allocate_fixed_overwrite,
785     "run vm_allocate(FIXED|OVERWRITE) with various vm configurations")
786 {
787 #if workaround_rdar_143341561
788 	enable_non_fatal_vm_exc_guard();
789 #endif
790 
791 	vm_tests_t tests = {
792 		.single_entry_1 = successful_vm_allocate_fixed_overwrite,
793 		.single_entry_2 = successful_vm_allocate_fixed_overwrite,
794 		.single_entry_3 = successful_vm_allocate_fixed_overwrite,
795 		.single_entry_4 = successful_vm_allocate_fixed_overwrite,
796 
797 		.multiple_entries_1 = successful_vm_allocate_fixed_overwrite,
798 		.multiple_entries_2 = successful_vm_allocate_fixed_overwrite,
799 		.multiple_entries_3 = successful_vm_allocate_fixed_overwrite,
800 		.multiple_entries_4 = successful_vm_allocate_fixed_overwrite,
801 		.multiple_entries_5 = successful_vm_allocate_fixed_overwrite,
802 		.multiple_entries_6 = successful_vm_allocate_fixed_overwrite,
803 
804 		.some_holes_1 = successful_vm_allocate_fixed_overwrite,
805 		.some_holes_2 = successful_vm_allocate_fixed_overwrite,
806 		.some_holes_3 = successful_vm_allocate_fixed_overwrite,
807 		.some_holes_4 = successful_vm_allocate_fixed_overwrite,
808 		.some_holes_5 = successful_vm_allocate_fixed_overwrite,
809 		.some_holes_6 = successful_vm_allocate_fixed_overwrite,
810 		.some_holes_7 = successful_vm_allocate_fixed_overwrite,
811 		.some_holes_8 = successful_vm_allocate_fixed_overwrite,
812 		.some_holes_9 = successful_vm_allocate_fixed_overwrite,
813 		.some_holes_10 = successful_vm_allocate_fixed_overwrite,
814 		.some_holes_11 = successful_vm_allocate_fixed_overwrite,
815 		.some_holes_12 = successful_vm_allocate_fixed_overwrite,
816 
817 		.all_holes_1 = successful_vm_allocate_fixed_overwrite,
818 		.all_holes_2 = successful_vm_allocate_fixed_overwrite,
819 		.all_holes_3 = successful_vm_allocate_fixed_overwrite,
820 		.all_holes_4 = successful_vm_allocate_fixed_overwrite,
821 
822 		.null_entry = successful_vm_allocate_fixed_overwrite,
823 		.nonresident_entry = successful_vm_allocate_fixed_overwrite,
824 		.resident_entry = successful_vm_allocate_fixed_overwrite,
825 
826 		.shared_entry = successful_vm_allocate_fixed_overwrite,
827 		.shared_entry_discontiguous = successful_vm_allocate_fixed_overwrite,
828 		.shared_entry_partial = successful_vm_allocate_fixed_overwrite,
829 		.shared_entry_pairs = successful_vm_allocate_fixed_overwrite,
830 		.shared_entry_x1000 = successful_vm_allocate_fixed_overwrite,
831 
832 		.cow_entry = successful_vm_allocate_fixed_overwrite,
833 		.cow_unreferenced = successful_vm_allocate_fixed_overwrite,
834 		.cow_nocow = successful_vm_allocate_fixed_overwrite,
835 		.nocow_cow = successful_vm_allocate_fixed_overwrite,
836 		.cow_unreadable = successful_vm_allocate_fixed_overwrite,
837 		.cow_unwriteable = successful_vm_allocate_fixed_overwrite,
838 
839 		.permanent_entry = test_permanent_entry_fixed_overwrite,
840 		.permanent_before_permanent = test_permanent_before_permanent_fixed_overwrite,
841 		.permanent_before_allocation = test_permanent_before_allocation_fixed_overwrite,
842 		.permanent_before_allocation_2 = test_permanent_before_allocation_fixed_overwrite_rdar144128567,
843 		.permanent_before_hole = test_permanent_before_hole_fixed_overwrite,
844 		.permanent_after_allocation = test_permanent_after_allocation_fixed_overwrite,
845 		.permanent_after_hole = test_permanent_after_hole_fixed_overwrite,
846 
847 		.single_submap_single_entry = successful_vm_allocate_fixed_overwrite,
848 		.single_submap_single_entry_first_pages = successful_vm_allocate_fixed_overwrite,
849 		.single_submap_single_entry_last_pages = successful_vm_allocate_fixed_overwrite,
850 		.single_submap_single_entry_middle_pages = successful_vm_allocate_fixed_overwrite,
851 		.single_submap_oversize_entry_at_start = successful_vm_allocate_fixed_overwrite,
852 		.single_submap_oversize_entry_at_end = successful_vm_allocate_fixed_overwrite,
853 		.single_submap_oversize_entry_at_both = successful_vm_allocate_fixed_overwrite,
854 
855 		.submap_before_allocation = successful_vm_allocate_fixed_overwrite,
856 		.submap_after_allocation = successful_vm_allocate_fixed_overwrite,
857 		.submap_before_hole = successful_vm_allocate_fixed_overwrite,
858 		.submap_after_hole = successful_vm_allocate_fixed_overwrite,
859 		.submap_allocation_submap_one_entry = successful_vm_allocate_fixed_overwrite,
860 		.submap_allocation_submap_two_entries = successful_vm_allocate_fixed_overwrite,
861 		.submap_allocation_submap_three_entries = successful_vm_allocate_fixed_overwrite,
862 
863 		.submap_before_allocation_ro = successful_vm_allocate_fixed_overwrite,
864 		.submap_after_allocation_ro = successful_vm_allocate_fixed_overwrite,
865 		.submap_before_hole_ro = successful_vm_allocate_fixed_overwrite,
866 		.submap_after_hole_ro = successful_vm_allocate_fixed_overwrite,
867 		.submap_allocation_submap_one_entry_ro = successful_vm_allocate_fixed_overwrite,
868 		.submap_allocation_submap_two_entries_ro = successful_vm_allocate_fixed_overwrite,
869 		.submap_allocation_submap_three_entries_ro = successful_vm_allocate_fixed_overwrite,
870 
871 		.protection_single_000_000 = successful_vm_allocate_fixed_overwrite,
872 		.protection_single_000_r00 = successful_vm_allocate_fixed_overwrite,
873 		.protection_single_000_0w0 = successful_vm_allocate_fixed_overwrite,
874 		.protection_single_000_rw0 = successful_vm_allocate_fixed_overwrite,
875 		.protection_single_r00_r00 = successful_vm_allocate_fixed_overwrite,
876 		.protection_single_r00_rw0 = successful_vm_allocate_fixed_overwrite,
877 		.protection_single_0w0_0w0 = successful_vm_allocate_fixed_overwrite,
878 		.protection_single_0w0_rw0 = successful_vm_allocate_fixed_overwrite,
879 		.protection_single_rw0_rw0 = successful_vm_allocate_fixed_overwrite,
880 
881 		.protection_pairs_000_000 = successful_vm_allocate_fixed_overwrite,
882 		.protection_pairs_000_r00 = successful_vm_allocate_fixed_overwrite,
883 		.protection_pairs_000_0w0 = successful_vm_allocate_fixed_overwrite,
884 		.protection_pairs_000_rw0 = successful_vm_allocate_fixed_overwrite,
885 		.protection_pairs_r00_000 = successful_vm_allocate_fixed_overwrite,
886 		.protection_pairs_r00_r00 = successful_vm_allocate_fixed_overwrite,
887 		.protection_pairs_r00_0w0 = successful_vm_allocate_fixed_overwrite,
888 		.protection_pairs_r00_rw0 = successful_vm_allocate_fixed_overwrite,
889 		.protection_pairs_0w0_000 = successful_vm_allocate_fixed_overwrite,
890 		.protection_pairs_0w0_r00 = successful_vm_allocate_fixed_overwrite,
891 		.protection_pairs_0w0_0w0 = successful_vm_allocate_fixed_overwrite,
892 		.protection_pairs_0w0_rw0 = successful_vm_allocate_fixed_overwrite,
893 		.protection_pairs_rw0_000 = successful_vm_allocate_fixed_overwrite,
894 		.protection_pairs_rw0_r00 = successful_vm_allocate_fixed_overwrite,
895 		.protection_pairs_rw0_0w0 = successful_vm_allocate_fixed_overwrite,
896 		.protection_pairs_rw0_rw0 = successful_vm_allocate_fixed_overwrite,
897 	};
898 
899 	run_vm_tests("vm_allocate_fixed_overwrite", __FILE__, &tests, argc, argv);
900 }
901 
902 T_DECL(vm_allocate_fixed_overwrite_with_neighbor_tags,
903     "run vm_allocate(FIXED|OVERWRITE|tag) with various vm configurations "
904     "and tags copied from neighboring entries")
905 {
906 #if workaround_rdar_143341561
907 	enable_non_fatal_vm_exc_guard();
908 #endif
909 
910 	vm_tests_t tests = {
911 		.single_entry_1 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
912 		.single_entry_2 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
913 		.single_entry_3 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
914 		.single_entry_4 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
915 
916 		.multiple_entries_1 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
917 		.multiple_entries_2 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
918 		.multiple_entries_3 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
919 		.multiple_entries_4 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
920 		.multiple_entries_5 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
921 		.multiple_entries_6 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
922 
923 		.some_holes_1 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
924 		.some_holes_2 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
925 		.some_holes_3 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
926 		.some_holes_4 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
927 		.some_holes_5 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
928 		.some_holes_6 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
929 		.some_holes_7 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
930 		.some_holes_8 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
931 		.some_holes_9 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
932 		.some_holes_10 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
933 		.some_holes_11 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
934 		.some_holes_12 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
935 
936 		.all_holes_1 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
937 		.all_holes_2 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
938 		.all_holes_3 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
939 		.all_holes_4 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
940 
941 		.null_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
942 		.nonresident_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
943 		.resident_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
944 
945 		.shared_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
946 		.shared_entry_discontiguous = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
947 		.shared_entry_partial = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
948 		.shared_entry_pairs = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
949 		.shared_entry_x1000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
950 
951 		.cow_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
952 		.cow_unreferenced = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
953 		.cow_nocow = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
954 		.nocow_cow = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
955 		.cow_unreadable = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
956 		.cow_unwriteable = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
957 
958 		.permanent_entry = test_permanent_entry_fixed_overwrite_with_neighbor_tags,
959 		.permanent_before_permanent = test_permanent_before_permanent_fixed_overwrite_with_neighbor_tags,
960 		.permanent_before_allocation = test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags,
961 		.permanent_before_allocation_2 = test_permanent_before_allocation_fixed_overwrite_with_neighbor_tags_rdar144128567,
962 		.permanent_before_hole = test_permanent_before_hole_fixed_overwrite_with_neighbor_tags,
963 		.permanent_after_allocation = test_permanent_after_allocation_fixed_overwrite_with_neighbor_tags,
964 		.permanent_after_hole = test_permanent_after_hole_fixed_overwrite_with_neighbor_tags,
965 
966 		.single_submap_single_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
967 		.single_submap_single_entry_first_pages = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
968 		.single_submap_single_entry_last_pages = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
969 		.single_submap_single_entry_middle_pages = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
970 		.single_submap_oversize_entry_at_start = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
971 		.single_submap_oversize_entry_at_end = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
972 		.single_submap_oversize_entry_at_both = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
973 
974 		.submap_before_allocation = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
975 		.submap_after_allocation = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
976 		.submap_before_hole = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
977 		.submap_after_hole = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
978 		.submap_allocation_submap_one_entry = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
979 		.submap_allocation_submap_two_entries = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
980 		.submap_allocation_submap_three_entries = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
981 
982 		.submap_before_allocation_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
983 		.submap_after_allocation_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
984 		.submap_before_hole_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
985 		.submap_after_hole_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
986 		.submap_allocation_submap_one_entry_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
987 		.submap_allocation_submap_two_entries_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
988 		.submap_allocation_submap_three_entries_ro = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
989 
990 		.protection_single_000_000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
991 		.protection_single_000_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
992 		.protection_single_000_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
993 		.protection_single_000_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
994 		.protection_single_r00_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
995 		.protection_single_r00_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
996 		.protection_single_0w0_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
997 		.protection_single_0w0_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
998 		.protection_single_rw0_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
999 
1000 		.protection_pairs_000_000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1001 		.protection_pairs_000_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1002 		.protection_pairs_000_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1003 		.protection_pairs_000_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1004 		.protection_pairs_r00_000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1005 		.protection_pairs_r00_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1006 		.protection_pairs_r00_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1007 		.protection_pairs_r00_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1008 		.protection_pairs_0w0_000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1009 		.protection_pairs_0w0_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1010 		.protection_pairs_0w0_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1011 		.protection_pairs_0w0_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1012 		.protection_pairs_rw0_000 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1013 		.protection_pairs_rw0_r00 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1014 		.protection_pairs_rw0_0w0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1015 		.protection_pairs_rw0_rw0 = successful_vm_allocate_fixed_overwrite_with_neighbor_tags,
1016 	};
1017 
1018 	run_vm_tests("vm_allocate_fixed_overwrite_with_neighbor_tags", __FILE__, &tests, argc, argv);
1019 }
1020