From: sashiko-bot@kernel.org
To: "Logan Odell" <loganodell@google.com>
Cc: kvm@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>,
linux-pci@vger.kernel.org, "Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev
Subject: Re: [RFC PATCH 3/3] luo: memfd: Move to feature flags instead of compatibility strings
Date: Thu, 03 Sep 2026 02:47:30 +0000 [thread overview]
Message-ID: <20260903024730.BDC4C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903023452.721732-4-loganodell@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Permanent memory leak of preserved KHO vmalloc block and physical folios when memfd_luo_retrieve() fails on early error paths.
--
commit 5ce2719ae4caecc0b1ca1429438f4dfe06609564
Author: Logan Odell <loganodell@google.com>
luo: memfd: Move to feature flags instead of compatibility strings
This commit updates the memfd liveupdate serialization structure to use
feature flags instead of compatibility strings. It introduces granular
compatibility checking by validating required features and active flags
during deserialization to prevent unsupported states from being restored.
> diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c
> index 59de210bee5f9..36ee503672a23 100644
> --- a/mm/memfd_luo.c
> +++ b/mm/memfd_luo.c
[ ... ]
> @@ -526,12 +531,21 @@ static int memfd_luo_retrieve(struct liveupdate_file_op_args *args)
> if (!ser)
> return -EINVAL;
>
> - /* Make sure the file only has seals supported by this version. */
> - if (ser->seals & ~MEMFD_LUO_ALL_SEALS) {
> + if (ser->features.req & ~MEMFD_LUO_FEATURES_SUPP) {
> + pr_err("Unsupported required memfd feature (req: 0x%llx, supp: 0x%llx)\n",
> + ser->features.req, (u64)MEMFD_LUO_FEATURES_SUPP);
> err = -EOPNOTSUPP;
> goto free_ser;
> }
>
> + if (LUO_FEATURE_IS_ACTIVE(ser, MEMFD_LUO_FEATURE_SEALS)) {
> + /* Make sure the file only has seals supported by this version. */
> + if (ser->seals & ~MEMFD_LUO_ALL_SEALS) {
> + err = -EOPNOTSUPP;
> + goto free_ser;
> + }
> + }
> +
[Severity: High]
This is a pre-existing issue, but does this early error path permanently leak
the preserved KHO vmalloc block and physical folios?
When memfd_luo_retrieve() in mm/memfd_luo.c fails here and jumps to the
free_ser label:
free_ser:
kho_restore_free(ser);
return err;
It abruptly frees the serialization struct. Bypassing the restoration of the
vmalloc array and physical folios leaves them locked in memblock indefinitely.
Furthermore, any fallback cleanup is skipped because the finalizer
memfd_luo_finish() returns immediately if args->retrieve_status is set:
mm/memfd_luo.c:memfd_luo_finish() {
...
if (args->retrieve_status)
return;
...
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903023452.721732-1-loganodell@google.com?part=3
next prev parent reply other threads:[~2026-09-03 2:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 2:34 [RFC PATCH 0/3] liveupdate: Move to feature flags for LUO and memfd ABI compatibility Logan Odell
2026-09-03 2:34 ` [RFC PATCH 1/3] luo: Move to feature flags instead of compatibility strings Logan Odell
2026-09-03 2:43 ` sashiko-bot
2026-09-03 2:34 ` [RFC PATCH 2/3] luo: Export feature support to vmlinux section Logan Odell
2026-09-03 2:44 ` sashiko-bot
2026-09-03 2:34 ` [RFC PATCH 3/3] luo: memfd: Move to feature flags instead of compatibility strings Logan Odell
2026-09-03 2:47 ` sashiko-bot [this message]
2026-09-04 16:00 ` [RFC PATCH 0/3] liveupdate: Move to feature flags for LUO and memfd ABI compatibility Jason Gunthorpe
2026-09-04 22:24 ` David Matlack
2026-09-05 1:24 ` Jason Gunthorpe
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=20260903024730.BDC4C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-pci@vger.kernel.org \
--cc=loganodell@google.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.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