Skip to content

selftests/livepatch: fix building and running outside the host kernel

Sasha Levin linux-kselftest live-patching lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesIn review
  2. v22 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Patch 1: clean test_modules through the kernel source tree that contains them, so that clean no longer skips them for a relative O, a missing Module.symvers or a missing /lib/modules/$(uname -r)/build, and pass a KDIR given on the command line on as an absolute path. Both found by Sashiko.
- Patch 2 is unchanged.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2selftests/livepatch: build test modules against the selected kerneltools/testing/selftests/livepatch/Makefile tools/testing/selftests/livepatch/functions.sh tools/testing/selftests/livepatch/test_modules/Makefile+35 -51 reply
2/2selftests/livepatch: skip based on the test modules instead of KDIRtools/testing/selftests/livepatch/functions.sh+5 -111 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] selftests/livepatch: fix building and running outside the host kernel

The livepatch test modules are built against the running host kernel even when the selftests are built for a kernel in an output directory, and the scripts skip every test on a machine without a kernel build tree, even when the modules were built and installed with the selftests.

Patch 1 picks KDIR from O or KBUILD_OUTPUT, stops passing O and KBUILD_OUTPUT on to the module build, and skips the modules for kernels without CONFIG_LIVEPATCH. Patch 2 makes the scripts check for the test modules instead of a kernel build tree.

Tested on v7.4-rc1 with an x86_64 kernel with CONFIG_LIVEPATCH built in an output directory. The modules build against it with relative and absolute O and KDIR, through tools/testing/selftests and through the kernel's kselftest targets, and clean removes them in all of those cases, also after Module.symvers is gone. The installed tree was run in a VM that has no build directory for that kernel: all 8 livepatch tests pass, and they skip cleanly when test_modules/ is missing.

Changes since v2:
- Patch 1: clean test_modules through the kernel source tree that contains them, so that clean no longer skips them for a relative O, a missing Module.symvers or a missing /lib/modules/$(uname -r)/build, and pass a KDIR given on the command line on as an absolute path. Both found by Sashiko.
- Patch 2 is unchanged.

v2: https://lore.kernel.org/all/[email protected]/
v1: https://lore.kernel.org/all/[email protected]/

Sasha Levin (2):
selftests/livepatch: build test modules against the selected kernel selftests/livepatch: skip based on the test modules instead of KDIR

 tools/testing/selftests/livepatch/Makefile    | 28 +++++++++++++++++++
 .../testing/selftests/livepatch/functions.sh  | 17 ++++-------
 .../selftests/livepatch/test_modules/Makefile | 11 ++++----
 3 files changed, 40 insertions(+), 16 deletions(-)
Signature · 1 line
2.53.0