This patchset contains everything needed to integrate KASAN and KUnit.
KUnit will be able to: (1) Fail tests when an unexpected KASAN error occurs (2) Pass tests when an expected KASAN error occurs
KASAN Tests have been converted to KUnit with the exception of copy_user_test because KUnit is unable to test those. I am working on documentation on how to use these new tests to be included in the next version of this patchset.
Changes since v1: - Make use of Alan Maguire's suggestion to use his patch that allows static resources for integration instead of adding a new attribute to the kunit struct - All KUNIT_EXPECT_KASAN_FAIL statements are local to each test - The definition of KUNIT_EXPECT_KASAN_FAIL is local to the test_kasan.c file since it seems this is the only place this will be used. - Integration relies on KUnit being builtin - copy_user_test has been separated into its own file since KUnit is unable to test these. This can be run as a module just as before, using CONFIG_TEST_KASAN_USER - The addition to the current task has been separated into its own patch as this is a significant enough change to be on its own.
Patricia Alfonso (3): Add KUnit Struct to Current Task KUnit: KASAN Integration KASAN: Port KASAN Tests to KUnit
include/kunit/test.h | 10 + include/linux/sched.h | 4 + lib/Kconfig.kasan | 13 +- lib/Makefile | 1 + lib/kunit/test.c | 10 +- lib/test_kasan.c | 639 +++++++++++++++---------------------- lib/test_kasan_copy_user.c | 75 +++++ mm/kasan/report.c | 33 ++ 8 files changed, 400 insertions(+), 385 deletions(-) create mode 100644 lib/test_kasan_copy_user.c