Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Logan Odell" <loganodell@google.com>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
	kvm@vger.kernel.org, "Marc Zyngier" <maz@kernel.org>,
	linux-pci@vger.kernel.org
Subject: Re: [RFC PATCH 1/3] luo: Move to feature flags instead of compatibility strings
Date: Thu, 03 Sep 2026 02:43:17 +0000	[thread overview]
Message-ID: <20260903024317.AFE041F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903023452.721732-2-loganodell@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing payload length validation before accessing feature-dependent fields in `luo_ser`, leading to out-of-bounds reads.
--

commit 8e63def24ae09c6e2674a2bd48e32ef12916dd48
Author: Logan Odell <loganodell@google.com>

luo: Move to feature flags instead of compatibility strings

This commit replaces the compatibility string check with a 128-byte feature
header in the live update serialization structure. It introduces flags for
supported, required, and active features to allow for more flexible structure
evolution.

> diff --git a/kernel/liveupdate/luo_core.c b/kernel/liveupdate/luo_core.c
> --- a/kernel/liveupdate/luo_core.c
> +++ b/kernel/liveupdate/luo_core.c
> @@ -107,26 +107,37 @@ static int __init luo_early_startup(void)
>  		return 0;
>  	}
>  
> -	if (len < sizeof(*luo_ser)) {
> -		pr_err("LUO state is too small (%zu < %zu)\n", len, sizeof(*luo_ser));
> -		return -EINVAL;
> +	luo_ser = phys_to_virt(luo_ser_phys);
> +
> +	if (len < sizeof(struct luo_feature_hdr)) {

[Severity: High]
In luo_early_startup() in kernel/liveupdate/luo_core.c, does this code
sufficiently validate the payload length?

Since len is only checked against the size of struct luo_feature_hdr, it seems
the check for the full struct luo_ser size has been removed.

> +		pr_err("LUO state is too small (%zu < %zu)\n",
> +		       len, sizeof(struct luo_feature_hdr));
> +		err = -EINVAL;
> +		goto out_free_ser;
>  	}

[ ... ]

> +	if (LUO_FEATURE_IS_ACTIVE(luo_ser, LUO_FEATURE_NUMBER)) {
> +		luo_global.liveupdate_num = luo_ser->liveupdate_num;

[Severity: High]
Can this access memory out of bounds?

If the payload length from KHO is large enough to pass the header check but
smaller than the full structure size, this will read luo_ser->liveupdate_num
beyond the validated length.

> +		pr_info("Retrieved live update data, liveupdate number: %lld\n",
> +			luo_global.liveupdate_num);
> +	}
>  
> -	err = luo_session_setup_incoming(luo_ser->sessions_pa);
> -	if (err)
> -		goto out_free_ser;
>  
> -	luo_flb_setup_incoming(luo_ser->flbs_pa);
> +	if (LUO_FEATURE_IS_ACTIVE(luo_ser, LUO_FEATURE_SESSIONS)) {
> +		err = luo_session_setup_incoming(luo_ser->sessions_pa);

[Severity: High]
Can this result in the use of uninitialized or garbage data?

If len does not cover the sessions_pa field, reading it could yield a garbage
physical address that luo_session_setup_incoming() might then dereference,
leading to a panic or state corruption during boot.

> +		if (err)
> +			goto out_free_ser;
> +	}
> +
> +	if (LUO_FEATURE_IS_ACTIVE(luo_ser, LUO_FEATURE_FLBS))
> +		luo_flb_setup_incoming(luo_ser->flbs_pa);

[Severity: High]
Does this code pass a garbage address to luo_flb_setup_incoming()?

Accessing luo_ser->flbs_pa could read beyond the payload if len is smaller
than the full struct luo_ser size.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260903023452.721732-1-loganodell@google.com?part=1

  reply	other threads:[~2026-09-03  2:43 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 [this message]
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
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=20260903024317.AFE041F000E9@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