Re: [PATCH v3 6/7] selftests/livepatch: Add test for state ID conflict across replace_sets
From: Petr Mladek <pmladek@suse.com>
Date: 2026-06-12 08:55:57
Hi, I am sorry I am getting busy with some other tasks so I won't review the new selftests carefully. They might change in v4 anyway. Just one note, see below. On Sun 2026-06-07 21:16:58, Yafang Shao wrote:
quoted hunk ↗ jump to hunk
Livepatches with different replace_sets must not share the same state ID. If a second livepatch attempts to reuse a state ID already registered by a livepatch with a different replace_set, the loading will fail. Add a test case to verify this behavior. The test result is as follows: $ ./test-state.sh TEST: system state modification ... ok TEST: taking over system state modification ... ok TEST: compatible cumulative livepatches ... ok TEST: incompatible cumulative livepatches ... ok TEST: livepatches state compatibility ... ok <<<< This case Signed-off-by: Yafang Shao <redacted> --- .../testing/selftests/livepatch/test-state.sh | 34 ++++ .../selftests/livepatch/test_modules/Makefile | 1 + .../livepatch/test_modules/test_klp_state.c | 2 +- .../livepatch/test_modules/test_klp_state2.c | 2 +- .../livepatch/test_modules/test_klp_state4.c | 163 ++++++++++++++++++ 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/livepatch/test_modules/test_klp_state4.c--- /dev/null +++ b/tools/testing/selftests/livepatch/test_modules/test_klp_state4.c@@ -0,0 +1,163 @@
^^^^^^^^^
+// SPDX-License-Identifier: GPL-2.0 +/* + * This test is identical to test_klp_state4.c, except that replace_set is + * set to 4 instead of 0. + */
This seems to be copy&paste of another test module. I suggest to solve this by defining a variable in using #include, for example, look for tools/testing/selftests/livepatch/test_modules/test_klp_speaker2.c at https://lore.kernel.org/all/20250115082431.5550-10-pmladek@suse.com/ (local) Best Regards, Petr