live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	jikos@kernel.org, mbenes@suse.cz, joe.lawrence@redhat.com,
	mcgrof@kernel.org, live-patching@vger.kernel.org,
	linux-modules@vger.kernel.org
Subject: Re: [PATCH v2 2/2] livepatch: Delete the associated module of disabled livepatch
Date: Thu, 9 May 2024 12:51:17 +0200	[thread overview]
Message-ID: <ZjyqpXES5cHOl1Mg@pathway> (raw)
In-Reply-To: <20240507023522.zk5xygvpac6gnxkh@treble>

On Mon 2024-05-06 19:35:22, Josh Poimboeuf wrote:
> On Mon, May 06, 2024 at 01:32:19PM +0200, Petr Mladek wrote:
> > Also it would require adding an API to remove the sysfs files from the
> > module_exit callback.
> 
> Could the sysfs removal be triggered from klp_module_going() or a module
> notifier?

Great idea!

> > I do not see any reasonable reason to keep the replaced livepatch
> > module loaded. It is an unusable piece of code. IMHO, it would be
> > really convenient if the kernel removed it.
> 
> User space needs to be polling for the transition to complete so it can
> reverse the patch if it stalls.  Otherwise the patch could stall forever
> and go unnoticed.

Triggering the revert and removing the module are two asynchronous
operations. User space might just trigger the revert when it detect
the stall and assume that the module will get removed.

Stalled revert is end of the game anyway.

> Can't user space just unload the replaced module after it detects the
> completed transition?
> 
> I'm not sure I see the benefit in complicating the kernel and possibly
> introducing bugs, when unloading the module from user space seems to be
> a perfectly valid option.
>
> Also, an error returned by delete_module() to the kernel would be
> ignored and the module might remain in memory forever without being
> noticed.

The same error would happen even when it was called via the syscall.
It is the same code.

Well, user space might want to know when the module was removed.
For example, it could not load the same livepatch module until
it was removed. Explicit rmmod would be useful in this case.

I agree that adding the auto deleting might create new problems
and probably is not worth it.

Best Regards,
Petr

  parent reply	other threads:[~2024-05-09 10:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-07  3:57 [PATCH v2 0/2] livepatch, module: Delete the associated module of disabled livepatch Yafang Shao
2024-04-07  3:57 ` [PATCH v2 1/2] module: Add a new helper delete_module() Yafang Shao
2024-04-24 12:09   ` Yafang Shao
2024-05-04 16:53     ` Greg KH
2024-05-04 22:26       ` Josh Poimboeuf
2024-05-04 21:36     ` Luis Chamberlain
2024-05-06 11:58   ` Petr Mladek
2024-04-07  3:57 ` [PATCH v2 2/2] livepatch: Delete the associated module of disabled livepatch Yafang Shao
2024-05-03 21:14   ` Josh Poimboeuf
2024-05-06 11:32     ` Petr Mladek
2024-05-07  2:35       ` Josh Poimboeuf
2024-05-07 14:03         ` Yafang Shao
2024-05-08  5:16           ` Josh Poimboeuf
2024-05-08  6:01             ` Yafang Shao
2024-05-08  7:03               ` Josh Poimboeuf
2024-05-09  2:17                 ` Yafang Shao
2024-05-09  5:20                   ` Josh Poimboeuf
2024-05-09  5:53                     ` Yafang Shao
2024-05-09 10:16                       ` Petr Mladek
2024-05-09 11:57                         ` Yafang Shao
2024-05-09 10:51         ` Petr Mladek [this message]
2024-05-06 12:20   ` Petr Mladek
2024-05-02 13:30 ` [PATCH v2 0/2] livepatch, module: " Joe Lawrence

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