diff options
| author | Kees Cook <kees@kernel.org> | 2025-04-26 17:21:01 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2025-05-08 09:42:40 -0700 |
| commit | b370f7eacdcfe1dd17bee00506296aa3fdc773cb (patch) | |
| tree | f1ef8051b43d1eed8b0d215175040e1708f2265b /lib/Kconfig.debug | |
| parent | e136a4062174a9a8d1c1447ca040ea81accfa6a8 (diff) | |
lib/tests: Add randstruct KUnit test
Perform basic validation about layout randomization and initialization
tracking when using CONFIG_RANDSTRUCT=y. Tested using:
$ ./tools/testing/kunit/kunit.py run \
--kconfig_add CONFIG_RANDSTRUCT_FULL=y \
randstruct
[17:22:30] ================= randstruct (2 subtests) ==================
[17:22:30] [PASSED] randstruct_layout
[17:22:30] [PASSED] randstruct_initializers
[17:22:30] =================== [PASSED] randstruct ====================
[17:22:30] ============================================================
[17:22:30] Testing complete. Ran 2 tests: passed: 2
[17:22:30] Elapsed time: 5.091s total, 0.001s configuring, 4.974s building, 0.086s running
Adding "--make_option LLVM=1" can be used to test Clang, which also
passes.
Acked-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'lib/Kconfig.debug')
| -rw-r--r-- | lib/Kconfig.debug | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f9051ab610d5..6479cec900c7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2863,6 +2863,14 @@ config OVERFLOW_KUNIT_TEST If unsure, say N. +config RANDSTRUCT_KUNIT_TEST + tristate "Test randstruct structure layout randomization at runtime" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Builds unit tests for the checking CONFIG_RANDSTRUCT=y, which + randomizes structure layouts. + config STACKINIT_KUNIT_TEST tristate "Test level of stack variable initialization" if !KUNIT_ALL_TESTS depends on KUNIT |