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()
89 /* Doubled-checked locking. */ in report_matches()
90 if (!report_available() || !r->symbol) in report_matches()
91 return (!report_available() && !r->symbol); in report_matches()
97 end = &expected_header[sizeof(expected_header) - 1]; in report_matches()
99 cur += scnprintf(cur, end - cur, "BUG: KMSAN: %s", r->error_type); in report_matches()
101 scnprintf(cur, end - cur, " in %s", r->symbol); in report_matches()
132 #define USE(x) \ macro
148 EXPECTATION_ETYPE_FN(e, "uninit-value", fn)
151 EXPECTATION_ETYPE_FN(e, "use-after-free", __func__)
153 /* Test case: ensure that kmalloc() returns uninitialized memory. */
161 USE(*ptr); in test_uninit_kmalloc()
166 * Test case: ensure that kmalloc'ed memory becomes initialized after memset().
176 USE(*ptr); in test_init_kmalloc()
180 /* Test case: ensure that kzalloc() returns initialized memory. */
188 USE(*ptr); in test_init_kzalloc()
192 /* Test case: ensure that local variables are uninitialized by default. */
199 USE(cond); in test_uninit_stack_var()
203 /* Test case: ensure that local variables with initializers are initialized. */
210 USE(cond); in test_init_stack_var()
216 USE(arg1); in two_param_fn_2()
217 USE(arg2); in two_param_fn_2()
223 USE(arg); in one_param_fn()
231 USE(arg1); in two_param_fn()
232 USE(arg2); in two_param_fn()
260 * Test case: ensure that uninitialized values are tracked through function
270 USE(signed_sum3(a, b, c)); in test_uninit_multiple_params()
284 * Test case: ensure kmsan_check_memory() reports an error when checking
302 * Test case: check that a virtual memory range created with vmap() from
333 * Test case: ensure that memset() can initialize a buffer allocated via
346 USE(buf[0]); in test_init_vmalloc()
353 /* Test case: ensure that use-after-free reporting works. */
360 kunit_info(test, "use-after-free in kmalloc-ed buffer (UMR report)\n"); in test_uaf()
366 USE(value); in test_uaf()
371 * Test case: ensure that uninitialized values are propagated through per-CPU
384 USE(check); in test_percpu_propagate()
389 * Test case: ensure that passing uninitialized values to printk() leads to an
412 * notice that @var is uninitialized and drop memcpy() calls that use it.
414 * There is OPTIMIZER_HIDE_VAR() in linux/compier.h that we cannot use here,
421 * Test case: ensure that memcpy() correctly copies initialized values.
442 * Test case: ensure that memcpy() correctly copies uninitialized values between
461 * Test case: ensure that memcpy() correctly copies uninitialized values between
464 * Copying aligned 4-byte value to an unaligned one leads to touching two
465 * aligned 4-byte values. This test case checks that KMSAN correctly reports an
484 * Test case: ensure that memcpy() correctly copies uninitialized values between
487 * Copying aligned 4-byte value to an unaligned one leads to touching two
488 * aligned 4-byte values. This test case checks that KMSAN correctly reports an
500 "memcpy()ing aligned uninit src to unaligned dst - part 2 (UMR report)\n"); in test_memcpy_aligned_to_unaligned2()
530 array[start] = array[start - 1] + array[start - 2]; in fibonacci()
539 int last = ARRAY_SIZE(accum) - 1; in test_long_origin_chain()
555 * Test case: ensure that saving/restoring/printing stacks to/from stackdepot