From: Petr Mladek <pmladek@suse.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz,
joe.lawrence@redhat.com, song@kernel.org,
live-patching@vger.kernel.org
Subject: temporary broken selftest: was: Re: [PATCH v12 5/9] livepatch: Implement provides and obsoletes for scoped atomic replace
Date: Fri, 23 Oct 2026 11:58:22 +0200 [thread overview]
Message-ID: <atsvvqPJk-413GzJ@pathway.suse.cz> (raw)
In-Reply-To: <20261016053708.47089-6-laoar.shao@gmail.com>
On Fri 2026-10-16 13:37:04, Yafang Shao wrote:
> The current bool replace flag is too coarse: it is either all or
> nothing. A livepatch with .replace=true replaces ALL existing
> livepatches, which is safe but inflexible. There is no way to have
> multiple independent livepatch sets coexist on the same system.
>
> Replace it with a more flexible model using two new fields in
> struct klp_patch:
>
> - provides: an unsigned int id identifying the changes made by
> the related livepatch. Where the changes are a set
> of modified objects, functions, and used callbacks,
> shadow variable ids, and state ids.
>
> - obsoletes: an optional array of unsigned int ids specifying
> additional provides ids to be replaced. This allows a new patch
> to explicitly obsolete patches from different scopes.
>
> A new livepatch atomically replaces any existing livepatch that
> meets either of the following conditions:
>
> 1. It has the same provides id as the new patch,
> 2. Its provides id is listed in the new patch's obsoletes list.
>
> A new livepatch that does not replace an existing one can coexist
> with it. In this case, the two livepatches must not modify the same
> function, or use the state with the same id. Any attempt to load an
> incompatible livepatch will be rejected by the kernel.
>
> klp-build gains -p/--provides and -r/--obsoletes options. The two
> parameters are not validated in klp-build, since the compiler and the
> kernel handle invalid values.
>
> Enable the CONFIG_KLP_HAS_PROVIDES compile-time marker now that the
> provides/obsoletes interface is implemented.
I tried to run selftests when rebasing on top of this patch.
And test-sysfs.sh fails with:
<paste>
# selftests: livepatch: test-sysfs.sh
# TEST: sysfs test ... ok
# TEST: sysfs test object/patched ... ok
# TEST: sysfs test stack_order value ... ERROR: Unexpected value in /sys/kernel/livepatch/test_klp_callbacks_demo/stack_order: 2 vs. 1
not ok 6 selftests: livepatch: test-sysfs.sh # exit=1
</paste>
The livepatches are not longer stacked and the test should get
skipped. It is called only when:
if [[ "$HAS_STACK_ORDER_ATTR" == "1" ]]; then
start_test "sysfs test stack_order value"
But "stack_order" is still there at this stage. It is removed
by the next 6th patch.
It would be nice to fix this to do not break bisectability.
The following change might do the job:
diff --git a/tools/testing/selftests/livepatch/test-sysfs.sh b/tools/testing/selftests/livepatch/test-sysfs.sh
index 32d3af0097ac..e48bf33207ca 100755
--- a/tools/testing/selftests/livepatch/test-sysfs.sh
+++ b/tools/testing/selftests/livepatch/test-sysfs.sh
@@ -13,6 +13,7 @@ HAS_REPLACE_ATTR=0
HAS_STACK_ORDER_ATTR=0
setup_config
+detect_provides_attr
# - load a livepatch and verifies the sysfs entries work as expected
@@ -154,7 +155,7 @@ livepatch: '$MOD_ATOMIC_REPLACE': unpatching complete
% rmmod $MOD_ATOMIC_REPLACE"
fi
-if [[ "$HAS_STACK_ORDER_ATTR" == "1" ]]; then
+if [[ "$HAS_STACK_ORDER_ATTR" == "1" && "$HAS_PROVIDES_ATTR" != "1" ]]; then
start_test "sysfs test stack_order value"
load_lp $MOD_LIVEPATCH
It should be merged into the 2nd patch which prepares the selftests
for this change.
Best Regards,
Petr
next prev parent reply other threads:[~2026-10-23 9:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 5:36 [PATCH v12 0/9] livepatch: Add support for scoped atomic replace Yafang Shao
2026-10-16 5:37 ` [PATCH v12 1/9] selftests/livepatch: Clarify test module file names Yafang Shao
2026-10-16 5:37 ` [PATCH v12 2/9] selftests/livepatch: Adapt atomic replace tests to provides/obsoletes Yafang Shao
2026-10-16 5:37 ` [PATCH v12 3/9] livepatch: Make klp_find_func() non static Yafang Shao
2026-10-16 5:37 ` [PATCH v12 4/9] livepatch: Call klp_init_patch_early() earlier Yafang Shao
2026-10-16 5:47 ` sashiko-bot
2026-10-16 7:49 ` Yafang Shao
2026-10-16 5:37 ` [PATCH v12 5/9] livepatch: Implement provides and obsoletes for scoped atomic replace Yafang Shao
2026-10-16 5:48 ` sashiko-bot
2026-10-16 7:46 ` Yafang Shao
2026-10-21 15:26 ` Petr Mladek
2026-10-22 5:47 ` Yafang Shao
2026-10-23 9:58 ` Petr Mladek [this message]
2026-10-25 7:57 ` temporary broken selftest: was: " Yafang Shao
2026-10-16 5:37 ` [PATCH v12 6/9] livepatch: Deprecate stack_order Yafang Shao
2026-10-22 15:10 ` Petr Mladek
2026-10-16 5:37 ` [PATCH v12 7/9] selftests/livepatch: Add provides/obsoletes test scenarios Yafang Shao
2026-10-23 9:58 ` Petr Mladek
2026-10-16 5:37 ` [PATCH v12 8/9] selftests/livepatch: Add state test for provides/obsoletes Yafang Shao
2026-10-23 9:58 ` Petr Mladek
2026-10-25 8:18 ` Yafang Shao
2026-10-16 5:37 ` [PATCH v12 9/9] selftests/livepatch: Add function " Yafang Shao
2026-10-22 15:59 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=atsvvqPJk-413GzJ@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.