Message ID | 20231220-send-lp-kselftests-v4-0-3458ec1b1a38@suse.com |
---|---|
Headers | show |
Series | livepatch: Move modules to selftests and add a new test | expand |
On Wed, 2023-12-20 at 13:53 -0300, Marcos Paulo de Souza wrote: > Changes in v4: > * Documented how to compile the livepatch selftests without running > the > tests (Joe) > * Removed the mention to lib/livepatch on MAINTAINERS file, reported > by > checkpatch. > To clarify: this is not a resend, this is the v4 that people were waiting for. I made a mistake with b4 tool, that first I sent the email just to myself, for testing, and it bumped the version to v5, but I asked it to "resend" the v4, but it ended up adding the "RESEND" to the series. Please review this patchset and ignore the RESEND word. Thanks to Petr Mladek for spotting my mistake. Marcos > Changes in v3: > * Rebased on top of v6.6-rc5 > * The commits messages were improved (Thanks Petr!) > * Created TEST_GEN_MODS_DIR variable to point to a directly that > contains kernel > modules, and adapt selftests to build it before running the test. > * Moved test_klp-call_getpid out of test_programs, since the gen_tar > would just copy the generated test programs to the livepatches dir, > and so scripts relying on test_programs/test_klp-call_getpid will > fail. > * Added a module_param for klp_pids, describing it's usage. > * Simplified the call_getpid program to ignore the return of getpid > syscall, > since we only want to make sure the process transitions correctly > to the > patched stated > * The test-syscall.sh not prints a log message showing the number of > remaining > processes to transition into to livepatched state, and check_output > expects it > to be 0. > * Added MODULE_AUTHOR and MODULE_DESCRIPTION to test_klp_syscall.c > > - Link to v3: > https://lore.kernel.org/r/20231031-send-lp-kselftests-v3-0-2b1655c2605f@suse.com > - Link to v2: > https://lore.kernel.org/linux-kselftest/20220630141226.2802-1-mpdesouza@suse.com/ > > This patchset moves the current kernel testing livepatch modules from > lib/livepatches to tools/testing/selftest/livepatch/test_modules, and > compiles > them as out-of-tree modules before testing. > > There is also a new test being added. This new test exercises > multiple processes > calling a syscall, while a livepatch patched the syscall. > > Why this move is an improvement: > * The modules are now compiled as out-of-tree modules against the > current > running kernel, making them capable of being tested on different > systems with > newer or older kernels. > * Such approach now needs kernel-devel package to be installed, since > they are > out-of-tree modules. These can be generated by running "make rpm- > pkg" in the > kernel source. > > What needs to be solved: > * Currently gen_tar only packages the resulting binaries of the > tests, and not > the sources. For the current approach, the newly added modules > would be > compiled and then packaged. It works when testing on a system with > the same > kernel version. But it will fail when running on a machine with > different kernel > version, since module was compiled against the kernel currently > running. > > This is not a new problem, just aligning the expectations. For the > current > approach to be truly system agnostic gen_tar would need to include > the module > and program sources to be compiled in the target systems. > > Thanks in advance! > Marcos > > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> > --- > Marcos Paulo de Souza (3): > kselftests: lib.mk: Add TEST_GEN_MODS_DIR variable > livepatch: Move tests from lib/livepatch to selftests/livepatch > selftests: livepatch: Test livepatching a heavily called > syscall > > Documentation/dev-tools/kselftest.rst | 4 + > MAINTAINERS | 1 - > arch/s390/configs/debug_defconfig | 1 - > arch/s390/configs/defconfig | 1 - > lib/Kconfig.debug | 22 ---- > lib/Makefile | 2 - > lib/livepatch/Makefile | 14 --- > tools/testing/selftests/lib.mk | 20 +++- > tools/testing/selftests/livepatch/Makefile | 5 +- > tools/testing/selftests/livepatch/README | 25 +++-- > tools/testing/selftests/livepatch/config | 1 - > tools/testing/selftests/livepatch/functions.sh | 34 +++--- > .../testing/selftests/livepatch/test-callbacks.sh | 50 ++++----- > tools/testing/selftests/livepatch/test-ftrace.sh | 6 +- > .../testing/selftests/livepatch/test-livepatch.sh | 10 +- > .../selftests/livepatch/test-shadow-vars.sh | 2 +- > tools/testing/selftests/livepatch/test-state.sh | 18 ++-- > tools/testing/selftests/livepatch/test-syscall.sh | 53 ++++++++++ > tools/testing/selftests/livepatch/test-sysfs.sh | 6 +- > .../selftests/livepatch/test_klp-call_getpid.c | 44 ++++++++ > .../selftests/livepatch/test_modules/Makefile | 20 ++++ > .../test_modules}/test_klp_atomic_replace.c | 0 > .../test_modules}/test_klp_callbacks_busy.c | 0 > .../test_modules}/test_klp_callbacks_demo.c | 0 > .../test_modules}/test_klp_callbacks_demo2.c | 0 > .../test_modules}/test_klp_callbacks_mod.c | 0 > .../livepatch/test_modules}/test_klp_livepatch.c | 0 > .../livepatch/test_modules}/test_klp_shadow_vars.c | 0 > .../livepatch/test_modules}/test_klp_state.c | 0 > .../livepatch/test_modules}/test_klp_state2.c | 0 > .../livepatch/test_modules}/test_klp_state3.c | 0 > .../livepatch/test_modules/test_klp_syscall.c | 116 > +++++++++++++++++++++ > 32 files changed, 334 insertions(+), 121 deletions(-) > --- > base-commit: 206ed72d6b33f53b2a8bf043f54ed6734121d26b > change-id: 20231031-send-lp-kselftests-4c917dcd4565 > > Best regards,
On 12/21/23 05:17, Marcos Paulo de Souza wrote: > On Wed, 2023-12-20 at 13:53 -0300, Marcos Paulo de Souza wrote: >> Changes in v4: >> * Documented how to compile the livepatch selftests without running >> the >> tests (Joe) >> * Removed the mention to lib/livepatch on MAINTAINERS file, reported >> by >> checkpatch. >> > > To clarify: this is not a resend, this is the v4 that people were > waiting for. I made a mistake with b4 tool, that first I sent the email > just to myself, for testing, and it bumped the version to v5, but I > asked it to "resend" the v4, but it ended up adding the "RESEND" to the > series. > > Please review this patchset and ignore the RESEND word. > > Thanks to Petr Mladek for spotting my mistake. > Thank for the clarification. I was wondering why this is a RESEND :) I will wait for reviewers to comment on this before pulling them in for Linux 6.8-rc1. thanks, -- Shuah
Hello: This conversation is now tracked by Kernel.org Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=218303 There is no need to do anything else, just keep talking.
mricon writes via Kernel.org Bugzilla: Oh, hmm... I uncovered a bug in bugbot -- this was a different subthread that I started about b4 and supporting --dry-run-to that Marcos was looking for. Not sure how to fix bugbot yet, but I'm going to close this bug for now. Sorry about the noise, everyone. -K View: https://bugzilla.kernel.org/show_bug.cgi?id=218303#c6 You can reply to this message to join the discussion.
On Wed, Dec 20, 2023 at 01:53:11PM -0300, Marcos Paulo de Souza wrote: > Changes in v4: > * Documented how to compile the livepatch selftests without running the > tests (Joe) > * Removed the mention to lib/livepatch on MAINTAINERS file, reported by > checkpatch. > > Changes in v3: > * Rebased on top of v6.6-rc5 > * The commits messages were improved (Thanks Petr!) > * Created TEST_GEN_MODS_DIR variable to point to a directly that contains kernel > modules, and adapt selftests to build it before running the test. > * Moved test_klp-call_getpid out of test_programs, since the gen_tar > would just copy the generated test programs to the livepatches dir, > and so scripts relying on test_programs/test_klp-call_getpid will fail. > * Added a module_param for klp_pids, describing it's usage. > * Simplified the call_getpid program to ignore the return of getpid syscall, > since we only want to make sure the process transitions correctly to the > patched stated > * The test-syscall.sh not prints a log message showing the number of remaining > processes to transition into to livepatched state, and check_output expects it > to be 0. > * Added MODULE_AUTHOR and MODULE_DESCRIPTION to test_klp_syscall.c > > - Link to v3: https://lore.kernel.org/r/20231031-send-lp-kselftests-v3-0-2b1655c2605f@suse.com > - Link to v2: https://lore.kernel.org/linux-kselftest/20220630141226.2802-1-mpdesouza@suse.com/ > > This patchset moves the current kernel testing livepatch modules from > lib/livepatches to tools/testing/selftest/livepatch/test_modules, and compiles > them as out-of-tree modules before testing. > > There is also a new test being added. This new test exercises multiple processes > calling a syscall, while a livepatch patched the syscall. > > Why this move is an improvement: > * The modules are now compiled as out-of-tree modules against the current > running kernel, making them capable of being tested on different systems with > newer or older kernels. > * Such approach now needs kernel-devel package to be installed, since they are > out-of-tree modules. These can be generated by running "make rpm-pkg" in the > kernel source. > > What needs to be solved: > * Currently gen_tar only packages the resulting binaries of the tests, and not > the sources. For the current approach, the newly added modules would be > compiled and then packaged. It works when testing on a system with the same > kernel version. But it will fail when running on a machine with different kernel > version, since module was compiled against the kernel currently running. > > This is not a new problem, just aligning the expectations. For the current > approach to be truly system agnostic gen_tar would need to include the module > and program sources to be compiled in the target systems. > > Thanks in advance! > Marcos > > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> > --- > Marcos Paulo de Souza (3): > kselftests: lib.mk: Add TEST_GEN_MODS_DIR variable > livepatch: Move tests from lib/livepatch to selftests/livepatch > selftests: livepatch: Test livepatching a heavily called syscall > > Documentation/dev-tools/kselftest.rst | 4 + > MAINTAINERS | 1 - > arch/s390/configs/debug_defconfig | 1 - > arch/s390/configs/defconfig | 1 - > lib/Kconfig.debug | 22 ---- > lib/Makefile | 2 - > lib/livepatch/Makefile | 14 --- > tools/testing/selftests/lib.mk | 20 +++- > tools/testing/selftests/livepatch/Makefile | 5 +- > tools/testing/selftests/livepatch/README | 25 +++-- > tools/testing/selftests/livepatch/config | 1 - > tools/testing/selftests/livepatch/functions.sh | 34 +++--- > .../testing/selftests/livepatch/test-callbacks.sh | 50 ++++----- > tools/testing/selftests/livepatch/test-ftrace.sh | 6 +- > .../testing/selftests/livepatch/test-livepatch.sh | 10 +- > .../selftests/livepatch/test-shadow-vars.sh | 2 +- > tools/testing/selftests/livepatch/test-state.sh | 18 ++-- > tools/testing/selftests/livepatch/test-syscall.sh | 53 ++++++++++ > tools/testing/selftests/livepatch/test-sysfs.sh | 6 +- > .../selftests/livepatch/test_klp-call_getpid.c | 44 ++++++++ > .../selftests/livepatch/test_modules/Makefile | 20 ++++ > .../test_modules}/test_klp_atomic_replace.c | 0 > .../test_modules}/test_klp_callbacks_busy.c | 0 > .../test_modules}/test_klp_callbacks_demo.c | 0 > .../test_modules}/test_klp_callbacks_demo2.c | 0 > .../test_modules}/test_klp_callbacks_mod.c | 0 > .../livepatch/test_modules}/test_klp_livepatch.c | 0 > .../livepatch/test_modules}/test_klp_shadow_vars.c | 0 > .../livepatch/test_modules}/test_klp_state.c | 0 > .../livepatch/test_modules}/test_klp_state2.c | 0 > .../livepatch/test_modules}/test_klp_state3.c | 0 > .../livepatch/test_modules/test_klp_syscall.c | 116 +++++++++++++++++++++ > 32 files changed, 334 insertions(+), 121 deletions(-) > --- > base-commit: 206ed72d6b33f53b2a8bf043f54ed6734121d26b > change-id: 20231031-send-lp-kselftests-4c917dcd4565 > > Best regards, > -- > Marcos Paulo de Souza <mpdesouza@suse.com> > Hi Marcos, I made it through retrofitting [1] to our current packaging scheme on top of the patchset, no big surprises found. With that, I'm happy to ack this version, unless you want to modify the TEST_GEN_MODS_DIR / rsync behavior as I reported in my reply yesterday. (Not a show stopper IMHO, but I'll leave that up to kselftest folks.) Reviewed-by: Joe Lawrence <joe.lawrence@redhat.com> [1] https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2844/commits -- Joe
Changes in v4: * Documented how to compile the livepatch selftests without running the tests (Joe) * Removed the mention to lib/livepatch on MAINTAINERS file, reported by checkpatch. Changes in v3: * Rebased on top of v6.6-rc5 * The commits messages were improved (Thanks Petr!) * Created TEST_GEN_MODS_DIR variable to point to a directly that contains kernel modules, and adapt selftests to build it before running the test. * Moved test_klp-call_getpid out of test_programs, since the gen_tar would just copy the generated test programs to the livepatches dir, and so scripts relying on test_programs/test_klp-call_getpid will fail. * Added a module_param for klp_pids, describing it's usage. * Simplified the call_getpid program to ignore the return of getpid syscall, since we only want to make sure the process transitions correctly to the patched stated * The test-syscall.sh not prints a log message showing the number of remaining processes to transition into to livepatched state, and check_output expects it to be 0. * Added MODULE_AUTHOR and MODULE_DESCRIPTION to test_klp_syscall.c - Link to v3: https://lore.kernel.org/r/20231031-send-lp-kselftests-v3-0-2b1655c2605f@suse.com - Link to v2: https://lore.kernel.org/linux-kselftest/20220630141226.2802-1-mpdesouza@suse.com/ This patchset moves the current kernel testing livepatch modules from lib/livepatches to tools/testing/selftest/livepatch/test_modules, and compiles them as out-of-tree modules before testing. There is also a new test being added. This new test exercises multiple processes calling a syscall, while a livepatch patched the syscall. Why this move is an improvement: * The modules are now compiled as out-of-tree modules against the current running kernel, making them capable of being tested on different systems with newer or older kernels. * Such approach now needs kernel-devel package to be installed, since they are out-of-tree modules. These can be generated by running "make rpm-pkg" in the kernel source. What needs to be solved: * Currently gen_tar only packages the resulting binaries of the tests, and not the sources. For the current approach, the newly added modules would be compiled and then packaged. It works when testing on a system with the same kernel version. But it will fail when running on a machine with different kernel version, since module was compiled against the kernel currently running. This is not a new problem, just aligning the expectations. For the current approach to be truly system agnostic gen_tar would need to include the module and program sources to be compiled in the target systems. Thanks in advance! Marcos Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> --- Marcos Paulo de Souza (3): kselftests: lib.mk: Add TEST_GEN_MODS_DIR variable livepatch: Move tests from lib/livepatch to selftests/livepatch selftests: livepatch: Test livepatching a heavily called syscall Documentation/dev-tools/kselftest.rst | 4 + MAINTAINERS | 1 - arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - lib/Kconfig.debug | 22 ---- lib/Makefile | 2 - lib/livepatch/Makefile | 14 --- tools/testing/selftests/lib.mk | 20 +++- tools/testing/selftests/livepatch/Makefile | 5 +- tools/testing/selftests/livepatch/README | 25 +++-- tools/testing/selftests/livepatch/config | 1 - tools/testing/selftests/livepatch/functions.sh | 34 +++--- .../testing/selftests/livepatch/test-callbacks.sh | 50 ++++----- tools/testing/selftests/livepatch/test-ftrace.sh | 6 +- .../testing/selftests/livepatch/test-livepatch.sh | 10 +- .../selftests/livepatch/test-shadow-vars.sh | 2 +- tools/testing/selftests/livepatch/test-state.sh | 18 ++-- tools/testing/selftests/livepatch/test-syscall.sh | 53 ++++++++++ tools/testing/selftests/livepatch/test-sysfs.sh | 6 +- .../selftests/livepatch/test_klp-call_getpid.c | 44 ++++++++ .../selftests/livepatch/test_modules/Makefile | 20 ++++ .../test_modules}/test_klp_atomic_replace.c | 0 .../test_modules}/test_klp_callbacks_busy.c | 0 .../test_modules}/test_klp_callbacks_demo.c | 0 .../test_modules}/test_klp_callbacks_demo2.c | 0 .../test_modules}/test_klp_callbacks_mod.c | 0 .../livepatch/test_modules}/test_klp_livepatch.c | 0 .../livepatch/test_modules}/test_klp_shadow_vars.c | 0 .../livepatch/test_modules}/test_klp_state.c | 0 .../livepatch/test_modules}/test_klp_state2.c | 0 .../livepatch/test_modules}/test_klp_state3.c | 0 .../livepatch/test_modules/test_klp_syscall.c | 116 +++++++++++++++++++++ 32 files changed, 334 insertions(+), 121 deletions(-) --- base-commit: 206ed72d6b33f53b2a8bf043f54ed6734121d26b change-id: 20231031-send-lp-kselftests-4c917dcd4565 Best regards,