xref: /xnu-10002.81.5/tests/imm_pinned_control_port.c (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <darwintest.h>
5 #include <mach/mach.h>
6 #include <mach/mach_vm.h>
7 #include <sys/sysctl.h>
8 #include <spawn.h>
9 #include <signal.h>
10 #include <TargetConditionals.h>
11 #include "excserver_protect.h"
12 
13 #define MAX_ARGV 3
14 #define EXC_CODE_SHIFT 32
15 #define EXC_GUARD_TYPE_SHIFT 29
16 #define MAX_TEST_NUM 21
17 
18 #define TASK_EXC_GUARD_MP_DELIVER 0x10
19 
20 extern char **environ;
21 static uint64_t exception_code = 0;
22 static exception_type_t exception_taken = 0;
23 
24 #define IKOT_TASK_CONTROL               2
25 
26 #ifndef kGUARD_EXC_INVALID_OPTIONS
27 #define kGUARD_EXC_INVALID_OPTIONS 3
28 #endif
29 
30 /*
31  * This test verifies behaviors of immovable/pinned task/thread ports.
32  *
33  * 1. Compare and verifies port names of mach_{task, thread}_self(),
34  * {TASK, THREAD}_KERNEL_PORT, and ports returned from task_threads()
35  * and processor_set_tasks().
36  * 2. Make sure correct exceptions are raised resulting from moving immovable
37  * task/thread control, read and inspect ports.
38  * 3. Make sure correct exceptions are raised resulting from deallocating pinned
39  * task/thread control ports.
40  * 4. Make sure immovable ports cannot be stashed:
41  * rdar://70585367 (Disallow immovable port stashing with *_set_special_port() and mach_port_register())
42  */
43 T_GLOBAL_META(
44 	T_META_NAMESPACE("xnu.ipc"),
45 	T_META_RADAR_COMPONENT_NAME("xnu"),
46 	T_META_RADAR_COMPONENT_VERSION("IPC"),
47 	T_META_RUN_CONCURRENTLY(TRUE));
48 
49 static uint64_t soft_exception_code[] = {
50 	EXC_GUARD, // Soft crash delivered as EXC_CORPSE_NOTIFY
51 	EXC_GUARD,
52 	EXC_GUARD,
53 	EXC_GUARD,
54 	EXC_GUARD,
55 	EXC_GUARD,
56 	EXC_GUARD,
57 
58 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
59 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
60 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
61 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
62 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
63 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
64 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
65 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
66 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
67 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
68 
69 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
70 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
71 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
72 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
73 };
74 
75 static uint64_t hard_exception_code[] = {
76 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
77 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
78 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
79 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
80 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
81 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
82 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_MOD_REFS,
83 
84 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
85 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
86 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
87 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
88 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
89 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
90 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
91 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
92 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
93 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_IMMOVABLE,
94 
95 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
96 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
97 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
98 	(GUARD_TYPE_MACH_PORT << EXC_GUARD_TYPE_SHIFT) | kGUARD_EXC_INVALID_OPTIONS,
99 };
100 
101 kern_return_t
catch_mach_exception_raise_state(mach_port_t exception_port,exception_type_t exception,const mach_exception_data_t code,mach_msg_type_number_t code_count,int * flavor,const thread_state_t old_state,mach_msg_type_number_t old_state_count,thread_state_t new_state,mach_msg_type_number_t * new_state_count)102 catch_mach_exception_raise_state(mach_port_t exception_port,
103     exception_type_t exception,
104     const mach_exception_data_t code,
105     mach_msg_type_number_t code_count,
106     int * flavor,
107     const thread_state_t old_state,
108     mach_msg_type_number_t old_state_count,
109     thread_state_t new_state,
110     mach_msg_type_number_t * new_state_count)
111 {
112 #pragma unused(exception_port, exception, code, code_count, flavor, old_state, old_state_count, new_state, new_state_count)
113 	T_FAIL("Unsupported catch_mach_exception_raise_state");
114 	return KERN_NOT_SUPPORTED;
115 }
116 
117 kern_return_t
catch_mach_exception_raise_identity_protected(mach_port_t exception_port,uint64_t thread_id,mach_port_t task_id_token,exception_type_t exception,mach_exception_data_t codes,mach_msg_type_number_t codeCnt)118 catch_mach_exception_raise_identity_protected(
119 	mach_port_t               exception_port,
120 	uint64_t                  thread_id,
121 	mach_port_t               task_id_token,
122 	exception_type_t          exception,
123 	mach_exception_data_t     codes,
124 	mach_msg_type_number_t    codeCnt)
125 {
126 #pragma unused(exception_port, codeCnt)
127 	task_t task;
128 	pid_t pid;
129 	kern_return_t kr = task_identity_token_get_task_port(task_id_token, TASK_FLAVOR_READ, &task);
130 	T_ASSERT_MACH_SUCCESS(kr, "task_identity_token_get_task_port");
131 	kr = pid_for_task(task, &pid);
132 	T_ASSERT_MACH_SUCCESS(kr, "pid_for_task");
133 	T_LOG("Crashing child pid: %d, continuing...\n", pid);
134 
135 	kr = mach_port_deallocate(mach_task_self(), task);
136 	T_QUIET; T_EXPECT_MACH_SUCCESS(kr, "mach_port_deallocate");
137 
138 	T_ASSERT_GT_UINT(codeCnt, 0, "CodeCnt");
139 	T_LOG("Caught exception type: %d code: 0x%llx", exception, (uint64_t)codes[0]);
140 	if (exception == EXC_GUARD || exception == EXC_CORPSE_NOTIFY) {
141 		exception_taken = exception;
142 		exception_code = (uint64_t)codes[0];
143 	} else {
144 		T_FAIL("Unexpected exception");
145 	}
146 	return KERN_SUCCESS;
147 }
148 
149 kern_return_t
catch_mach_exception_raise_state_identity(mach_port_t exception_port,mach_port_t thread,mach_port_t task,exception_type_t exception,mach_exception_data_t code,mach_msg_type_number_t code_count,int * flavor,thread_state_t old_state,mach_msg_type_number_t old_state_count,thread_state_t new_state,mach_msg_type_number_t * new_state_count)150 catch_mach_exception_raise_state_identity(mach_port_t exception_port,
151     mach_port_t thread,
152     mach_port_t task,
153     exception_type_t exception,
154     mach_exception_data_t code,
155     mach_msg_type_number_t code_count,
156     int * flavor,
157     thread_state_t old_state,
158     mach_msg_type_number_t old_state_count,
159     thread_state_t new_state,
160     mach_msg_type_number_t * new_state_count)
161 {
162 #pragma unused(exception_port, thread, task, exception, code, code_count, flavor, old_state, old_state_count, new_state, new_state_count)
163 	T_FAIL("Unsupported catch_mach_exception_raise_state_identity");
164 	return KERN_NOT_SUPPORTED;
165 }
166 
167 kern_return_t
catch_mach_exception_raise(mach_port_t exception_port,mach_port_t thread,mach_port_t task,exception_type_t exception,mach_exception_data_t code,mach_msg_type_number_t code_count)168 catch_mach_exception_raise(mach_port_t exception_port,
169     mach_port_t thread,
170     mach_port_t task,
171     exception_type_t exception,
172     mach_exception_data_t code,
173     mach_msg_type_number_t code_count)
174 {
175 #pragma unused(exception_port, thread, task, exception, code, code_count, flavor, old_state, old_state_count, new_state, new_state_count)
176 	T_FAIL("Unsupported catch_mach_exception_raise_state_identity");
177 	return KERN_NOT_SUPPORTED;
178 }
179 
180 static void *
exception_server_thread(void * arg)181 exception_server_thread(void *arg)
182 {
183 	kern_return_t kr;
184 	mach_port_t exc_port = *(mach_port_t *)arg;
185 
186 	/* Handle exceptions on exc_port */
187 	kr = mach_msg_server_once(mach_exc_server, 4096, exc_port, 0);
188 	T_QUIET; T_EXPECT_MACH_SUCCESS(kr, "mach_msg_server_once");
189 
190 	return NULL;
191 }
192 
193 static mach_port_t
alloc_exception_port(void)194 alloc_exception_port(void)
195 {
196 	kern_return_t kret;
197 	mach_port_t exc_port = MACH_PORT_NULL;
198 	mach_port_t task = mach_task_self();
199 
200 	kret = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &exc_port);
201 	T_QUIET; T_EXPECT_MACH_SUCCESS(kret, "mach_port_allocate exc_port");
202 
203 	kret = mach_port_insert_right(task, exc_port, exc_port, MACH_MSG_TYPE_MAKE_SEND);
204 	T_QUIET; T_EXPECT_MACH_SUCCESS(kret, "mach_port_insert_right exc_port");
205 
206 	return exc_port;
207 }
208 
209 static void
test_immovable_port_stashing(void)210 test_immovable_port_stashing(void)
211 {
212 	kern_return_t kr;
213 	mach_port_t port;
214 
215 	kr = task_set_special_port(mach_task_self(), TASK_BOOTSTRAP_PORT, mach_task_self());
216 	T_EXPECT_EQ(kr, KERN_INVALID_RIGHT, "should disallow task_set_special_port() with immovable port");
217 
218 	kr = thread_set_special_port(mach_thread_self(), THREAD_KERNEL_PORT, mach_thread_self());
219 	T_EXPECT_EQ(kr, KERN_INVALID_RIGHT, "should disallow task_set_special_port() with immovable port");
220 
221 	mach_port_t stash[1] = {mach_task_self()};
222 	kr = mach_ports_register(mach_task_self(), stash, 1);
223 	T_EXPECT_EQ(kr, KERN_INVALID_RIGHT, "should disallow mach_ports_register() with immovable port");
224 
225 	T_QUIET; T_ASSERT_MACH_SUCCESS(mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port), "mach_port_allocate");
226 	T_QUIET; T_ASSERT_MACH_SUCCESS(mach_port_insert_right(mach_task_self(), port, port, MACH_MSG_TYPE_MAKE_SEND), "mach_port_insert_right");
227 
228 	stash[0] = port;
229 	kr = mach_ports_register(mach_task_self(), stash, 1);
230 	T_EXPECT_MACH_SUCCESS(kr, "mach_ports_register() should succeed with movable port");
231 }
232 
233 static void
test_task_thread_port_values(void)234 test_task_thread_port_values(void)
235 {
236 	T_LOG("Compare various task/thread control port values\n");
237 	kern_return_t kr;
238 	mach_port_t port, th_self;
239 	thread_array_t threadList;
240 	mach_msg_type_number_t threadCount = 0;
241 	boolean_t found_self = false;
242 	processor_set_name_array_t psets;
243 	processor_set_t        pset_priv;
244 	task_array_t taskList;
245 	mach_msg_type_number_t pcnt = 0, tcnt = 0;
246 	mach_port_t host = mach_host_self();
247 
248 	/* Compare with task/thread_get_special_port() */
249 	kr = task_get_special_port(mach_task_self(), TASK_KERNEL_PORT, &port);
250 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "task_get_special_port() - TASK_KERNEL_PORT");
251 	T_EXPECT_NE(port, mach_task_self(), "TASK_KERNEL_PORT should not match mach_task_self()");
252 	mach_port_deallocate(mach_task_self(), port);
253 
254 	kr = task_for_pid(mach_task_self(), getpid(), &port);
255 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "task_for_pid()");
256 	T_EXPECT_EQ(port, mach_task_self(), "task_for_pid(self) should match mach_task_self()");
257 	mach_port_deallocate(mach_task_self(), port);
258 
259 	th_self = mach_thread_self();
260 	kr = thread_get_special_port(th_self, THREAD_KERNEL_PORT, &port);
261 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "thread_get_special_port() - THREAD_KERNEL_PORT");
262 	T_EXPECT_NE(port, th_self, "THREAD_KERNEL_PORT should not match mach_thread_self()");
263 	mach_port_deallocate(mach_task_self(), port);
264 
265 	/* Make sure task_threads() return immovable thread ports */
266 	kr = task_threads(mach_task_self(), &threadList, &threadCount);
267 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "task_threads()");
268 	T_QUIET; T_ASSERT_GE(threadCount, 1, "should have at least 1 thread");
269 
270 	for (size_t i = 0; i < threadCount; i++) {
271 		if (th_self == threadList[i]) { /* th_self is immovable */
272 			found_self = true;
273 			break;
274 		}
275 	}
276 
277 	T_EXPECT_TRUE(found_self, "task_threads() should return immovable thread self");
278 
279 	for (size_t i = 0; i < threadCount; i++) {
280 		mach_port_deallocate(mach_task_self(), threadList[i]);
281 	}
282 
283 	if (threadCount > 0) {
284 		mach_vm_deallocate(mach_task_self(),
285 		    (mach_vm_address_t)threadList,
286 		    threadCount * sizeof(mach_port_t));
287 	}
288 
289 	mach_port_deallocate(mach_task_self(), th_self);
290 
291 	/* Make sure processor_set_tasks() return immovable task self */
292 	kr = host_processor_sets(host, &psets, &pcnt);
293 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "host_processor_sets");
294 	T_QUIET; T_ASSERT_GE(pcnt, 1, "should have at least 1 processor set");
295 
296 	kr = host_processor_set_priv(host, psets[0], &pset_priv);
297 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "host_processor_set_priv");
298 	for (size_t i = 0; i < pcnt; i++) {
299 		mach_port_deallocate(mach_task_self(), psets[i]);
300 	}
301 	mach_port_deallocate(mach_task_self(), host);
302 	vm_deallocate(mach_task_self(), (vm_address_t)psets, (vm_size_t)pcnt * sizeof(mach_port_t));
303 
304 	kr = processor_set_tasks_with_flavor(pset_priv, TASK_FLAVOR_CONTROL, &taskList, &tcnt);
305 	T_QUIET; T_ASSERT_MACH_SUCCESS(kr, "processor_set_tasks_with_flavor");
306 	T_QUIET; T_ASSERT_GE(tcnt, 1, "should have at least 1 task");
307 	mach_port_deallocate(mach_task_self(), pset_priv);
308 
309 	found_self = false;
310 	for (size_t i = 0; i < tcnt; i++) {
311 		if (taskList[i] == mach_task_self()) {
312 			found_self = true;
313 			break;
314 		}
315 	}
316 
317 	T_EXPECT_TRUE(found_self, " processor_set_tasks() should return immovable task self");
318 
319 	for (size_t i = 0; i < tcnt; i++) {
320 		mach_port_deallocate(mach_task_self(), taskList[i]);
321 	}
322 
323 	if (tcnt > 0) {
324 		mach_vm_deallocate(mach_task_self(),
325 		    (mach_vm_address_t)taskList,
326 		    tcnt * sizeof(mach_port_t));
327 	}
328 }
329 
330 T_DECL(imm_pinned_control_port, "Test pinned & immovable task and thread control ports",
331     T_META_IGNORECRASHES(".*pinned_rights_child.*"),
332     T_META_CHECK_LEAKS(false))
333 {
334 	uint32_t task_exc_guard = 0;
335 	size_t te_size = sizeof(&task_exc_guard);
336 	posix_spawnattr_t       attrs;
337 	char *test_prog_name = "./imm_pinned_control_port_crasher";
338 	char *child_args[MAX_ARGV];
339 	pid_t client_pid = 0;
340 	uint32_t opts = 0;
341 	uint64_t *test_exception_code;
342 	size_t size = sizeof(&opts);
343 	mach_port_t exc_port;
344 	pthread_t s_exc_thread;
345 	uint64_t exc_id;
346 
347 	T_LOG("Check if task_exc_guard exception has been enabled\n");
348 	int ret = sysctlbyname("kern.task_exc_guard_default", &task_exc_guard, &te_size, NULL, 0);
349 	T_ASSERT_EQ(ret, 0, "sysctlbyname");
350 
351 	if (!(task_exc_guard & TASK_EXC_GUARD_MP_DELIVER)) {
352 		T_SKIP("task_exc_guard exception is not enabled");
353 	}
354 
355 	T_LOG("Check if immovable control port has been enabled\n");
356 	ret = sysctlbyname("kern.ipc_control_port_options", &opts, &size, NULL, 0);
357 
358 	if (!ret && (opts & 0x8) != 0x8) {
359 		T_SKIP("hard immovable control port isn't enabled");
360 	}
361 
362 	if (!ret && (opts & 0x2)) {
363 		T_LOG("Hard pinning enforcement is on.");
364 		test_exception_code = hard_exception_code;
365 	} else {
366 		T_LOG("Hard pinning enforcement is off.");
367 		test_exception_code = soft_exception_code;
368 	}
369 
370 
371 	/* first, try out comparing various task/thread ports */
372 	test_task_thread_port_values();
373 
374 	/* try stashing immovable ports: rdar://70585367 */
375 	test_immovable_port_stashing();
376 
377 	/* spawn a child and see if EXC_GUARD are correctly generated */
378 	for (int i = 0; i < MAX_TEST_NUM; i++) {
379 		/* Create the exception port for the child */
380 		exc_port = alloc_exception_port();
381 		T_QUIET; T_ASSERT_NE(exc_port, MACH_PORT_NULL, "Create a new exception port");
382 
383 		/* Create exception serving thread */
384 		ret = pthread_create(&s_exc_thread, NULL, exception_server_thread, &exc_port);
385 		T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "pthread_create exception_server_thread");
386 
387 		/* Initialize posix_spawn attributes */
388 		posix_spawnattr_init(&attrs);
389 
390 		int err = posix_spawnattr_setexceptionports_np(&attrs, EXC_MASK_GUARD | EXC_MASK_CORPSE_NOTIFY, exc_port,
391 		    (exception_behavior_t) (EXCEPTION_IDENTITY_PROTECTED | MACH_EXCEPTION_CODES), 0);
392 		T_QUIET; T_ASSERT_POSIX_SUCCESS(err, "posix_spawnattr_setflags");
393 
394 		child_args[0] = test_prog_name;
395 		char test_num[10];
396 		sprintf(test_num, "%d", i);
397 		child_args[1] = test_num;
398 		child_args[2] = NULL;
399 
400 		T_LOG("========== Spawning new child ==========");
401 		err = posix_spawn(&client_pid, child_args[0], NULL, &attrs, &child_args[0], environ);
402 		T_ASSERT_POSIX_SUCCESS(err, "posix_spawn control_port_options_client = %d test_num = %d", client_pid, i);
403 
404 		/* try extracting child task port: rdar://71744817
405 		 * Moved to tests/extract_right_soft_fail.c
406 		 */
407 		// test_extract_immovable_task_port(client_pid);
408 
409 		int child_status;
410 		/* Wait for child and check for exception */
411 		if (-1 == waitpid(-1, &child_status, 0)) {
412 			T_FAIL("waitpid: child mia");
413 		}
414 
415 		if (WIFEXITED(child_status) && WEXITSTATUS(child_status)) {
416 			T_FAIL("Child exited with status = %x", child_status);
417 			T_END;
418 		}
419 
420 		sleep(1);
421 		kill(1, SIGKILL);
422 
423 		ret = pthread_join(s_exc_thread, NULL);
424 		T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "pthread_join");
425 
426 		if (exception_taken == EXC_GUARD) {
427 			exc_id = exception_code >> EXC_CODE_SHIFT;
428 		} else {
429 			exc_id = exception_code;
430 		}
431 
432 		T_LOG("Exception code: Received code = 0x%llx Expected code = 0x%llx", exc_id, test_exception_code[i]);
433 		T_EXPECT_EQ(exc_id, test_exception_code[i], "Exception code: Received == Expected");
434 	}
435 }
436