The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Bilal Hashim <AeeSec@126.com>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Oded Gabbay <ogabbay@kernel.org>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] accel/ethosu: validate strides, format, and overflow in feat_matrix_length()
Date: Fri, 4 Dec 2026 14:48:31 -0600	[thread overview]
Message-ID: <20261204204831.GA1201682-robh@kernel.org> (raw)
In-Reply-To: <20261128140630.1172-1-AeeSec@126.com>

On Sat, Nov 28, 2026 at 10:06:30PM +0800, Bilal Hashim wrote:
> In ethosu_gem_cmdstream_copy_and_validate(), `cmd_state_init()` fills
> `struct cmd_state` with `0xff` so that missing setup commands can be
> detected (leaving `s64 stride_x`, `stride_y`, and `stride_c` equal to
> `-1`).
> 
> However, `feat_matrix_length()` never checks whether `fm->stride_y`,
> `fm->stride_x`, or `fm->stride_c` are negative (uninitialized), does not
> reject invalid format values `(fm->precision >> 6) & 0x3` greater than 1,
> and performs unchecked arithmetic on `addr` and `addr + 1`. If a command
> stream omits a stride setup command, multiplying by `-1` shrinks `addr`
> below `fm->base[tile]`, underestimating `info->region_size[fm->region]`
> and weakening the BO bounds check in `ethosu_ioctl_submit_job()`.
> 
> Reject negative strides and unknown formats, and use `check_mul_overflow`
> and `check_add_overflow` when computing `addr` and `end = addr + 1`.

This is not complete.

See v5 of my validation fixes series.

Rob

      reply	other threads:[~2026-12-04 20:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 14:06 [PATCH] accel/ethosu: validate strides, format, and overflow in feat_matrix_length() Bilal Hashim
2026-12-04 20:48 ` Rob Herring [this message]

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=20261204204831.GA1201682-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=AeeSec@126.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ogabbay@kernel.org \
    --cc=tomeu@tomeuvizoso.net \
    /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