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: Re: [PATCH v12 8/9] selftests/livepatch: Add state test for provides/obsoletes
Date: Fri, 23 Oct 2026 11:58:54 +0200 [thread overview]
Message-ID: <atsv3jxebDGoP0hw@pathway.suse.cz> (raw)
In-Reply-To: <20261016053708.47089-9-laoar.shao@gmail.com>
On Fri 2026-10-16 13:37:07, Yafang Shao wrote:
> Livepatches with different provides ids must not share the same state
> id, unless the second livepatch replaces the first one via obsoletes.
>
> Add provides/obsoletes module parameters to test_klp_state and
> test_klp_state2, and cover both cases: reusing a state id across
> different provides ids is rejected, while it is allowed when the new
> livepatch obsoletes the old one.
>
> --- a/tools/testing/selftests/livepatch/test_modules/test_klp_state.c
> +++ b/tools/testing/selftests/livepatch/test_modules/test_klp_state.c
> @@ -151,6 +165,16 @@ static struct klp_patch patch = {
>
> static int test_klp_callbacks_demo_init(void)
> {
> +#ifdef CONFIG_KLP_HAS_PROVIDES
> + patch.provides = provides;
> + if (nr_obsoletes > 0) {
> + patch.obsoletes = obsoletes;
> + patch.nr_obsoletes = nr_obsoletes;
> + }
> +#else
> + patch.replace = true;
This changes the behavior. The original patch did not replace
others.
I believe that it would break the last test in test-sysfs.sh.
It passes with this patchset because the problematic test
is skipped. But it would break the test when it is used
for older kernels.
I guess that it is a cut-&-paste mistake ;-)
> +#endif
> + states[0].id = state;
> return klp_enable_patch(&patch);
> }
>
> diff --git a/tools/testing/selftests/livepatch/test_modules/test_klp_state2.c b/tools/testing/selftests/livepatch/test_modules/test_klp_state2.c
> index 5f07fe1be2b9..aeb911b87d37 100644
> --- a/tools/testing/selftests/livepatch/test_modules/test_klp_state2.c
> +++ b/tools/testing/selftests/livepatch/test_modules/test_klp_state2.c
> @@ -180,6 +194,16 @@ static struct klp_patch patch = {
>
> static int test_klp_callbacks_demo_init(void)
> {
> +#ifdef CONFIG_KLP_HAS_PROVIDES
> + patch.provides = provides;
> + if (nr_obsoletes > 0) {
> + patch.obsoletes = obsoletes;
> + patch.nr_obsoletes = nr_obsoletes;
> + }
> +#else
> + patch.replace = true;
Same here:
> +#endif
> + states[0].id = state;
> return klp_enable_patch(&patch);
> }
Otherwise, it looks good to me and passes the test.
With the "patch.replace = true;" lines removed:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
next prev parent reply other threads:[~2026-10-23 9:58 UTC|newest]
Thread overview: 21+ 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 ` temporary broken selftest: was: " Petr Mladek
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 [this message]
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=atsv3jxebDGoP0hw@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.