From: Petr Mladek <pmladek@suse.com>
To: Song Liu <song@kernel.org>
Cc: live-patching@vger.kernel.org, jpoimboe@kernel.org,
jikos@kernel.org, mbenes@suse.cz, joe.lawrence@redhat.com,
kernel-team@meta.com
Subject: Re: [PATCH v2] livepatch: Match old_sympos 0 and 1 in klp_find_func()
Date: Wed, 15 Oct 2025 15:10:20 +0200 [thread overview]
Message-ID: <aO-dPImgapKJRQrw@pathway.suse.cz> (raw)
In-Reply-To: <20251013173019.990707-1-song@kernel.org>
On Mon 2025-10-13 10:30:19, Song Liu wrote:
> When there is only one function of the same name, old_sympos of 0 and 1
> are logically identical. Match them in klp_find_func().
>
> This is to avoid a corner case with different toolchain behavior.
>
> In this specific issue, issue two versions of kpatch-build were used to
s/issue, issue/issue/
> build livepatch for the same kernel. One assigns old_sympos == 0 for
> unique local functions, the other assigns old_sympos == 1 for unique
> local functions. Both versions work fine by themselves. (PS: This
> behavior change was introduced in a downstream version of kpatch-build.
> This change does not exist in upstream kpatch-build.)
>
> However, during livepatch upgrade (with the replace flag set) from a
> patch built with one version of kpatch-build to the same fix built with
> the other version of kpatch-build, livepatching fails with errors like:
>
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -88,8 +88,14 @@ static struct klp_func *klp_find_func(struct klp_object *obj,
> struct klp_func *func;
>
> klp_for_each_func(obj, func) {
> + /*
> + * Besides identical old_sympos, also condiser old_sympos
As Josh already pointed out:
s/condiser/consider/
> + * of 0 and 1 are identical.
> + */
> if ((strcmp(old_func->old_name, func->old_name) == 0) &&
> - (old_func->old_sympos == func->old_sympos)) {
> + ((old_func->old_sympos == func->old_sympos) ||
> + (old_func->old_sympos == 0 && func->old_sympos == 1) ||
> + (old_func->old_sympos == 1 && func->old_sympos == 0))) {
> return func;
> }
> }
With the two above fixes:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
I have fixed both problems when committing.
And the patch has been committed into livepatching.git,
branch for-6.19/trivial.
Best Regards,
Petr
prev parent reply other threads:[~2025-10-15 13:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 17:30 [PATCH v2] livepatch: Match old_sympos 0 and 1 in klp_find_func() Song Liu
2025-10-14 16:58 ` Josh Poimboeuf
2025-10-15 13:10 ` Petr Mladek [this message]
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=aO-dPImgapKJRQrw@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=kernel-team@meta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).