Skip to content
Permalink
Browse files
kfence: add test suite
Add KFENCE test suite, testing various error detection scenarios. Makes
use of KUnit for test organization. Since KFENCE's interface to obtain
error reports is via the console, the test verifies that KFENCE outputs
expected reports to the console.

Co-developed-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Marco Elver <elver@google.com>
  • Loading branch information
melver authored and intel-lab-lkp committed Sep 15, 2020
1 parent edfc744 commit e52f64e8d3cbfe2423913871780cf012b2abeb21
Show file tree
Hide file tree
Showing 3 changed files with 793 additions and 0 deletions.
@@ -62,4 +62,17 @@ config KFENCE_STRESS_TEST_FAULTS

The option is only to test KFENCE; set to 0 if you are unsure.

config KFENCE_KUNIT_TEST
tristate "KFENCE integration test suite" if !KUNIT_ALL_TESTS
default KUNIT_ALL_TESTS
depends on TRACEPOINTS && KUNIT
help
Test suite for KFENCE, testing various error detection scenarios with
various allocation types, and checking that reports are correctly
output to console.

Say Y here if you want the test to be built into the kernel and run
during boot; say M if you want the test to build as a module; say N
if you are unsure.

endif # KFENCE
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_KFENCE) := core.o report.o

CFLAGS_kfence_test.o := -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
obj-$(CONFIG_KFENCE_KUNIT_TEST) += kfence_test.o

0 comments on commit e52f64e

Please sign in to comment.