Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16B8B606A31C for ; Sat, 28 Nov 2026 14:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=UdAaI07F Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4DAA710E148; Sat, 28 Nov 2026 14:18:57 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68CB410E752 for ; Sat, 28 Nov 2026 14:18:51 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 7987D614A2; Sat, 28 Nov 2026 14:18:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8B961F0089A; Sat, 28 Nov 2026 14:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795875530; bh=f2HKoKwTsICIunQ6n6p2IxwoOEx2fOwSbpPjYT8QIXk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=UdAaI07FaoviMSLUGRiuOp/tSOFQLX5cvJb1Gsk2a7imRJH044+ERrtQuMPpb5pr9 0qD0ttF7Ce1NyQGBM6grICVdmkZYj+OdbzDzOsREwhRCblN+VmCimeLIZxytRp4gM0 QK1e7dKhRkNXzjQGPEf+l35TnP9LKovFA+uHLbQZJIbEwkza52GyerL7wk6rTijnlt zFI8Hx+zFKUXciIj8H42GMg15iEXzE4s+mviuJnW62tCkc/p8oYaZuDrtBDbjQ26i7 elP4Y2LbP9tetfm2pq1JvTFD0Bv8eFjkMBLP7V7iQ94OgYlUBw4f0T+mNtEontkCRx N4J5nXRwciBSQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] accel/ethosu: validate strides, format, and overflow in feat_matrix_length() To: "Bilal Hashim" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261128140630.1172-1-AeeSec@126.com> References: <20261128140630.1172-1-AeeSec@126.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 14:18:47 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] accel/ethosu: missing Fixes trailer for feat_matrix_length() fix -- commit b15b9b8e0339b0188ac3731a239755db7038a2cd Author: Bilal Hashim > accel/ethosu: validate strides, format, and overflow in feat_matrix_lengt= h() > > 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 =3D addr + 1`. > > Signed-off-by: Bilal Hashim [Severity: Low] This fixes a bug in command stream validation introduced with the driver. Should this include: Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver") --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128140630.1172= -1-AeeSec@126.com?part=3D1