All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Hsu <x90613@gmail.com>
To: mbenes@suse.cz
Cc: jikos@kernel.org, joe.lawrence@redhat.com, jpoimboe@kernel.org,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	pmladek@suse.com, sashiko-reviews@lists.linux.dev,
	shuah@kernel.org, song@kernel.org, x90613@gmail.com
Subject: Re: [PATCH v4 1/5] livepatch: Fail object initialization on duplicate patched function
Date: Thu,  1 Oct 2026 12:32:28 +0800	[thread overview]
Message-ID: <20261001043228.74946-1-x90613@gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.21.2609181452160.21788@pobox.suse.cz>

On Fri, 18 Sep 2026, Miroslav Benes wrote:

> Could we also check prev_func/func->nop in the check in
> klp_init_object_loaded() and have a pass if true?

Thanks for the suggestion.

Yes, I've updated the check to skip the pair when both klp_funcs are
nops. Two nops added by klp_add_nops() for replaced aliases are
interchangeable, so an atomic replace patch that inherits nops for
__do_sys_fork and __x64_sys_fork from two previous patches now loads
fine. A non-nop func colliding with a nop (or another non-nop func)
is still rejected, since the nop would land on top of the real
replacement on ops->func_stack and silently disable it.

The incremental change on top of v4 1/5 is:

--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -894,6 +894,8 @@ static int klp_init_object_loaded(struct klp_patch *patch,
 			if (prev_func == func)
 				break;
 			if (prev_func->old_func == func->old_func) {
+				if (prev_func->nop && func->nop)
+					continue;
 				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;

If this direction looks good, I'll resend the series. Petr, should I
just bundle everything into a v5, or do you have changes on your side
that I should wait for?

P.S. Sorry for the second mail. I forgot to quote the message I was
replying to in my first one.

Harry

  parent reply	other threads:[~2026-10-01  4:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 12:03 [PATCH v4 0/5] livepatch: Fail object initialization on duplicate patched function Petr Mladek
2026-09-08 12:03 ` [PATCH v4 1/5] " Petr Mladek
2026-09-08 12:17   ` sashiko-bot
2026-09-08 13:02     ` Petr Mladek
2026-09-18 12:54       ` Miroslav Benes
2026-09-30 14:11         ` [PATCH v4 1/3] " Harry Hsu
2026-10-01  4:32         ` Harry Hsu [this message]
2026-09-08 12:03 ` [PATCH v4 2/5] selftests/livepatch: Test rejection of aliased symbols in one object Petr Mladek
2026-09-18 13:40   ` Miroslav Benes
2026-09-08 12:03 ` [PATCH v4 3/5] livepatch: Move code for updating livepatch object relocations Petr Mladek
2026-09-18 13:40   ` Miroslav Benes
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-18 13:59   ` Miroslav Benes
2026-09-18 14:05     ` Miroslav Benes
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
2026-09-18 14:07   ` Miroslav Benes

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=20261001043228.74946-1-x90613@gmail.com \
    --to=x90613@gmail.com \
    --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 \
    /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.