From: Petr Mladek <pmladek@suse.com>
To: Song Liu <song@kernel.org>
Cc: Yafang Shao <laoar.shao@gmail.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
Dylan Hatch <dylanbhatch@google.com>,
jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz,
rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, kpsingh@kernel.org,
mattbobrowski@google.com, jolsa@kernel.org, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev,
eddyz87@gmail.com, memxor@gmail.com, yonghong.song@linux.dev,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [RFC PATCH 3/4] livepatch: Add "replaceable" attribute to klp_patch
Date: Thu, 9 Apr 2026 09:36:31 +0200 [thread overview]
Message-ID: <addW_-whBavyHY-Z@pathway.suse.cz> (raw)
In-Reply-To: <CAPhsuW42WqGuZ1Z-RG0yzifZ7rh=XKUa5hKb6JxLeTWdc4s4-A@mail.gmail.com>
On Wed 2026-04-08 11:19:50, Song Liu wrote:
> On Wed, Apr 8, 2026 at 4:43 AM Petr Mladek <pmladek@suse.com> wrote:
> [...]
> > > >
> > > > This is weird semantic. Which livepatch tag would be allowed to
> > > > supersede it, please?
> > > >
> > > > Do we still need this category?
> > >
> > > It can be superseded by any livepatch that has a non-zero tag set.
> >
> > And this exactly the weird thing.
> >
> > A patch with the .replace flag set is supposed to obsolete all already
> > installed livepatches. It means that it should provide all existing
> > fixes and features.
> >
> > Now, we want to introduce a replace flag/set which would allow to
> > replace/obsolete only the livepatch with the same tag/set number.
> > And we want to prevent conflicts by making sure that livepatches with
> > different tag/set number will never livepatch the same function.
> >
> > Obviously, livepatches with different tag/set number could not
> > obsolete the same no-replace livepatch. They would need to livepatch
> > the same functions touched by the no-replace livepatch and would
> > conflict.
> >
> > So, I suggest to remove the no-replace mode completely. It should
> > not be needed. A livepatch which should be installed in parallel
> > will simply use another unique tag/set number.
>
> I think I see your point now. Existing code works as:
> - replace=false doesn't replace anything
> - replace=true replaces everything
>
> If we assume false=0 and true=1, it is technically possible to define:
> - replace_set=0 doesn't replace anything
> - replace_set=1 replaces everything
> - replace_set=2+ only replace the same replace_set
Yes. This well describes my point.
> This is probably a little too complicated.
>
> > > This ensures backward compatibility: while a non-atomic-replace
> > > livepatch can be superseded by an atomic-replace one, the reverse is
> > > not permitted—an atomic-replace livepatch cannot be superseded by a
> > > non-atomic one.
> >
> > IMHO, the backward compatibility would just create complexity and mess
> > in this case.
>
> Given that livepatch is for expert users, I think we can make this work
> without backward compatibility. But breaking compatibility is always not
> preferred.
I believe that it is acceptable because:
1. It was always hard to combine no-replace and replace livepatches.
I wonder if anyone combines them at all.
2. I believe that nobody tries to load the same livepatch module on
different kernel versions. Instead, everyone prepares a custom
livepatch module for each livepatched kernel version/release.
And the tooling for creating livepatches will need to be updated
to use "number" instead of "true/false" anyway.
That said, it is easier to always use "0" for non-replace patches
instead of assigning an unique "number" to avoid replacing. But
I do not think that this would justify the complexity of having
different semantic for 0, 1, and 2+ replace_set numbers.
Best Regards,
Petr
next prev parent reply other threads:[~2026-04-09 7:36 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 9:26 [RFC PATCH 0/4] trace, livepatch: Allow kprobe return overriding for livepatched functions Yafang Shao
2026-04-02 9:26 ` [RFC PATCH 1/4] trace: Simplify kprobe overridable function check Yafang Shao
2026-04-02 13:13 ` Masami Hiramatsu
2026-04-02 9:26 ` [RFC PATCH 2/4] trace: Allow kprobes to override livepatched functions Yafang Shao
2026-04-02 12:48 ` Menglong Dong
2026-04-02 13:20 ` Yafang Shao
2026-04-03 10:25 ` Menglong Dong
2026-04-03 11:30 ` Steven Rostedt
2026-04-03 13:30 ` Yafang Shao
2026-04-03 14:26 ` Alexei Starovoitov
2026-04-03 16:00 ` Yafang Shao
2026-04-03 13:26 ` Yafang Shao
2026-04-09 9:47 ` Miroslav Benes
2026-04-02 9:26 ` [RFC PATCH 3/4] livepatch: Add "replaceable" attribute to klp_patch Yafang Shao
2026-04-03 16:19 ` Song Liu
2026-04-03 20:55 ` Dylan Hatch
2026-04-03 21:35 ` Song Liu
2026-04-06 11:08 ` Yafang Shao
2026-04-06 18:11 ` Song Liu
2026-04-06 21:12 ` Joe Lawrence
2026-04-07 2:54 ` Song Liu
2026-04-07 3:16 ` Yafang Shao
2026-04-07 9:45 ` Yafang Shao
2026-04-07 15:08 ` Petr Mladek
2026-04-07 23:09 ` Song Liu
2026-04-08 11:10 ` Petr Mladek
2026-04-08 2:40 ` Yafang Shao
2026-04-08 11:43 ` Petr Mladek
2026-04-08 18:19 ` Song Liu
2026-04-09 7:36 ` Petr Mladek [this message]
2026-04-07 13:52 ` Petr Mladek
2026-04-02 9:26 ` [RFC PATCH 4/4] livepatch: Implement livepatch hybrid mode Yafang Shao
2026-04-03 16:06 ` [RFC PATCH 0/4] trace, livepatch: Allow kprobe return overriding for livepatched functions Song Liu
2026-04-06 10:55 ` Yafang Shao
2026-04-06 18:26 ` Song Liu
2026-04-07 2:21 ` Yafang Shao
2026-04-07 2:46 ` Song Liu
2026-04-07 3:13 ` Yafang Shao
2026-04-08 6:51 ` Song Liu
2026-04-09 10:08 ` Miroslav Benes
2026-04-06 5:36 ` Christoph Hellwig
2026-04-06 10:57 ` Yafang Shao
2026-04-10 4:38 ` Masami Hiramatsu
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=addW_-whBavyHY-Z@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dylanbhatch@google.com \
--cc=eddyz87@gmail.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=kpsingh@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mattbobrowski@google.com \
--cc=mbenes@suse.cz \
--cc=memxor@gmail.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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