From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
dri-devel@lists.freedesktop.org,
"Alexandre Courbot" <acourbot@nvidia.com>,
ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v4 01/10] gpu: nova-core: gsp: cmdq: validate checksum earlier on receive
Date: Fri, 09 Oct 2026 12:06:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-165477@kernel.org> (raw)
In-Reply-To: <20261009-cmdq-rpc-v4-1-c9ab8de1d3f2@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] gpu: nova-core: double fetch of message length allows queue desynchronization
--
commit 946fd7a5c2c75e7ae4c51655010ee1c1c0977129
Author: Alexandre Courbot <acourbot@nvidia.com>
gpu: nova-core: gsp: cmdq: validate checksum earlier on receive
This moves the checksum validation before accessing the RPC header to
avoid printing an unvalidated sequence number.
> diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
> index 1b2f346a237f0..b1d46d6d4d4ab 100644
> --- a/drivers/gpu/nova-core/gsp/cmdq.rs
> +++ b/drivers/gpu/nova-core/gsp/cmdq.rs
> @@ -792,6 +792,15 @@ 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 after truncating the message to its exact length.
> + if Cmdq::calculate_checksum(
> + SBufferIter::new_reader([header.as_bytes(), slice_1, slice_2]).take(header.length()),
> + ) != 0
[Severity: High]
Does this code introduce a double fetch regression? Because the GSP message
queue resides in DMA-coherent shared memory, the device can concurrently
modify header.length().
By using header.length() to bound the checksum calculation via take() here,
but later using header.payload_length() to slice the payload:
drivers/gpu/nova-core/gsp/cmdq.rs:wait_for_msg() {
...
let payload_length = header.payload_length();
...
}
could the GSP modify the length field between these fetches, causing the
slices to cover unvalidated payload data and bypassing the checksum?
Furthermore, there is a third fetch of the length later in receive_msg():
drivers/gpu/nova-core/gsp/cmdq.rs:receive_msg() {
...
self.gsp_mem.advance_cpu_read_ptr(u32::try_from(
message.header.length().div_ceil(GSP_PAGE_SIZE),
)?);
...
}
Could modifying the length before this fetch cause the CPU to advance the
pointer by an arbitrary amount, desynchronizing the command queue and
potentially processing arbitrary data as commands?
Do follow-up patches in this series retain this same structure in other areas,
such as consume_element and RpcMessage::parse?
> + {
> + dev_err!(&self.dev, "GSP receive: bad checksum\n");
> + return Err(EIO);
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-cmdq-rpc-v4-0-c9ab8de1d3f2@nvidia.com?part=1
next prev parent reply other threads:[~2026-10-09 12:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 11:53 [PATCH v4 00/10] gpu: nova-core: gsp: prepare the command queue for r000 dual-message types Alexandre Courbot
2026-10-09 11:53 ` [PATCH v4 01/10] gpu: nova-core: gsp: cmdq: validate checksum earlier on receive Alexandre Courbot
2026-10-09 12:06 ` sashiko-bot [this message]
2026-10-09 11:53 ` [PATCH v4 02/10] gpu: nova-core: gsp: introduce and use proper RpcMessageHeader type Alexandre Courbot
2026-10-09 11:53 ` [PATCH v4 03/10] gpu: nova-core: gsp: cmdq: group the RPC-specific part of send_single_command Alexandre Courbot
2026-10-09 11:54 ` [PATCH v4 04/10] gpu: nova-core: gsp: cmdq: split the transport part of the send path Alexandre Courbot
2026-10-09 11:54 ` [PATCH v4 05/10] gpu: nova-core: gsp: cmdq: split RPC parsing part of the receive path Alexandre Courbot
2026-10-09 11:54 ` [PATCH v4 06/10] gpu: nova-core: gsp: cmdq: move RPC message logging to RpcMessage Alexandre Courbot
2026-10-14 1:00 ` Eliot Courtney
2026-10-14 1:35 ` Eliot Courtney
2026-10-09 11:54 ` [PATCH v4 07/10] gpu: nova-core: gsp: cmdq: split the transport part of the receive path Alexandre Courbot
2026-10-09 12:13 ` sashiko-bot
2026-10-09 11:54 ` [PATCH v4 08/10] gpu: nova-core: gsp: cmdq: move the RPC code into a sub-module Alexandre Courbot
2026-10-09 11:54 ` [PATCH v4 09/10] gpu: nova-core: gsp: move the RPC commands " Alexandre Courbot
2026-10-09 11:54 ` [PATCH v4 10/10] gpu: nova-core: gsp: add `rpc` to RPC message send/receive methods 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=sashiko-outbox-165477@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).