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
Convert KASAN tests to KUnit with the exception of copy_user_test because KUnit is unable to test those.
Add documentation on how to run the KASAN tests with KUnit and what to expect when running these tests.
Depends on "[PATCH v3 kunit-next 0/2] kunit: extend kunit resources API" patchset [1]
[1] https://lore.kernel.org/linux-kselftest/1585313122-26441-1-git-send-email-al...
Changes from v3: - KUNIT_SET_KASAN_DATA and KUNIT_DO_EXPECT_KASAN_FAIL have been combined and included in KUNIT_DO_EXPECT_KASAN_FAIL() instead. - Reordered logic in kasan_update_kunit_status() in report.c to be easier to read. - Added comment to not use the name "kasan_data" for any kunit tests outside of KUNIT_EXPECT_KASAN_FAIL().
Patricia Alfonso (4): Add KUnit Struct to Current Task KUnit: KASAN Integration KASAN: Port KASAN Tests to KUnit KASAN: Testing Documentation
Documentation/dev-tools/kasan.rst | 70 +++ include/kunit/test.h | 5 + include/linux/kasan.h | 6 + include/linux/sched.h | 4 + lib/Kconfig.kasan | 15 +- lib/Makefile | 3 +- lib/kunit/test.c | 13 +- lib/test_kasan.c | 680 +++++++++++++----------------- lib/test_kasan_module.c | 76 ++++ mm/kasan/report.c | 30 ++ 10 files changed, 511 insertions(+), 391 deletions(-) create mode 100644 lib/test_kasan_module.c