Live Patching
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz,
	song@kernel.org, live-patching@vger.kernel.org
Subject: Re: [PATCH v3 3/7] livepatch: Support scoped atomic replace using replace_set
Date: Wed, 17 Jun 2026 16:06:59 -0400	[thread overview]
Message-ID: <ajL-Y3dapC1FiAwx@redhat.com> (raw)
In-Reply-To: <ajKmm5GIkvRUlJ2c@pathway.suse.cz>

On Wed, Jun 17, 2026 at 03:52:27PM +0200, Petr Mladek wrote:
> On Tue 2026-06-16 16:15:17, Joe Lawrence wrote:
> > On Thu, Jun 11, 2026 at 02:58:39PM +0200, Petr Mladek wrote:
> > > On Tue 2026-06-09 18:00:55, Petr Mladek wrote:
> > > > On Sun 2026-06-07 21:16:55, Yafang Shao wrote:
> [ ... snip ... ]
> > I'm not against supercedes functionality, but continuing the
> > brainstorming: what about solution 1 (.replace_set=0 special) with a
> > special zero-day overlay?
> 
> I continue with the brainstorming ;-)
> 

Thanks for walking through it with me.  Your reply crossed with my note
to Yafang at nearly the same time.

> [ ... snip ... ]
> > So maybe it boils down to: is the supercedes big hammer desired and safe
> > enough to deploy?
> 
> I personally like the solution with a zero-terminated array of
> replace_sets:
> 
> 	struct patch {
> 	       [...]
> 	       unsigned int *replace_sets;
> 	       [...],
> 	};
> 
> , which would allow to build a cumulative livepatch which replaces
> known hotfixes out of box.
> 

Question on this at the bottom ...

> Note that the hotfix should not be allowed to modify a function or
> livepatch state which is modified by another livepatch. It would
> be dangerous. We should allow to solve this only by a cumulative
> livepatch.
> 

Agreed.

> IMHO, the OS vendor should not touch customer specific livepatches
> by default. The customer installed them for a reason. We should
> just refuse to install two conflicting livepatches. Where
> we could reliably compare only the livepatched functions.
> But it still is good because most livepatches only modify
> functions.
> 
> Plus, I would still allow to resolve the possible conflict by using
> the atomic replace. It could be done by a module-specific parameter.
> I would call it: override_replace_sets=X[,Y]... or so.
> 

Naming nitpick: "override_replace_sets" sounds like it may override the
"replace_sets" value and not supplement it.  But that's just an
implementation detail to bikeshed later :D 

> Finally, I assume that most users will keep using only the default
> replace_sets=0 [*]. They will never have to deal with another sets.
> 
> The non-default replace sets will be only for adventurous users
> who want to deal with the complexity and accept the risks.
> 
> [*] It we allow the zero-terminated array of replace_sets then
>     zero should not be the default. Or it could be but it would
>     be a special set which could never be replaced by anything
>     else than another zero replace set.
> 
>     The zero replace set might be for users who do not want to
>     deal with the complexity at all. For example, for an os-vendor
>     who does not want to release separate hotfixes.
> 

Hmm, I do like the default replace_sets=0 not dealing with the
complication of the replace sets.

But first, back to the larger question I mentioned at the beginning.

Originally there was:

  unsigned int replace_set;            /* the set I belong to */
  const unsigned int *supersedes;      /* other sets I also replace */

and now it's just:

  unsigned int *replace_sets;          /* sets I belong to AND replace? */

Could you trace through a few cycles of cumulative + hotfix releases with
this approach?  For example:

  Wed: klp-1a: cumulative    (replace_sets={1})
  Thu: klp-1b: hotfix        (replace_sets={2})     <- coexists with klp-1a
  Fri: klp-1c: hotfix v2     (replace_sets={2})     <- replaces klp-1b (same set)
  Mon: klp-2a: cumulative    (replace_sets={1,2})   <- replaces klp-1a AND wipes klp-1c *
  Tue: klp-2b: hotfix        (replace_sets={2})     <- coexists with klp-2a

[*] After klp-2a loads with {1, 2}, is it permanently in both sets?  Or
    does it just evict set 2 and then only occupy set 1 going forward?  The
    latter makes klp-2b's load straightforward.

I can read replace_sets two ways:

  1. Positional: { set [, eviction_set ...] } where the first element is
     the patch's own set and the rest are evicted on load.

  2. Flat: the patch belongs to every listed set equally.  But then how
     could klp-2b load into set 2 without replacing the entire
     cumulative klp-2a that also occupies it?

Thanks,
--
Joe


  reply	other threads:[~2026-06-17 20:07 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 13:16 [PATCH v3 0/7] livepatch: Introduce replace set support Yafang Shao
2026-06-07 13:16 ` [PATCH v3 1/7] livepatch: Fix NULL pointer dereference in klp_find_func() Yafang Shao
2026-06-09 13:27   ` Petr Mladek
2026-06-10  3:00     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 2/7] livepatch: Move klp_find_func() into core.h Yafang Shao
2026-06-09 15:28   ` Petr Mladek
2026-06-10  3:01     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 3/7] livepatch: Support scoped atomic replace using replace_set Yafang Shao
2026-06-07 13:33   ` sashiko-bot
2026-06-07 14:00     ` Yafang Shao
2026-06-09 16:00   ` Petr Mladek
2026-06-10  3:24     ` Yafang Shao
2026-06-10  9:48       ` Petr Mladek
2026-06-11 12:58     ` Petr Mladek
2026-06-15 12:30       ` Yafang Shao
2026-06-16  2:41         ` Yafang Shao
2026-06-16 20:15       ` Joe Lawrence
2026-06-17  2:40         ` Yafang Shao
2026-06-17 14:54           ` Joe Lawrence
2026-06-17 13:52         ` Petr Mladek
2026-06-17 20:06           ` Joe Lawrence [this message]
2026-06-10 14:45   ` code review: was: " Petr Mladek
2026-06-11  3:06     ` Yafang Shao
2026-06-16 18:20   ` Joe Lawrence
2026-06-07 13:16 ` [PATCH v3 4/7] livepatch: Deprecate stack_order Yafang Shao
2026-06-07 13:31   ` sashiko-bot
2026-06-10 15:11   ` Petr Mladek
2026-06-11  3:21     ` Yafang Shao
2026-06-16 18:44       ` Joe Lawrence
2026-06-07 13:16 ` [PATCH v3 5/7] selftests/livepatch: Update tests for replace_set Yafang Shao
2026-06-07 13:29   ` sashiko-bot
2026-06-07 13:16 ` [PATCH v3 6/7] selftests/livepatch: Add test for state ID conflict across replace_sets Yafang Shao
2026-06-12  8:55   ` Petr Mladek
2026-06-15 11:59     ` Yafang Shao
2026-06-07 13:16 ` [PATCH v3 7/7] selftests/livepatch: Add test for function " Yafang Shao
2026-06-16 20:25 ` [PATCH v3 0/7] livepatch: Introduce replace set support Joe Lawrence
2026-06-17  2:21   ` Yafang Shao

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=ajL-Y3dapC1FiAwx@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --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