All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: ojeda@kernel.org, "Alexandre Courbot" <acourbot@nvidia.com>,
	dri-devel@lists.freedesktop.org,
	"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v3 3/5] gpu: nova-core: return non-WPR heap size as u64 from HALs
Date: Fri, 24 Jul 2026 07:04:44 +0000	[thread overview]
Message-ID: <20260724070445.2AC3E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-blackwell-fixes-v3-3-01aa6a54e3fd@nvidia.com>

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

Pre-existing issues:
- [High] The driver lacks bounds checking for framebuffer size and VGA workspace addresses read from untrusted device MMIO, leading to integer underflows and kernel panics.
--

--- Patch [3]: [PATCH v3 3/5] gpu: nova-core: return non-WPR heap size as u64 from HALs ---
commit 607f14f3038014abfcbe45e7fcb56d2a70d0bac2
Author: Eliot Courtney <ecourtney@nvidia.com>

gpu: nova-core: return non-WPR heap size as u64 from HALs

This commit changes the non_wpr_heap_size() HAL function to return a u64
directly, avoiding the need for a conversion when calculating the heap size.
It updates the HAL implementations for various chipsets accordingly.

> diff --git a/drivers/gpu/nova-core/fb.rs b/drivers/gpu/nova-core/fb.rs
> index 1f7b6a69e4db8..f5832e59de599 100644
> --- a/drivers/gpu/nova-core/fb.rs
> +++ b/drivers/gpu/nova-core/fb.rs
> @@ -252,7 +252,7 @@ pub(crate) fn new(chipset: Chipset, bar: Bar0<'_>, gsp_fw: &GspFirmware) -> Resu
>          };
>  
>          let non_wpr_heap = {
> -            let non_wpr_heap_size = u64::from(hal.non_wpr_heap_size());
> +            let non_wpr_heap_size = hal.non_wpr_heap_size();
>              FbRange(wpr2.start - non_wpr_heap_size..wpr2.start)

[Severity: High]
This is a pre-existing issue, but since we are modifying size calculations
here in FbLayout::new(), could a malicious device cause an integer underflow
earlier in this function?

If a device returns a framebuffer size smaller than NV_PRAMIN_SIZE (1MB) from
MMIO, the subtraction fb.end - NV_PRAMIN_SIZE will underflow and panic.

Additionally, the untrusted VGA workspace address read from MMIO isn't bounded
against fb.end. If the VGA workspace address is larger than the framebuffer
size, it can result in a range where start > end. When FbRange::len() is
called on this range, it will unconditionally subtract start from end, causing
another underflow panic.

Could we add upper bounds checking for the framebuffer size and VGA workspace
address against MMIO registers to prevent these crashes?

>          };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-blackwell-fixes-v3-0-01aa6a54e3fd@nvidia.com?part=3

  reply	other threads:[~2026-07-24  7:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24  6:56 [PATCH v3 0/5] gpu: nova-core: blackwell follow-ups and fixes Eliot Courtney
2026-07-24  6:56 ` [PATCH v3 1/5] gpu: nova-core: correct FRTS vidmem offset calculation Eliot Courtney
2026-07-24  7:16   ` sashiko-bot
2026-07-24  6:56 ` [PATCH v3 2/5] gpu: nova-core: rename heap size field Eliot Courtney
2026-07-24  7:04   ` sashiko-bot
2026-07-24  6:56 ` [PATCH v3 3/5] gpu: nova-core: return non-WPR heap size as u64 from HALs Eliot Courtney
2026-07-24  7:04   ` sashiko-bot [this message]
2026-07-24  6:56 ` [PATCH v3 4/5] gpu: nova-core: split FbLayout into FSP and non-FSP versions Eliot Courtney
2026-07-24  6:56 ` [PATCH v3 5/5] gpu: nova-core: pass WPR metadata ownership to FmcBootArgs Eliot Courtney

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=20260724070445.2AC3E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=ojeda@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.