From: sashiko-bot@kernel.org
To: "Mike Lothian" <mike@fireburn.co.uk>
Cc: ojeda@kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH v2 03/10] drm/vino: add the AES-CTR/AES-CMAC control-plane seal and arm sequence
Date: Fri, 03 Jul 2026 03:13:13 +0000 [thread overview]
Message-ID: <20260703031314.1B8B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703030217.2886-4-mike@fireburn.co.uk>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Use of sleeping `GFP_KERNEL` memory allocations and blocking USB operations in atomic KMS callbacks.
- [High] Constant mismatch in `aux_for_id` causes fallback misparsing for `cursor_image` messages.
- [Medium] The `seal` function fails to strip the stale MAC tag and append a fresh one, contradicting its explicit documentation.
--
commit 399a257fc41428dee57be4f93ca9bcdacd1d9785
Author: Mike Lothian <mike@fireburn.co.uk>
drm/vino: add the AES-CTR/AES-CMAC control-plane seal and arm sequence
This commit implements the post-AKE control-plane wire format for the vino
driver. It includes the AES-CTR seal, the Dl3Cmac trailer, the stream-open
arm marker, and message builders for mode-set, cursor, and DDC/CI.
> diff --git a/drivers/gpu/drm/vino/cp.rs b/drivers/gpu/drm/vino/cp.rs
> new file mode 100644
> index 0000000000000..4d55b96999b02
> --- /dev/null
> +++ b/drivers/gpu/drm/vino/cp.rs
[ ... ]
> +pub(super) fn cursor_image(
> + counter: u16,
> + head: u8,
> + w: u16,
> + h: u16,
> + bgra: &[u8],
> +) -> Result<KVec<u8>> {
> + // w*h*4 can wrap a 32-bit usize (max ~1.7e10 > u32::MAX), which would let an
> + // undersized bgra pass the check; compute it with checked arithmetic so an
> + // overflow is rejected as a mismatch rather than silently bypassing validation.
> + let expected = (w as usize)
> + .checked_mul(h as usize)
> + .and_then(|n| n.checked_mul(4));
> + if expected != Some(bgra.len()) {
> + return Err(EINVAL);
> + }
> + let mut b = KVec::with_capacity(32 + bgra.len(), GFP_KERNEL)?;
[Severity: High]
Does this allocate memory using a sleeping flag (GFP_KERNEL) while in an
atomic context?
When the compositor requests a frame flip or a cursor update, the DRM core
invokes the VinoPlane::atomic_update callback (which runs in an atomic
context). This atomic callback executes cp::cursor_image, which allocates
memory dynamically using GFP_KERNEL.
> + cursor_header(&mut b, 0x401c, 0x41, counter, head)?;
[Severity: High]
Will the 0x40 high-byte flag on this cursor image ID cause a mismatch in
aux_for_id()?
In aux_for_id(), we check for 0x1c for the cursor image:
0x1a => 0x04, // cursor move
0x1b => 0x03, // cursor create
0x1c => 0x02, // cursor image
0x1f => 0x0f,
Because aux_for_id() strictly checks for 0x1c instead of 0x401c, it will fall
through to the default arm and incorrectly return (body_len / 4) as u16,
rather than the expected 0x02 length marker.
> + pad_to(&mut b, 32)?; // off24..31 zero (no w/h here)
> + b.extend_from_slice(bgra, GFP_KERNEL)?; // bitmap @ off32
> + Ok(b)
> +}
[ ... ]
> +pub(super) fn seal(
> + ks: &[u8; 16],
> + riv: &[u8; 8],
> + seq: u32,
> + inner: &[u8],
> +) -> Result<KVec<u8>> {
> + // The interactive CP stream: session ks, wire sub 0x24.
> + seal_stream(ks, riv, 0x24, seq, inner)
[Severity: Medium]
Is the stale MAC tag properly stripped here?
The documentation for seal() explicitly mentions that we should encrypt only
content = inner[..len-16] and append a fresh tag. However, the implementation
delegates to a generic stream encrypter (seal_stream) on the entire inner
buffer, which ignores the requirement to slice off the stale tag and append a
live MAC.
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260703030217.2886-1-mike@fireburn.co.uk?part=3
next prev parent reply other threads:[~2026-07-03 3:13 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 15:12 [RFC PATCH 0/7] drm/vino: DisplayLink DL3 dock driver (RFC, help wanted) Mike Lothian
2026-06-17 15:12 ` [RFC PATCH 1/7] drm/vino: add DisplayLink DL3 dock skeleton and plaintext bring-up Mike Lothian
2026-06-17 15:17 ` Miguel Ojeda
2026-06-17 20:11 ` sashiko-bot
2026-06-18 10:39 ` Julian Braha
2026-06-17 15:12 ` [RFC PATCH 2/7] drm/vino: add the clean-room HDCP 2.2 AKE/LC/SKE Mike Lothian
2026-06-17 16:18 ` Eric Biggers
2026-06-17 20:12 ` sashiko-bot
2026-06-17 15:12 ` [RFC PATCH 3/7] drm/vino: add the AES-CTR/AES-CMAC control-plane seal and arm Mike Lothian
2026-06-17 20:15 ` sashiko-bot
2026-06-17 15:12 ` [RFC PATCH 4/7] drm/vino: add the Vino (RawRl mode-2) framebuffer codec Mike Lothian
2026-06-17 20:13 ` sashiko-bot
2026-06-17 15:12 ` [RFC PATCH 5/7] drm/vino: register a DRM/KMS device and scan out to EP08 Mike Lothian
2026-06-17 20:22 ` sashiko-bot
2026-06-17 15:12 ` [RFC PATCH 6/7] drm/vino: add DDC/CI brightness/contrast, DPMS power and DFU info Mike Lothian
2026-06-17 20:19 ` sashiko-bot
2026-06-17 15:12 ` [RFC PATCH 7/7] drm/vino: add KUnit self-tests for the protocol and crypto paths Mike Lothian
2026-06-17 20:18 ` sashiko-bot
2026-06-17 15:55 ` [RFC PATCH 0/7] drm/vino: DisplayLink DL3 dock driver (RFC, help wanted) Danilo Krummrich
2026-06-17 16:11 ` Mike Lothian
2026-07-03 3:02 ` [RFC PATCH v2 00/10] drm/vino: DisplayLink DL3 dock driver Mike Lothian
2026-07-03 3:02 ` [RFC PATCH v2 01/10] drm/vino: add DisplayLink DL3 dock skeleton and protocol framing Mike Lothian
2026-07-03 3:15 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 02/10] drm/vino: add the clean-room HDCP 2.2 AKE/LC/SKE handshake Mike Lothian
2026-07-03 3:14 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 03/10] drm/vino: add the AES-CTR/AES-CMAC control-plane seal and arm sequence Mike Lothian
2026-07-03 3:13 ` sashiko-bot [this message]
2026-07-03 3:02 ` [RFC PATCH v2 04/10] drm/vino: add the Vino framebuffer codec Mike Lothian
2026-07-03 3:21 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 05/10] drm/vino: add the DRM/KMS sink, built on the safe KMS mode-object layer Mike Lothian
2026-07-03 3:13 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 06/10] drm/vino: add the DisplayLink DL3 dock driver Mike Lothian
2026-07-03 3:18 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 07/10] drm/vino: wire the hardware cursor plane Mike Lothian
2026-07-03 3:11 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 08/10] drm/vino: wire CRTC gamma, plane rotation and DDC/CI monitor controls Mike Lothian
2026-07-03 3:20 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 09/10] drm/vino: two heads, 90/270 rotation, damage clips and connector probe Mike Lothian
2026-07-03 3:20 ` sashiko-bot
2026-07-03 3:02 ` [RFC PATCH v2 10/10] drm/vino: hrtimer-driven software vblank Mike Lothian
2026-07-03 3:21 ` sashiko-bot
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=20260703031314.1B8B01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mike@fireburn.co.uk \
--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.