From: sashiko-bot@kernel.org
To: "Rob Herring (Arm)" <robh@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 06/19] accel: ethosu: Track command stream register setup
Date: Sat, 05 Sep 2026 01:00:21 +0000 [thread overview]
Message-ID: <20260905010021.BA9AA1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904-ethosu-fixes-v2-6-3767738756a4@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] dma_params_valid() incorrectly returns U64_MAX in a boolean function, which evaluates to true and bypasses missing DMA parameter validation.
--
commit 6f2462930489d04d8fd80b48b9dfe3672578205e
Author: Rob Herring (Arm) <robh@kernel.org>
accel: ethosu: Track command stream register setup
The current method of tracking command stream state initializing state
tracking to illegal values and assuming unaccessed registers are 0 is
proving inadequate with additional validation. Instead, track all the
registers in a bitmap as the register address space is fairly small.
> diff --git a/drivers/accel/ethosu/ethosu_gem.c b/drivers/accel/ethosu/ethosu_gem.c
> index 408b93350dd79..8a44a5d89bce6 100644
> --- a/drivers/accel/ethosu/ethosu_gem.c
> +++ b/drivers/accel/ethosu/ethosu_gem.c
[ ... ]
> @@ -158,13 +185,54 @@ static u64 cmd_to_addr(u32 *cmd)
[ ... ]
> +static bool dma_params_valid(struct ethosu_device *edev, struct cmd_state *st,
> + const struct dma_state *dma_st,
> + const struct dma *dma,
> + u16 region_cmd, u16 addr_cmd)
> +{
> + s8 mode = dma->mode;
> +
> + if (!cmd_state_reg_is_set(st, region_cmd) ||
> + !cmd_state_reg_is_set(st, addr_cmd) ||
> + !cmd_state_reg_is_set(st, NPU_SET_DMA0_LEN) || mode < 0 || mode > 2)
> + return false;
> +
> + if (mode >= 1 &&
> + !cmd_state_reg_is_set(st, dma_use_src_stride(edev, dma_st, dma) ?
> + NPU_SET_DMA0_SRC_STRIDE0 :
> + NPU_SET_DMA0_DST_STRIDE0))
> + return U64_MAX;
[Severity: High]
Since dma_params_valid() returns a bool, does returning U64_MAX here get
converted to true?
If an attacker intentionally omits the stride command in a malicious stream,
could this evaluate as true and inadvertently bypass the validation check,
potentially leading to out-of-bounds DMA accesses using retained hardware
stride values?
> + if (mode == 2 &&
> + !cmd_state_reg_is_set(st, dma_use_src_stride(edev, dma_st, dma) ?
> + NPU_SET_DMA0_SRC_STRIDE1 :
> + NPU_SET_DMA0_DST_STRIDE1))
> + return U64_MAX;
[Severity: High]
Does returning U64_MAX here also inadvertently evaluate to true?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260904-ethosu-fixes-v2-0-3767738756a4@kernel.org?part=6
next prev parent reply other threads:[~2026-09-05 1:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 0:43 [PATCH v2 00/19] accel: ethosu: Another batch of fixes Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 01/19] accel: ethosu: Suspend after initialization Rob Herring (Arm)
2026-09-05 0:57 ` sashiko-bot
2026-09-08 12:41 ` Rob Herring
2026-09-05 0:43 ` [PATCH v2 02/19] accel: ethosu: Fix probe error cleanup Rob Herring (Arm)
2026-09-05 0:57 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 03/19] accel: ethosu: Disable clocks on PM setup failure Rob Herring (Arm)
2026-09-05 1:02 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 04/19] accel: ethosu: Quiesce jobs before scheduler teardown Rob Herring (Arm)
2026-09-05 1:00 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 05/19] accel: ethosu: Move DMA mode to src/dst struct Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 06/19] accel: ethosu: Track command stream register setup Rob Herring (Arm)
2026-09-05 1:00 ` sashiko-bot [this message]
2026-09-05 0:43 ` [PATCH v2 07/19] accel: ethosu: Factor buffer bounds checks Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 08/19] accel: ethosu: Validate secondary streams Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 09/19] accel: ethosu: Reject unsupported commands Rob Herring (Arm)
2026-09-05 1:05 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 10/19] accel: ethosu: Validate all feature map tiles Rob Herring (Arm)
2026-09-05 0:53 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 11/19] accel: ethosu: Account for feature map element size Rob Herring (Arm)
2026-09-05 0:56 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 12/19] accel: ethosu: Validate convolution parameter Rob Herring (Arm)
2026-09-05 0:53 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 13/19] accel: ethosu: Account for kernel dilation in IFM size Rob Herring (Arm)
2026-09-05 0:55 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 14/19] accel: ethosu: Reject reserved command encodings Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 15/19] accel: ethosu: Validate accumulator input Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 16/19] accel: ethosu: Restrict dynamic IFM2 weights Rob Herring (Arm)
2026-09-05 0:43 ` [PATCH v2 17/19] accel: ethosu: Split U65 and U85 DMA length validation Rob Herring (Arm)
2026-09-05 1:03 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 18/19] accel: ethosu: Validate OFM transpose Rob Herring (Arm)
2026-09-05 1:05 ` sashiko-bot
2026-09-05 0:43 ` [PATCH v2 19/19] accel: ethosu: Validate resize operations Rob Herring (Arm)
2026-09-05 1:05 ` 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=20260905010021.BA9AA1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@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.