lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260126100837.74c8597d.zhiw@nvidia.com>
Date: Mon, 26 Jan 2026 10:08:37 +0200
From: Zhi Wang <zhiw@...dia.com>
To: Joel Fernandes <joelagnelf@...dia.com>
CC: <linux-kernel@...r.kernel.org>, Danilo Krummrich <dakr@...nel.org>,
	Alexandre Courbot <acourbot@...dia.com>, Alice Ryhl <aliceryhl@...gle.com>,
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, "John
 Hubbard" <jhubbard@...dia.com>, Alistair Popple <apopple@...dia.com>, "Timur
 Tabi" <ttabi@...dia.com>, Edwin Peer <epeer@...dia.com>, Bjorn Helgaas
	<bhelgaas@...gle.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor
	<alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo
	<gary@...yguo.net>, Björn Roy Baron
	<bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
	<nouveau@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
	<rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v1 2/5] gpu: nova-core: use checked arithmetic in Booter
 signature parsing

On Sat, 24 Jan 2026 18:18:27 -0500
Joel Fernandes <joelagnelf@...dia.com> wrote:

> Use checked_add() when computing signature offsets from firmware-
> provided values in signatures_iter().
> 
> Without checked arithmetic, overflow could wrap to a small plausible
> offset that points to entirely wrong data.
> 
> Signed-off-by: Joel Fernandes <joelagnelf@...dia.com>
> ---
>  drivers/gpu/nova-core/firmware/booter.rs | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/firmware/booter.rs
> b/drivers/gpu/nova-core/firmware/booter.rs index
> 86556cee8e67..f5ad619dc055 100644 ---
> a/drivers/gpu/nova-core/firmware/booter.rs +++
> b/drivers/gpu/nova-core/firmware/booter.rs @@ -119,14 +119,23 @@ fn
> signatures_iter(&'a self) -> Result<impl Iterator<Item =
> BooterSignature<'a>> Some(sig_size) => { let patch_sig =
>                      frombytes_at::<u32>(self.fw,
> self.hdr.patch_sig_offset.into_safe_cast())?;
> -                let signatures_start =
> usize::from_safe_cast(self.hdr.sig_prod_offset + patch_sig); +
> +                // Compute signatures_start = hdr.sig_prod_offset +
> patch_sig.
> +                let signatures_start = self
> +                    .hdr
> +                    .sig_prod_offset
> +                    .checked_add(patch_sig)
> +                    .map(usize::from_safe_cast)
> +                    .ok_or(EINVAL)?;
> +
> +                // Compute signatures_end = signatures_start +
> hdr.sig_prod_size.
> +                let signatures_end = signatures_start
> +
> .checked_add(usize::from_safe_cast(self.hdr.sig_prod_size))
> +                    .ok_or(EINVAL)?;
>  

The same concern of comment format in PATCH 1 raised by Dirk, With that
addressed,

Reviewed-by: Zhi Wang <zhiw@...dia.com>

>                  self.fw
>                      // Get signatures range.
> -                    .get(
> -                        signatures_start
> -                            ..signatures_start +
> usize::from_safe_cast(self.hdr.sig_prod_size),
> -                    )
> +                    .get(signatures_start..signatures_end)
>                      .ok_or(EINVAL)?
>                      .chunks_exact(sig_size.into_safe_cast())
>              }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ