1 // SPDX-License-Identifier: GPL-2.0-only
3 * KUnit tests for AppArmor's policy unpack.
6 #include <kunit/test.h>
8 #include "include/policy.h"
9 #include "include/policy_unpack.h"
11 #define TEST_STRING_NAME "TEST_STRING"
12 #define TEST_STRING_DATA "testing"
13 #define TEST_STRING_BUF_OFFSET \
14 (3 + strlen(TEST_STRING_NAME) + 1)
16 #define TEST_U32_NAME "U32_TEST"
17 #define TEST_U32_DATA ((u32)0x01020304)
18 #define TEST_NAMED_U32_BUF_OFFSET \
19 (TEST_STRING_BUF_OFFSET + 3 + strlen(TEST_STRING_DATA) + 1)
20 #define TEST_U32_BUF_OFFSET \
21 (TEST_NAMED_U32_BUF_OFFSET + 3 + strlen(TEST_U32_NAME) + 1)
23 #define TEST_U16_OFFSET (TEST_U32_BUF_OFFSET + 3)
24 #define TEST_U16_DATA ((u16)(TEST_U32_DATA >> 16))
26 #define TEST_U64_NAME "U64_TEST"
27 #define TEST_U64_DATA ((u64)0x0102030405060708)
28 #define TEST_NAMED_U64_BUF_OFFSET (TEST_U32_BUF_OFFSET + sizeof(u32) + 1)
29 #define TEST_U64_BUF_OFFSET \
30 (TEST_NAMED_U64_BUF_OFFSET + 3 + strlen(TEST_U64_NAME) + 1)
32 #define TEST_BLOB_NAME "BLOB_TEST"
33 #define TEST_BLOB_DATA "\xde\xad\x00\xbe\xef"
34 #define TEST_BLOB_DATA_SIZE (ARRAY_SIZE(TEST_BLOB_DATA))
35 #define TEST_NAMED_BLOB_BUF_OFFSET (TEST_U64_BUF_OFFSET + sizeof(u64) + 1)
36 #define TEST_BLOB_BUF_OFFSET \
37 (TEST_NAMED_BLOB_BUF_OFFSET + 3 + strlen(TEST_BLOB_NAME) + 1)
39 #define TEST_ARRAY_NAME "ARRAY_TEST"
40 #define TEST_ARRAY_SIZE 16
41 #define TEST_NAMED_ARRAY_BUF_OFFSET \
42 (TEST_BLOB_BUF_OFFSET + 5 + TEST_BLOB_DATA_SIZE)
43 #define TEST_ARRAY_BUF_OFFSET \
44 (TEST_NAMED_ARRAY_BUF_OFFSET + 3 + strlen(TEST_ARRAY_NAME) + 1)
46 struct policy_unpack_fixture {
51 struct aa_ext *build_aa_ext_struct(struct policy_unpack_fixture *puf,
52 struct kunit *test, size_t buf_size)
57 buf = kunit_kzalloc(test, buf_size, GFP_USER);
58 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, buf);
60 e = kunit_kmalloc(test, sizeof(*e), GFP_USER);
61 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, e);
64 e->end = e->start + buf_size;
68 *(buf + 1) = strlen(TEST_STRING_NAME) + 1;
69 strcpy(buf + 3, TEST_STRING_NAME);
71 buf = e->start + TEST_STRING_BUF_OFFSET;
73 *(buf + 1) = strlen(TEST_STRING_DATA) + 1;
74 strcpy(buf + 3, TEST_STRING_DATA);
76 buf = e->start + TEST_NAMED_U32_BUF_OFFSET;
78 *(buf + 1) = strlen(TEST_U32_NAME) + 1;
79 strcpy(buf + 3, TEST_U32_NAME);
80 *(buf + 3 + strlen(TEST_U32_NAME) + 1) = AA_U32;
81 *((u32 *)(buf + 3 + strlen(TEST_U32_NAME) + 2)) = TEST_U32_DATA;
83 buf = e->start + TEST_NAMED_U64_BUF_OFFSET;
85 *(buf + 1) = strlen(TEST_U64_NAME) + 1;
86 strcpy(buf + 3, TEST_U64_NAME);
87 *(buf + 3 + strlen(TEST_U64_NAME) + 1) = AA_U64;
88 *((u64 *)(buf + 3 + strlen(TEST_U64_NAME) + 2)) = TEST_U64_DATA;
90 buf = e->start + TEST_NAMED_BLOB_BUF_OFFSET;
92 *(buf + 1) = strlen(TEST_BLOB_NAME) + 1;
93 strcpy(buf + 3, TEST_BLOB_NAME);
94 *(buf + 3 + strlen(TEST_BLOB_NAME) + 1) = AA_BLOB;
95 *(buf + 3 + strlen(TEST_BLOB_NAME) + 2) = TEST_BLOB_DATA_SIZE;
96 memcpy(buf + 3 + strlen(TEST_BLOB_NAME) + 6,
97 TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE);
99 buf = e->start + TEST_NAMED_ARRAY_BUF_OFFSET;
101 *(buf + 1) = strlen(TEST_ARRAY_NAME) + 1;
102 strcpy(buf + 3, TEST_ARRAY_NAME);
103 *(buf + 3 + strlen(TEST_ARRAY_NAME) + 1) = AA_ARRAY;
104 *((u16 *)(buf + 3 + strlen(TEST_ARRAY_NAME) + 2)) = TEST_ARRAY_SIZE;
109 static int policy_unpack_test_init(struct kunit *test)
111 size_t e_size = TEST_ARRAY_BUF_OFFSET + sizeof(u16) + 1;
112 struct policy_unpack_fixture *puf;
114 puf = kunit_kmalloc(test, sizeof(*puf), GFP_USER);
115 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, puf);
117 puf->e_size = e_size;
118 puf->e = build_aa_ext_struct(puf, test, e_size);
124 static void policy_unpack_test_inbounds_when_inbounds(struct kunit *test)
126 struct policy_unpack_fixture *puf = test->priv;
128 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, 0));
129 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, puf->e_size / 2));
130 KUNIT_EXPECT_TRUE(test, inbounds(puf->e, puf->e_size));
133 static void policy_unpack_test_inbounds_when_out_of_bounds(struct kunit *test)
135 struct policy_unpack_fixture *puf = test->priv;
137 KUNIT_EXPECT_FALSE(test, inbounds(puf->e, puf->e_size + 1));
140 static void policy_unpack_test_unpack_array_with_null_name(struct kunit *test)
142 struct policy_unpack_fixture *puf = test->priv;
145 puf->e->pos += TEST_ARRAY_BUF_OFFSET;
147 array_size = unpack_array(puf->e, NULL);
149 KUNIT_EXPECT_EQ(test, array_size, (u16)TEST_ARRAY_SIZE);
150 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
151 puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16) + 1);
154 static void policy_unpack_test_unpack_array_with_name(struct kunit *test)
156 struct policy_unpack_fixture *puf = test->priv;
157 const char name[] = TEST_ARRAY_NAME;
160 puf->e->pos += TEST_NAMED_ARRAY_BUF_OFFSET;
162 array_size = unpack_array(puf->e, name);
164 KUNIT_EXPECT_EQ(test, array_size, (u16)TEST_ARRAY_SIZE);
165 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
166 puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16) + 1);
169 static void policy_unpack_test_unpack_array_out_of_bounds(struct kunit *test)
171 struct policy_unpack_fixture *puf = test->priv;
172 const char name[] = TEST_ARRAY_NAME;
175 puf->e->pos += TEST_NAMED_ARRAY_BUF_OFFSET;
176 puf->e->end = puf->e->start + TEST_ARRAY_BUF_OFFSET + sizeof(u16);
178 array_size = unpack_array(puf->e, name);
180 KUNIT_EXPECT_EQ(test, array_size, (u16)0);
181 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
182 puf->e->start + TEST_NAMED_ARRAY_BUF_OFFSET);
185 static void policy_unpack_test_unpack_blob_with_null_name(struct kunit *test)
187 struct policy_unpack_fixture *puf = test->priv;
191 puf->e->pos += TEST_BLOB_BUF_OFFSET;
192 size = unpack_blob(puf->e, &blob, NULL);
194 KUNIT_ASSERT_EQ(test, size, TEST_BLOB_DATA_SIZE);
195 KUNIT_EXPECT_TRUE(test,
196 memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
199 static void policy_unpack_test_unpack_blob_with_name(struct kunit *test)
201 struct policy_unpack_fixture *puf = test->priv;
205 puf->e->pos += TEST_NAMED_BLOB_BUF_OFFSET;
206 size = unpack_blob(puf->e, &blob, TEST_BLOB_NAME);
208 KUNIT_ASSERT_EQ(test, size, TEST_BLOB_DATA_SIZE);
209 KUNIT_EXPECT_TRUE(test,
210 memcmp(blob, TEST_BLOB_DATA, TEST_BLOB_DATA_SIZE) == 0);
213 static void policy_unpack_test_unpack_blob_out_of_bounds(struct kunit *test)
215 struct policy_unpack_fixture *puf = test->priv;
220 puf->e->pos += TEST_NAMED_BLOB_BUF_OFFSET;
222 puf->e->end = puf->e->start + TEST_BLOB_BUF_OFFSET
223 + TEST_BLOB_DATA_SIZE - 1;
225 size = unpack_blob(puf->e, &blob, TEST_BLOB_NAME);
227 KUNIT_EXPECT_EQ(test, size, 0);
228 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);
231 static void policy_unpack_test_unpack_str_with_null_name(struct kunit *test)
233 struct policy_unpack_fixture *puf = test->priv;
234 const char *string = NULL;
237 puf->e->pos += TEST_STRING_BUF_OFFSET;
238 size = unpack_str(puf->e, &string, NULL);
240 KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) + 1);
241 KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);
244 static void policy_unpack_test_unpack_str_with_name(struct kunit *test)
246 struct policy_unpack_fixture *puf = test->priv;
247 const char *string = NULL;
250 size = unpack_str(puf->e, &string, TEST_STRING_NAME);
252 KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) + 1);
253 KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);
256 static void policy_unpack_test_unpack_str_out_of_bounds(struct kunit *test)
258 struct policy_unpack_fixture *puf = test->priv;
259 const char *string = NULL;
260 void *start = puf->e->pos;
263 puf->e->end = puf->e->pos + TEST_STRING_BUF_OFFSET
264 + strlen(TEST_STRING_DATA) - 1;
266 size = unpack_str(puf->e, &string, TEST_STRING_NAME);
268 KUNIT_EXPECT_EQ(test, size, 0);
269 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);
272 static void policy_unpack_test_unpack_strdup_with_null_name(struct kunit *test)
274 struct policy_unpack_fixture *puf = test->priv;
278 puf->e->pos += TEST_STRING_BUF_OFFSET;
279 size = unpack_strdup(puf->e, &string, NULL);
281 KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) + 1);
282 KUNIT_EXPECT_FALSE(test,
283 ((uintptr_t)puf->e->start <= (uintptr_t)string)
284 && ((uintptr_t)string <= (uintptr_t)puf->e->end));
285 KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);
288 static void policy_unpack_test_unpack_strdup_with_name(struct kunit *test)
290 struct policy_unpack_fixture *puf = test->priv;
294 size = unpack_strdup(puf->e, &string, TEST_STRING_NAME);
296 KUNIT_EXPECT_EQ(test, size, strlen(TEST_STRING_DATA) + 1);
297 KUNIT_EXPECT_FALSE(test,
298 ((uintptr_t)puf->e->start <= (uintptr_t)string)
299 && ((uintptr_t)string <= (uintptr_t)puf->e->end));
300 KUNIT_EXPECT_STREQ(test, string, TEST_STRING_DATA);
303 static void policy_unpack_test_unpack_strdup_out_of_bounds(struct kunit *test)
305 struct policy_unpack_fixture *puf = test->priv;
306 void *start = puf->e->pos;
310 puf->e->end = puf->e->pos + TEST_STRING_BUF_OFFSET
311 + strlen(TEST_STRING_DATA) - 1;
313 size = unpack_strdup(puf->e, &string, TEST_STRING_NAME);
315 KUNIT_EXPECT_EQ(test, size, 0);
316 KUNIT_EXPECT_PTR_EQ(test, string, (char *)NULL);
317 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, start);
320 static void policy_unpack_test_unpack_nameX_with_null_name(struct kunit *test)
322 struct policy_unpack_fixture *puf = test->priv;
325 puf->e->pos += TEST_U32_BUF_OFFSET;
327 success = unpack_nameX(puf->e, AA_U32, NULL);
329 KUNIT_EXPECT_TRUE(test, success);
330 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
331 puf->e->start + TEST_U32_BUF_OFFSET + 1);
334 static void policy_unpack_test_unpack_nameX_with_wrong_code(struct kunit *test)
336 struct policy_unpack_fixture *puf = test->priv;
339 puf->e->pos += TEST_U32_BUF_OFFSET;
341 success = unpack_nameX(puf->e, AA_BLOB, NULL);
343 KUNIT_EXPECT_FALSE(test, success);
344 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
345 puf->e->start + TEST_U32_BUF_OFFSET);
348 static void policy_unpack_test_unpack_nameX_with_name(struct kunit *test)
350 struct policy_unpack_fixture *puf = test->priv;
351 const char name[] = TEST_U32_NAME;
354 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
356 success = unpack_nameX(puf->e, AA_U32, name);
358 KUNIT_EXPECT_TRUE(test, success);
359 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
360 puf->e->start + TEST_U32_BUF_OFFSET + 1);
363 static void policy_unpack_test_unpack_nameX_with_wrong_name(struct kunit *test)
365 struct policy_unpack_fixture *puf = test->priv;
366 static const char name[] = "12345678";
369 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
371 success = unpack_nameX(puf->e, AA_U32, name);
373 KUNIT_EXPECT_FALSE(test, success);
374 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
375 puf->e->start + TEST_NAMED_U32_BUF_OFFSET);
378 static void policy_unpack_test_unpack_u16_chunk_basic(struct kunit *test)
380 struct policy_unpack_fixture *puf = test->priv;
384 puf->e->pos += TEST_U16_OFFSET;
386 * WARNING: For unit testing purposes, we're pushing puf->e->end past
387 * the end of the allocated memory. Doing anything other than comparing
388 * memory addresses is dangerous.
390 puf->e->end += TEST_U16_DATA;
392 size = unpack_u16_chunk(puf->e, &chunk);
394 KUNIT_EXPECT_PTR_EQ(test, (void *)chunk,
395 puf->e->start + TEST_U16_OFFSET + 2);
396 KUNIT_EXPECT_EQ(test, size, (size_t)TEST_U16_DATA);
397 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, (void *)(chunk + TEST_U16_DATA));
400 static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_1(
403 struct policy_unpack_fixture *puf = test->priv;
407 puf->e->pos = puf->e->end - 1;
409 size = unpack_u16_chunk(puf->e, &chunk);
411 KUNIT_EXPECT_EQ(test, size, (size_t)0);
412 KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
413 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->end - 1);
416 static void policy_unpack_test_unpack_u16_chunk_out_of_bounds_2(
419 struct policy_unpack_fixture *puf = test->priv;
423 puf->e->pos += TEST_U16_OFFSET;
425 * WARNING: For unit testing purposes, we're pushing puf->e->end past
426 * the end of the allocated memory. Doing anything other than comparing
427 * memory addresses is dangerous.
429 puf->e->end = puf->e->pos + TEST_U16_DATA - 1;
431 size = unpack_u16_chunk(puf->e, &chunk);
433 KUNIT_EXPECT_EQ(test, size, (size_t)0);
434 KUNIT_EXPECT_PTR_EQ(test, chunk, (char *)NULL);
435 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos, puf->e->start + TEST_U16_OFFSET);
438 static void policy_unpack_test_unpack_u32_with_null_name(struct kunit *test)
440 struct policy_unpack_fixture *puf = test->priv;
444 puf->e->pos += TEST_U32_BUF_OFFSET;
446 success = unpack_u32(puf->e, &data, NULL);
448 KUNIT_EXPECT_TRUE(test, success);
449 KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
450 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
451 puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
454 static void policy_unpack_test_unpack_u32_with_name(struct kunit *test)
456 struct policy_unpack_fixture *puf = test->priv;
457 const char name[] = TEST_U32_NAME;
461 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
463 success = unpack_u32(puf->e, &data, name);
465 KUNIT_EXPECT_TRUE(test, success);
466 KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
467 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
468 puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
471 static void policy_unpack_test_unpack_u32_out_of_bounds(struct kunit *test)
473 struct policy_unpack_fixture *puf = test->priv;
474 const char name[] = TEST_U32_NAME;
478 puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
479 puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32);
481 success = unpack_u32(puf->e, &data, name);
483 KUNIT_EXPECT_FALSE(test, success);
484 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
485 puf->e->start + TEST_NAMED_U32_BUF_OFFSET);
488 static void policy_unpack_test_unpack_u64_with_null_name(struct kunit *test)
490 struct policy_unpack_fixture *puf = test->priv;
494 puf->e->pos += TEST_U64_BUF_OFFSET;
496 success = unpack_u64(puf->e, &data, NULL);
498 KUNIT_EXPECT_TRUE(test, success);
499 KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
500 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
501 puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
504 static void policy_unpack_test_unpack_u64_with_name(struct kunit *test)
506 struct policy_unpack_fixture *puf = test->priv;
507 const char name[] = TEST_U64_NAME;
511 puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
513 success = unpack_u64(puf->e, &data, name);
515 KUNIT_EXPECT_TRUE(test, success);
516 KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
517 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
518 puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
521 static void policy_unpack_test_unpack_u64_out_of_bounds(struct kunit *test)
523 struct policy_unpack_fixture *puf = test->priv;
524 const char name[] = TEST_U64_NAME;
528 puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
529 puf->e->end = puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64);
531 success = unpack_u64(puf->e, &data, name);
533 KUNIT_EXPECT_FALSE(test, success);
534 KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
535 puf->e->start + TEST_NAMED_U64_BUF_OFFSET);
538 static void policy_unpack_test_unpack_X_code_match(struct kunit *test)
540 struct policy_unpack_fixture *puf = test->priv;
541 bool success = unpack_X(puf->e, AA_NAME);
543 KUNIT_EXPECT_TRUE(test, success);
544 KUNIT_EXPECT_TRUE(test, puf->e->pos == puf->e->start + 1);
547 static void policy_unpack_test_unpack_X_code_mismatch(struct kunit *test)
549 struct policy_unpack_fixture *puf = test->priv;
550 bool success = unpack_X(puf->e, AA_STRING);
552 KUNIT_EXPECT_FALSE(test, success);
553 KUNIT_EXPECT_TRUE(test, puf->e->pos == puf->e->start);
556 static void policy_unpack_test_unpack_X_out_of_bounds(struct kunit *test)
558 struct policy_unpack_fixture *puf = test->priv;
561 puf->e->pos = puf->e->end;
562 success = unpack_X(puf->e, AA_NAME);
564 KUNIT_EXPECT_FALSE(test, success);
567 static struct kunit_case apparmor_policy_unpack_test_cases[] = {
568 KUNIT_CASE(policy_unpack_test_inbounds_when_inbounds),
569 KUNIT_CASE(policy_unpack_test_inbounds_when_out_of_bounds),
570 KUNIT_CASE(policy_unpack_test_unpack_array_with_null_name),
571 KUNIT_CASE(policy_unpack_test_unpack_array_with_name),
572 KUNIT_CASE(policy_unpack_test_unpack_array_out_of_bounds),
573 KUNIT_CASE(policy_unpack_test_unpack_blob_with_null_name),
574 KUNIT_CASE(policy_unpack_test_unpack_blob_with_name),
575 KUNIT_CASE(policy_unpack_test_unpack_blob_out_of_bounds),
576 KUNIT_CASE(policy_unpack_test_unpack_nameX_with_null_name),
577 KUNIT_CASE(policy_unpack_test_unpack_nameX_with_wrong_code),
578 KUNIT_CASE(policy_unpack_test_unpack_nameX_with_name),
579 KUNIT_CASE(policy_unpack_test_unpack_nameX_with_wrong_name),
580 KUNIT_CASE(policy_unpack_test_unpack_str_with_null_name),
581 KUNIT_CASE(policy_unpack_test_unpack_str_with_name),
582 KUNIT_CASE(policy_unpack_test_unpack_str_out_of_bounds),
583 KUNIT_CASE(policy_unpack_test_unpack_strdup_with_null_name),
584 KUNIT_CASE(policy_unpack_test_unpack_strdup_with_name),
585 KUNIT_CASE(policy_unpack_test_unpack_strdup_out_of_bounds),
586 KUNIT_CASE(policy_unpack_test_unpack_u16_chunk_basic),
587 KUNIT_CASE(policy_unpack_test_unpack_u16_chunk_out_of_bounds_1),
588 KUNIT_CASE(policy_unpack_test_unpack_u16_chunk_out_of_bounds_2),
589 KUNIT_CASE(policy_unpack_test_unpack_u32_with_null_name),
590 KUNIT_CASE(policy_unpack_test_unpack_u32_with_name),
591 KUNIT_CASE(policy_unpack_test_unpack_u32_out_of_bounds),
592 KUNIT_CASE(policy_unpack_test_unpack_u64_with_null_name),
593 KUNIT_CASE(policy_unpack_test_unpack_u64_with_name),
594 KUNIT_CASE(policy_unpack_test_unpack_u64_out_of_bounds),
595 KUNIT_CASE(policy_unpack_test_unpack_X_code_match),
596 KUNIT_CASE(policy_unpack_test_unpack_X_code_mismatch),
597 KUNIT_CASE(policy_unpack_test_unpack_X_out_of_bounds),
601 static struct kunit_suite apparmor_policy_unpack_test_module = {
602 .name = "apparmor_policy_unpack",
603 .init = policy_unpack_test_init,
604 .test_cases = apparmor_policy_unpack_test_cases,
607 kunit_test_suite(apparmor_policy_unpack_test_module);