Lines Matching +full:use +full:- +full:case
1 // SPDX-License-Identifier: GPL-2.0
4 * For each test case checks the presence (or absence) of generated reports.
8 * Copyright (C) 2021-2022, Google LLC.
53 * The provided @buf is not NUL-terminated; copy no more than in probe_console()
54 * @len bytes and let strscpy() add the missing NUL-terminator. in probe_console()
100 /* Doubled-checked locking. */ in report_matches()
101 if (!report_available() || !r->symbol) in report_matches()
102 return (!report_available() && !r->symbol); in report_matches()
108 end = &expected_header[sizeof(expected_header) - 1]; in report_matches()
110 cur += scnprintf(cur, end - cur, "BUG: KMSAN: %s", r->error_type); in report_matches()
112 scnprintf(cur, end - cur, " in %s", r->symbol); in report_matches()
143 #define USE(x) \ macro
159 EXPECTATION_ETYPE_FN(e, "uninit-value", fn)
162 EXPECTATION_ETYPE_FN(e, "use-after-free", __func__)
164 /* Test case: ensure that kmalloc() returns uninitialized memory. */
172 USE(*ptr); in test_uninit_kmalloc()
177 * Test case: ensure that kmalloc'ed memory becomes initialized after memset().
187 USE(*ptr); in test_init_kmalloc()
191 /* Test case: ensure that kzalloc() returns initialized memory. */
199 USE(*ptr); in test_init_kzalloc()
203 /* Test case: ensure that local variables are uninitialized by default. */
210 USE(cond); in test_uninit_stack_var()
214 /* Test case: ensure that local variables with initializers are initialized. */
221 USE(cond); in test_init_stack_var()
227 USE(arg1); in two_param_fn_2()
228 USE(arg2); in two_param_fn_2()
234 USE(arg); in one_param_fn()
242 USE(arg1); in two_param_fn()
243 USE(arg2); in two_param_fn()
271 * Test case: ensure that uninitialized values are tracked through function
281 USE(signed_sum3(a, b, c)); in test_uninit_multiple_params()
295 * Test case: ensure kmsan_check_memory() reports an error when checking
313 * Test case: check that a virtual memory range created with vmap() from
344 * Test case: ensure that memset() can initialize a buffer allocated via
357 USE(buf[0]); in test_init_vmalloc()
364 /* Test case: ensure that use-after-free reporting works. */
371 kunit_info(test, "use-after-free in kmalloc-ed buffer (UMR report)\n"); in test_uaf()
377 USE(value); in test_uaf()
382 * Test case: ensure that uninitialized values are propagated through per-CPU
395 USE(check); in test_percpu_propagate()
400 * Test case: ensure that passing uninitialized values to printk() leads to an
428 /* Test case: ensure that memcpy() correctly copies initialized values. */
445 * Test case: ensure that memcpy() correctly copies uninitialized values between
463 * Test case: ensure that memcpy() correctly copies uninitialized values between
466 * Copying aligned 4-byte value to an unaligned one leads to touching two
467 * aligned 4-byte values. This test case checks that KMSAN correctly reports an
490 * Test case: ensure that origin slots do not accidentally get overwritten with
519 "unaligned 4-byte initialized value gets a nonzero origin after memcpy() - (2 UMR reports)\n"); in test_memcpy_initialized_gap()
563 array[start] = array[start - 1] + array[start - 2]; in fibonacci()
572 int last = ARRAY_SIZE(accum) - 1; in test_long_origin_chain()
588 * Test case: ensure that saving/restoring/printing stacks to/from stackdepot
618 * Test case: ensure that kmsan_unpoison_memory() and the instrumentation work
630 /* Initialize a[0] and check a[1]--a[3]. */ in test_unpoison_memory()
637 /* Initialize b[0] and check b[1]--b[3]. */ in test_unpoison_memory()