From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
ojeda@kernel.org, dri-devel@lists.freedesktop.org,
"Danilo Krummrich" <dakr@kernel.org>,
gary@garyguo.net
Subject: Re: [PATCH v3 1/9] gpu: nova-core: gsp: cmdq: validate checksum earlier on receive
Date: Wed, 30 Sep 2026 15:12:40 +0000 [thread overview]
Message-ID: <20260930151240.B7C0B1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260930-cmdq-rpc-v3-1-91613f06520b@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] gpu: nova-core: TOCTOU race in GSP message checksum validation allows bypassing integrity checks
--
commit 7f9f9f297ff07c9a2fc40d814e38057d895893f1
Author: Alexandre Courbot <acourbot@nvidia.com>
gpu: nova-core: gsp: cmdq: validate checksum earlier on receive
The checksum validation error message of wait_for_msg() prints the
message's sequence number before validating the checksum. But the
checksum is part of the transport layer, and it not validating indicates
a corruption. Thus, this commit moves the checksum validation before
we start looking at the message header, and drops the sequence number
from the error message.
> diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
> index a5595da23407b..d293d28b09674 100644
> --- a/drivers/gpu/nova-core/gsp/cmdq.rs
> +++ b/drivers/gpu/nova-core/gsp/cmdq.rs
> @@ -768,6 +768,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()),
[Severity: High]
Does this regression create a TOCTOU race condition in wait_for_msg()?
header appears to map directly to DMA memory, and header.length() is
read here for the first time to determine the boundaries for the checksum
validation.
If the GSP (or a hardware glitch) modifies the length field in DMA to a
larger value after this checksum passes, it is read again further down in
wait_for_msg():
let payload_length = header.payload_length();
// Check that the driver read area is large enough for the message.
if slice_1.len() + slice_2.len() < payload_length {
return Err(EIO);
}
Could this secondary read use the modified length, causing the slices to be
truncated using the corrupted length and bypassing the integrity check for
the unverified data passed to the RPC handler?
> + ) != 0
> + {
> + dev_err!(&self.dev, "GSP receive: bad checksum\n");
> + return Err(EIO);
> + }
> +
> dev_dbg!(
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-cmdq-rpc-v3-0-91613f06520b@nvidia.com?part=1
next prev parent reply other threads:[~2026-09-30 15:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 14:55 [PATCH v3 0/9] gpu: nova-core: gsp: prepare the command queue for r000 dual-message types Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 1/9] gpu: nova-core: gsp: cmdq: validate checksum earlier on receive Alexandre Courbot
2026-09-30 15:12 ` sashiko-bot [this message]
2026-09-30 14:55 ` [PATCH v3 2/9] gpu: nova-core: gsp: introduce and use proper RpcMessageHeader type Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 3/9] gpu: nova-core: gsp: cmdq: group the RPC-specific part of send_single_command Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 4/9] gpu: nova-core: gsp: cmdq: split the transport part of the send path Alexandre Courbot
2026-10-01 2:21 ` Eliot Courtney
2026-10-09 2:27 ` Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 5/9] gpu: nova-core: gsp: cmdq: split RPC parsing part of the receive path Alexandre Courbot
2026-10-01 4:04 ` Eliot Courtney
2026-10-09 6:36 ` Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 6/9] gpu: nova-core: gsp: cmdq: split the transport " Alexandre Courbot
2026-09-30 15:15 ` sashiko-bot
2026-10-01 4:48 ` Eliot Courtney
2026-10-09 11:00 ` Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 7/9] gpu: nova-core: gsp: cmdq: move the RPC code into a sub-module Alexandre Courbot
2026-10-01 5:12 ` Eliot Courtney
2026-10-09 2:16 ` Alexandre Courbot
2026-10-09 2:19 ` Alexandre Courbot
2026-10-09 6:46 ` Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 8/9] gpu: nova-core: gsp: move the RPC commands " Alexandre Courbot
2026-09-30 14:55 ` [PATCH v3 9/9] 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=20260930151240.B7C0B1F00893@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.