From: David Matlack <dmatlack@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, pratyush@kernel.org
Subject: Re: [PATCH v2 3/8] liveupdate: Remove file handler module refcounting
Date: Tue, 24 Mar 2026 21:15:35 +0000 [thread overview]
Message-ID: <acL-96VeL3rAPbgo@google.com> (raw)
In-Reply-To: <20260318141637.1870220-13-pasha.tatashin@soleen.com>
On 2026-03-18 10:16 AM, Pasha Tatashin wrote:
> File handlers do not need to pin modules indefinitely or during active
> live update sessions. The VFS 'struct file' pins the file handler's module
> via f_op->owner during active sessions, making dynamic reference counting
> unnecessary for handlers.
>
> When a file is preserved, the live update core obtains a 'struct file'
> via fdget(). As long as the file is kept open within the live update
> session, the module is pinned by the VFS and cannot be unloaded.
>
> Similarly, during deserialization, file handlers are matched based on
> the compatible string. Because the handler list is protected by
> luo_file_handler_lock, there is no race that requires dynamic
> module refcounting.
Sashiko found a potential bug here when reviewing my VFIO patch series:
. If luo_file_deserialize() reconstructs preserved file structures and
. assigns the handler to luo_file->fh without calling try_module_get()
. to lock the module in memory, could the module be unloaded before the
. file descriptor is actually retrieved?
.
. This would cause liveupdate_unregister_file_handler() to run on module exit.
. If userspace subsequently calls luo_retrieve_file(), could it result
. in a use-after-free by dereferencing the dangling luo_file->fh->ops pointer?
https://sashiko.dev/#/patchset/20260323235817.1960573-1-dmatlack%40google.com?patch=7973
I think LUO would need to take a module reference in
luo_file_deserialize() and drop it once the file is retrieved. At that
point LUO can rely on the file's reference to the module to keep it from
being unloaded while LUO still has references to it.
next prev parent reply other threads:[~2026-03-24 21:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 14:16 [PATCH v2 0/8] liveupdate: Fix module unloading and unregister API Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 1/8] liveupdate: Protect file handler list with rwsem Pasha Tatashin
2026-03-22 13:13 ` Mike Rapoport
2026-03-22 14:23 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 2/8] liveupdate: Protect FLB lists " Pasha Tatashin
2026-03-20 0:21 ` Samiullah Khawaja
2026-03-20 1:04 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 3/8] liveupdate: Remove file handler module refcounting Pasha Tatashin
2026-03-24 21:15 ` David Matlack [this message]
2026-03-24 21:23 ` David Matlack
2026-03-25 2:49 ` Pasha Tatashin
2026-03-25 13:14 ` David Matlack
2026-03-25 13:43 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 4/8] liveupdate: Defer FLB module refcounting to active sessions Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 5/8] liveupdate: Remove luo_session_quiesce() Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 6/8] liveupdate: Auto unregister FLBs on file handler unregistration Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 7/8] liveupdate: Remove liveupdate_test_unregister() Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 8/8] liveupdate: Make unregister functions return void Pasha Tatashin
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=acL-96VeL3rAPbgo@google.com \
--to=dmatlack@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@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