From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: dri-devel@lists.freedesktop.org,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Danilo Krummrich" <dakr@kernel.org>,
gary@garyguo.net, ojeda@kernel.org
Subject: Re: [PATCH 05/10] gpu: nova-core: gsp: cmdq: split the transport part of the send path
Date: Sun, 27 Sep 2026 11:26:43 +0000 [thread overview]
Message-ID: <20260927112643.95CB71F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260927-cmdq-rpc-v1-5-822db5af910e@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] gpu: nova-core: spurious checksum failure due to un-truncated slices
- [High] gpu: nova-core: infinite loop via unvalidated element_count from GSP
--
commit 90b2987a6783eb2acf6f7b5e9bf5e7fbc3108e1d
Author: Alexandre Courbot <acourbot@nvidia.com>
gpu: nova-core: gsp: cmdq: split the transport part of the send path
Move the transport part of send_single_command into send_command_element.
The RPC part of send_single_command is passed as a closure to set up moving
the RPC code into its own sub-module. No functional change intended.
> diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
> index a5595da23407b..602824236f64e 100644
> --- a/drivers/gpu/nova-core/gsp/cmdq.rs
> +++ b/drivers/gpu/nova-core/gsp/cmdq.rs
[ ... ]
> @@ -768,16 +807,28 @@ fn wait_for_msg(&self, timeout: Delta) -> Result<GspMessage<'_>> {
> // Extract the `GspMsgElement`.
> let (header, slice_1) = GspMsgElement::from_bytes_prefix(slice_1).ok_or(EIO)?;
>
> + // Validate checksum.
> + if Cmdq::calculate_checksum(SBufferIter::new_reader([
> + header.as_bytes(),
> + slice_1,
> + slice_2,
> + ])) != 0
> + {
[Severity: High]
Does this code spuriously fail the checksum validation when the GSP leaves
padding in the ring buffer or batches messages?
The patch moves the Cmdq::calculate_checksum call in wait_for_msg before
slice_1 and slice_2 are truncated to the actual payload_length. Because
calculate_checksum iterates and hashes all bytes in the slices, it will now
hash the entire available read area (including trailing ring buffer data)
instead of just the single message.
> + dev_err!(&self.dev, "GSP receive: bad checksum\n");
> + return Err(EIO);
> + }
[ ... ]
> @@ -863,9 +899,8 @@ fn receive_msg<M: MessageFromGsp>(&mut self, timeout: Delta) -> Result<M>
> };
>
> // Advance the read pointer past this message.
> - self.gsp_mem.advance_cpu_read_ptr(u32::try_from(
> - message.header.length().div_ceil(GSP_PAGE_SIZE),
> - )?);
> + self.gsp_mem
> + .advance_cpu_read_ptr(message.header.element_count());
[Severity: High]
Can an untrusted or erroneously crafted message header from the GSP cause an
infinite loop here?
The patch changes the read pointer advancement in receive_msg to use
message.header.element_count() (the raw elemCount field from the GSP) instead
of safely deriving it from the bounded payload length.
If the GSP firmware provides an elemCount of 0 (or a multiple of
MSGQ_NUM_PAGES, i.e., 63), advance_cpu_read_ptr adds 0 to the read pointer.
If the driver then encounters an unexpected function code and retries, it
will continuously re-read the exact same zero-advancing message, resulting
in a deadlock.
>
> result
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-cmdq-rpc-v1-0-822db5af910e@nvidia.com?part=5
next prev parent reply other threads:[~2026-09-27 11:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 11:14 [PATCH 00/10] gpu: nova-core: gsp: prepare the command queue for r000 dual-message types Alexandre Courbot
2026-09-27 11:14 ` [PATCH 01/10] gpu: nova-core: gsp: cmdq: use element_count to advance queue pointer Alexandre Courbot
2026-09-27 11:23 ` sashiko-bot
2026-09-27 11:14 ` [PATCH 02/10] gpu: nova-core: gsp: cmdq: validate checksum earlier on receive Alexandre Courbot
2026-09-27 11:23 ` sashiko-bot
2026-09-27 11:14 ` [PATCH 03/10] gpu: nova-core: gsp: introduce and use proper RpcMessageHeader type Alexandre Courbot
2026-09-27 11:25 ` sashiko-bot
2026-09-27 11:14 ` [PATCH 04/10] gpu: nova-core: gsp: cmdq: group the RPC-specific part of send_single_command Alexandre Courbot
2026-09-27 11:14 ` [PATCH 05/10] gpu: nova-core: gsp: cmdq: split the transport part of the send path Alexandre Courbot
2026-09-27 11:26 ` sashiko-bot [this message]
2026-09-27 11:14 ` [PATCH 06/10] gpu: nova-core: gsp: cmdq: move the RPC send code into a sub-module Alexandre Courbot
2026-09-27 11:14 ` [PATCH 07/10] gpu: nova-core: gsp: cmdq: split the transport part of the receive path Alexandre Courbot
2026-09-27 11:27 ` sashiko-bot
2026-09-27 11:14 ` [PATCH 08/10] gpu: nova-core: gsp: cmdq: move the RPC receive code into a sub-module Alexandre Courbot
2026-09-27 11:14 ` [PATCH 09/10] gpu: nova-core: gsp: move the RPC commands " Alexandre Courbot
2026-09-27 11:14 ` [PATCH 10/10] gpu: nova-core: gsp: add `rpc` to RPC message send/receive methods Alexandre Courbot
2026-09-27 11:22 ` sashiko-bot
2026-09-27 13:35 ` [PATCH 00/10] gpu: nova-core: gsp: prepare the command queue for r000 dual-message types Alexandre Courbot
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=20260927112643.95CB71F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--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.