NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: dakr@kernel.org, acourbot@nvidia.com, "Zhi Wang" <zhiw@nvidia.com>
Cc: linux-kernel@vger.kernel.org, kjaju@nvidia.com,
	nova-gpu@lists.linux.dev, simona@ffwll.ch, alkumar@nvidia.com,
	zhiwang@kernel.org, smitra@nvidia.com, aniketa@nvidia.com,
	boqun.feng@gmail.com, "Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	cjia@nvidia.com, gary@garyguo.net, lossin@kernel.org,
	targupta@nvidia.com, jhubbard@nvidia.com, ankita@nvidia.com,
	apopple@nvidia.com, tmgross@umich.edu, kwankhede@nvidia.com,
	alex.gaynor@gmail.com, bjorn3_gh@protonmail.com,
	ecourtney@nvidia.com, joelagnelf@nvidia.com, airlied@gmail.com,
	a.hindborg@kernel.org, ojeda@kernel.org, aliceryhl@google.com
Subject: Re: [PATCH v5 5/6] gpu: nova-core: set RMSetSriovMode for vGPU
Date: Wed, 22 Jul 2026 07:52:53 +0000	[thread overview]
Message-ID: <20260722075253.B6DDB1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260722073913.1807677-6-zhiw@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The `size` field in the `PACKED_REGISTRY_TABLE` header is initialized incorrectly, causing the string data offsets to exceed the advertised table size.
--

--- Patch [5]: [PATCH v5 5/6] gpu: nova-core: set RMSetSriovMode for vGPU ---
commit 7a8618e853f5431c98f463e1cf9330f35e524af1
Author: Zhi Wang <zhiw@nvidia.com>

gpu: nova-core: set RMSetSriovMode for vGPU
    
The GSP registry setup needs to advertise SR-IOV mode when nova-core boots
GSP for an enabled vGPU configuration. Without the registry entry, GSP-RM
is not told to initialize in the mode required by NVIDIA vGPU.

> diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs
> index 08380de39048a..134f34b191744 100644
> --- a/drivers/gpu/nova-core/gsp/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/commands.rs
[ ... ]
> @@ -104,6 +105,17 @@ pub(crate) fn new() -> Result<Self> {
>              GFP_KERNEL,
>          )?;
>  
> +        if matches!(vgpu_state, VgpuState::Enabled { .. }) {
> +            // RMSetSriovMode - required when vGPU is enabled.
> +            entries.push(
> +                RegistryEntry {
> +                    key: "RMSetSriovMode",
> +                    value: 1,
> +                },
> +                GFP_KERNEL,
> +            )?;
> +        }
> +
>          Ok(Self { entries })
>      }
>  }

[Severity: High]
This isn't a bug introduced by this patch, but the size field in the
PACKED_REGISTRY_TABLE appears to be initialized incorrectly, which might cause
the newly added RMSetSriovMode entry to silently fail or cause out-of-bounds
reads.

Looking at SetRegistry::init() in this same file:

drivers/gpu/nova-core/gsp/commands.rs:SetRegistry::init() {
    fn init(&self) -> impl Init<Self::Command, Self::InitError> {
        Self::Command::init(
            self.entries.len() as u32,
            self.variable_payload_len() as u32,
        )
    }
}

Does this initialize the size using only the payload length, omitting the
8-byte table header itself? 

Since the string offsets calculated in init_variable_payload() correctly
include the 8-byte header size, won't the end of the string data exceed the
advertised table size by exactly 8 bytes?

Could this cause the GSP firmware to truncate the registry entries or perform
an out-of-bounds read?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722073913.1807677-1-zhiw@nvidia.com?part=5

  reply	other threads:[~2026-07-22  7:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  7:39 [PATCH v5 0/6] gpu: nova-core: boot GSP with vGPU enabled Zhi Wang
2026-07-22  7:39 ` [PATCH v5 1/6] PCI/IOV: Return unsigned int from pci_sriov_get_totalvfs() Zhi Wang
2026-07-22  7:39 ` [PATCH v5 2/6] rust: pci: add sriov_get_totalvfs() helper Zhi Wang
2026-07-23  5:30   ` Alexandre Courbot
2026-07-22  7:39 ` [PATCH v5 3/6] gpu: nova-core: read vGPU mode from FSP via PRC protocol Zhi Wang
2026-07-22  7:39 ` [PATCH v5 4/6] gpu: nova-core: detect and store vGPU state Zhi Wang
2026-07-22  7:39 ` [PATCH v5 5/6] gpu: nova-core: set RMSetSriovMode for vGPU Zhi Wang
2026-07-22  7:52   ` sashiko-bot [this message]
2026-07-23  7:18   ` Alexandre Courbot
2026-07-23  8:49     ` Zhi Wang
2026-07-22  7:39 ` [PATCH v5 6/6] gpu: nova-core: reserve vGPU WPR2 heap Zhi Wang
2026-07-22  7:52   ` sashiko-bot
2026-07-23  7:23   ` Alexandre Courbot
2026-07-23 20:09 ` [PATCH v5 0/6] gpu: nova-core: boot GSP with vGPU enabled Danilo Krummrich

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=20260722075253.B6DDB1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=alkumar@nvidia.com \
    --cc=aniketa@nvidia.com \
    --cc=ankita@nvidia.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=cjia@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=kjaju@nvidia.com \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simona@ffwll.ch \
    --cc=smitra@nvidia.com \
    --cc=targupta@nvidia.com \
    --cc=tmgross@umich.edu \
    --cc=zhiw@nvidia.com \
    --cc=zhiwang@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