From: sashiko-bot@kernel.org
To: "Petr Mladek" <pmladek@suse.com>, "Harry Hsu" <x90613@gmail.com>,
joe.lawrence@redhat.com, mbenes@suse.cz, jpoimboe@kernel.org
Cc: song@kernel.org, shuah@kernel.org, live-patching@vger.kernel.org,
jikos@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/5] livepatch: Fail object initialization on duplicate patched function
Date: Tue, 08 Sep 2026 12:17:44 +0000 [thread overview]
Message-ID: <20260908121744.81D641F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908120325.299649-2-pmladek@suse.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Atomic replace patches will fail to load if previous patches targeted aliased functions.
--
commit e5553650270f93e11fe885d264a3829802223d3a
Author: Harry Hsu <x90613@gmail.com>
livepatch: Fail object initialization on duplicate patched function
This commit introduces a check to prevent patching multiple aliases of a
function within a single livepatch. It fails object initialization if aliases
resolving to the same address are detected.
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index a240d1144e89c..a6762cbe74b70 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
[ ... ]
> @@ -885,6 +885,21 @@ static int klp_init_object_loaded(struct klp_patch *patch,
> if (ret)
> return ret;
>
> + /*
> + * Aliased symbols share one address, so they would resolve to
> + * the same klp_ops and stack up on a single ops->func_stack,
> + * leaving the redirection ambiguous.
> + */
> + klp_for_each_func(obj, prev_func) {
> + if (prev_func == func)
> + break;
> + if (prev_func->old_func == func->old_func) {
> + pr_err("'%s' and '%s' resolve to the same address, aliased symbols are not supported\n",
> + prev_func->old_name, func->old_name);
> + return -EINVAL;
[Severity: High]
Will this check inadvertently reject nop functions generated by an atomic
replace patch when previous patches targeted aliased functions?
If previously loaded livepatches targeted aliased functions (for example, one
patch targets __do_sys_fork and another targets __x64_sys_fork), they were
permitted since they resided in different patches.
When an atomic replace patch is loaded, klp_add_nops() loops over all
previously patched functions and adds nops for them to the new patch. Since
nop deduplication is based on old_name, nops for both aliases are added.
Later, this check in klp_init_object_loaded() resolves their addresses and
finds duplicate old_func addresses. This causes the initialization to fail
with -EINVAL, which prevents the system from atomically replacing existing
livepatches and might force a reboot if the old patches cannot be safely
disabled manually.
> + }
> + }
> +
> ret = kallsyms_lookup_size_offset((unsigned long)func->old_func,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908120325.299649-1-pmladek@suse.com?part=1
next prev parent reply other threads:[~2026-09-08 12:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:03 [PATCH v4 0/5] " Petr Mladek
2026-09-08 12:03 ` [PATCH v4 1/5] " Petr Mladek
2026-09-08 12:17 ` sashiko-bot [this message]
2026-09-08 13:02 ` Petr Mladek
2026-09-08 12:03 ` [PATCH v4 2/5] selftests/livepatch: Test rejection of aliased symbols in one object Petr Mladek
2026-09-08 12:03 ` [PATCH v4 3/5] livepatch: Move code for updating livepatch object relocations Petr Mladek
2026-09-08 12:03 ` [PATCH v4 4/5] livepatch: Clear relocations when klp_apply_object_relocs() fails Petr Mladek
2026-09-08 12:18 ` sashiko-bot
2026-09-08 13:29 ` Petr Mladek
2026-09-08 12:03 ` [PATCH v4 5/5] livepatch: Clean up klp_init_object_loaded() when fails Petr Mladek
2026-09-08 12:25 ` sashiko-bot
2026-09-08 13:32 ` 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=20260908121744.81D641F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=x90613@gmail.com \
/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
all inboxes | Powered by JetHome®