Skip to content

Run KUnit tests late and handle faults

Mickaël Salaün kvm linux-hardening linux-hyperv linux-security-module linux-um lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8kunit: Run tests when the kernel is fully setupinit/main.c lib/bitfield_kunit.c lib/checksum_kunit.c +4 more+96 -633 replies
2/8kunit: Handle thread creation errorlib/kunit/try-catch.c+1 -01 reply
3/8kunit: Fix kthread referencelib/kunit/try-catch.c+6 -31 reply
4/8kunit: Fix timeout messagelib/kunit/try-catch.c+2 -11 reply
5/8kunit: Handle test faultsinclude/kunit/try-catch.h lib/kunit/try-catch.c+7 -102 replies
6/8kunit: Fix KUNIT_SUCCESS() calls in iov_iter testslib/kunit_iov_iter.c+9 -91 reply
7/8kunit: Print last test location on faultinclude/kunit/test.h lib/kunit/try-catch.c+28 -61 reply
8/8kunit: Add tests for faultslib/kunit/kunit-test.c+114 -12 replies

Reviews trailers per patch

6 of 8 patches have a Reviewed-by or Acked-by.

PatchKees Cook
1/8
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/8] Run KUnit tests late and handle faults

Hi,

This patch series moves KUnit test execution at the very end of kernel initialization, just before launching the init process. This opens the way to test any kernel code in its normal state (i.e. fully initialized).

This patch series also teaches KUnit to handle kthread faults as errors, and it brings a few related fixes and improvements.

New tests check NULL pointer dereference and read-only memory, which wasn't possible before.

This is useful to test current kernel self-protection mechanisms or future ones such as Heki: https://github.com/heki-linux

Regards,

Mickaël Salaün (8):
kunit: Run tests when the kernel is fully setup
kunit: Handle thread creation error
kunit: Fix kthread reference
kunit: Fix timeout message
kunit: Handle test faults
kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests
kunit: Print last test location on fault
kunit: Add tests for faults

 include/kunit/test.h                |  24 +++++-
 include/kunit/try-catch.h           |   3 -
 init/main.c                         |   4 +-
 lib/bitfield_kunit.c                |   8 +-
 lib/checksum_kunit.c                |   2 +-
 lib/kunit/executor.c                |  81 ++++++++++++++------
 lib/kunit/kunit-example-test.c      |   6 +-
 lib/kunit/kunit-test.c              | 115 +++++++++++++++++++++++++++-
 lib/kunit/try-catch.c               |  33 +++++---
 lib/kunit_iov_iter.c                |  70 ++++++++---------
 tools/testing/kunit/kunit_kernel.py |   6 +-
 11 files changed, 261 insertions(+), 91 deletions(-)

base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b

Signature · 1 line
2.44.0