From: sashiko-bot@kernel.org
To: "Pasha Tatashin" <pasha.tatashin@soleen.com>,
rppt@kernel.org, shuah@kernel.org, akpm@linux-foundation.org,
vipinsh@google.com, dmatlack@google.com,
kexec@lists.infradead.org, pratyush@kernel.org, graf@amazon.com
Subject: Re: [PATCH v1 3/7] liveupdate: Pass user argument to file preserve and retrieve
Date: Thu, 15 Oct 2026 09:49:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-172598@kernel.org> (raw)
In-Reply-To: <20261015093816.2438942-4-pasha.tatashin@soleen.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] core: user-triggerable WARN_ON() crash due to xa_insert allocation failure
--
commit 9f9574a189615ae795011fae912d53ecfd69c013
Author: Pasha Tatashin <pasha.tatashin@soleen.com>
liveupdate: Pass user argument to file preserve and retrieve
This commit allows userspace to pass a file-handler-specific argument structure
when preserving or retrieving an FD via LUO. It extends the preserve and
retrieve structures with a 64-bit arg field, while maintaining compatibility
with older callers. Handlers can now claim files in the preserved files table
before modifying them.
> diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
> index 3c1c86ff14d69..e3bfdbc6baedc 100644
> --- a/kernel/liveupdate/luo_file.c
> +++ b/kernel/liveupdate/luo_file.c
> @@ -176,6 +177,36 @@ static unsigned long luo_get_id(struct liveupdate_file_handler *fh,
> return fh->ops->get_id ? fh->ops->get_id(file) : (unsigned long)file;
> }
>
> +/**
> + * liveupdate_claim_file - Claim a file in the LUO preserved files table.
> + * @fh: The file handler claiming @file.
> + * @file: The file to claim.
> + *
> + * File handlers whose .retrieve() callback restores state into an existing
> + * user-supplied &struct file (rather than allocating a new one) should call
> + * this before modifying @file to ensure @file is not already managed by LUO.
> + *
> + * Return: 0 on success, -EBUSY if @file is already managed by LUO, or a
> + * negative errno on allocation failure.
> + */
> +int liveupdate_claim_file(struct liveupdate_file_handler *fh,
> + struct file *file)
> +{
> + return xa_insert(&luo_preserved_files, luo_get_id(fh, file),
> + file, GFP_KERNEL);
> +}
[ ... ]
> @@ -604,9 +687,9 @@ int luo_retrieve_file(struct luo_file_set *file_set, u64 token,
> /* Get reference so we can keep this file in LUO until finish */
> get_file(luo_file->file);
>
> - WARN_ON(xa_insert(&luo_preserved_files,
> - luo_get_id(luo_file->fh, luo_file->file),
> - luo_file->file, GFP_KERNEL));
> + if (xa_load(&luo_preserved_files,
> + luo_get_id(luo_file->fh, luo_file->file)) != luo_file->file)
> + WARN_ON(liveupdate_claim_file(luo_file->fh, luo_file->file));
[Severity: Medium]
Is it structurally safe to wrap liveupdate_claim_file() in a WARN_ON() macro?
Because liveupdate_claim_file() uses xa_insert() with GFP_KERNEL, it can
legitimately return -ENOMEM under memory pressure. The WARN_ON() macro will
evaluate this non-zero error code as true and trigger a kernel warning.
Since luo_retrieve_file() is reachable via the LIVEUPDATE_SESSION_RETRIEVE_FD
ioctl, an unprivileged user can trigger this allocation under memory pressure.
On systems with panic_on_warn enabled, this could lead to a user-triggerable
system crash.
>
> *filep = luo_file->file;
> luo_file->retrieve_status = 1;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015093816.2438942-1-pasha.tatashin@soleen.com?part=3
next prev parent reply other threads:[~2026-10-15 9:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 9:38 [PATCH v1 0/7] liveupdate: tmpfs preservation and early freeze Pasha Tatashin
2026-10-15 9:38 ` [PATCH v1 1/7] liveupdate: Add LIVEUPDATE_SESSION_FREEZE ioctl to freeze sessions early Pasha Tatashin
2026-10-15 9:47 ` sashiko-bot
2026-10-15 9:38 ` [PATCH v1 2/7] selftests: liveupdate: Add tests for LIVEUPDATE_SESSION_FREEZE Pasha Tatashin
2026-10-15 9:45 ` sashiko-bot
2026-10-15 9:38 ` [PATCH v1 3/7] liveupdate: Pass user argument to file preserve and retrieve Pasha Tatashin
2026-10-15 9:49 ` sashiko-bot [this message]
2026-10-15 9:38 ` [PATCH v1 4/7] selftests: liveupdate: Add tests for preserve and retrieve user argument Pasha Tatashin
2026-10-15 9:45 ` sashiko-bot
2026-10-15 9:38 ` [PATCH v1 5/7] liveupdate: Allow file handlers to mark retrieve failures as retryable Pasha Tatashin
2026-10-15 9:46 ` sashiko-bot
2026-10-15 9:38 ` [PATCH v1 6/7] mm/memfd_luo: Support tmpfs preservation and retrieval Pasha Tatashin
2026-10-15 9:54 ` sashiko-bot
2026-10-15 9:38 ` [PATCH v1 7/7] selftests: liveupdate: Add test coverage for " Pasha Tatashin
2026-10-15 9:47 ` sashiko-bot
2026-10-15 17:48 ` [PATCH v1 0/7] liveupdate: tmpfs preservation and early freeze David Matlack
2026-10-15 18:23 ` Pasha Tatashin
2026-10-15 18:54 ` David Matlack
2026-10-15 20:38 ` Pasha Tatashin
2026-10-15 21:53 ` David Matlack
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=sashiko-outbox-172598@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shuah@kernel.org \
--cc=vipinsh@google.com \
/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