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 DE5E4606A31C for ; Mon, 30 Nov 2026 01:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lgWQFjOT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 501AD10ED08; Mon, 30 Nov 2026 01:48:32 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7CCB610ED08 for ; Mon, 30 Nov 2026 01:48:26 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 19AEE41E73; Mon, 30 Nov 2026 01:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD3631F00897; Mon, 30 Nov 2026 01:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796003306; bh=AK/730WPAiAdrGV+ziIH7ZzEgEeNmC816ezLJe6pIOk=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=lgWQFjOTklLEI+jDtZgllKzcpuHWj0UZtouGQ/SyS/TzzbJfoLWkvVUOMxV+8Jjkq Os37pYeRtKTr5Bw/2EvOrX4CABp8dm9GXtgjM3yFuwyaH8KFpO679t13It7trRVgZZ RJzI1m/+763V/phewmOxifWUq5WXLQqspwFK3YOl9ne1WwgWBQiTBz6WEchTxksYcg KRjCca07YPkrBc9tYPKZoB9Tm6oghSnWx949giGzAdTsPIH4zYibNwi+vgkPGFm/zs vppGlqfHwf7m0QATw/QinHPK7wqwR48wHewJ2xQNF9udYOZaE4hrRk++bxhHQ4mnDN 0aB0ZE16Qzmqw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH V1 3/4] accel/amdxdna: Handle AIE4 firmware notifications To: "David Zhang" , dri-devel@lists.freedesktop.org In-Reply-To: <20261130014038.712239-4-yidong.zhang@amd.com> References: <20261130014038.712239-1-yidong.zhang@amd.com> <20261130014038.712239-4-yidong.zhang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 01:48:25 +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_PATCH,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 no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] accel/amdxdna: integer overflow in mailbox_get_msg() [1] -- commit 947637099961f0f7905dd904b64d8a95cfacaf39 Author: Nishad Saraf accel/amdxdna: Handle AIE4 firmware notifications This commit adds an optional mailbox handler for message ID 0 firmware notifications and uses it on the AIE4 management channel to reset contexts = on context errors. > diff --git a/drivers/accel/amdxdna/amdxdna_mailbox.c b/drivers/accel/amdx= dna/amdxdna_mailbox.c > index c4701b2703d7b..cd65ca74077bd 100644 > --- a/drivers/accel/amdxdna/amdxdna_mailbox.c > +++ b/drivers/accel/amdxdna/amdxdna_mailbox.c [ ... ] > @@ -302,6 +304,15 @@ mailbox_get_resp(struct mailbox_channel *mb_chann, s= truct xdna_msg_header *heade > u32 slot; > =20 > msg_id =3D header->id; > + if (!msg_id && mb_chann->async_cb) { > + ret =3D mb_chann->async_cb(mb_chann->async_handle, header->opcode, > + data, header->total_size); [Severity: Critical] This problem wasn't introduced by this patch, but can header.total_size overflow msg_size in mailbox_get_msg() [1]? drivers/accel/amdxdna/amdxdna_mailbox.c:mailbox_get_msg() { ... header.total_size =3D readl(read_addr); ... msg_size =3D sizeof(header) + header.total_size; if (msg_size > ringbuf_size - head || msg_size > tail - head) { MB_WARN_ONCE(mb_chann, "Invalid message size %d, tail %d, head %d", msg_size, tail, head); return -EINVAL; } ... } If firmware supplies a large header.total_size (such as U32_MAX - 7), the 32-bit addition wraps to a small msg_size that passes the ring buffer bounds checks, allowing out-of-bounds MMIO reads in mailbox_get_resp(). [1] https://sashiko.dev/#/bug/linux-651c2021-a4b0-4ec5-9ff6-66bd56f73027 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130014038.7122= 39-1-yidong.zhang@amd.com?part=3D3