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 CCFED606A320 for ; Mon, 30 Nov 2026 20:16:47 +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=TNfuNkt+ Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1C42210F43F; Mon, 30 Nov 2026 20:16:42 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BC5310F425 for ; Mon, 30 Nov 2026 20:16:36 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 48AEB61848; Mon, 30 Nov 2026 20:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7151F000C1; Mon, 30 Nov 2026 20:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796069794; bh=V2dIP/Cx9YwByUksqF0QkFyN8D/ARmvunIOUji5YR9o=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=TNfuNkt+jsuoGlI+anUj/7azKTi2/EfJyji1/wSNBI0jHS4KwJZSgiSeHdTl5JCej 63Yk43e1RBb6e8RlquS2qFnvBy/4LN3r21L31d/yvmV6yn9djXqiIow2XE+37qAykN zomLEZz05ihE0UJVxXZDh2MAcrcV5v0sMREcie9Fpis8auEZqWmcmF0Q4rdV5ig5gd xa2nr68Zy7bhkFTlU3q/6xr3EUHTYzqbdlrIQMgfAOqcTEk/FkXoma++W9ximhhrbi YrfdYEe8wsFp0TXjfJ9pyBYVyt/ksN9Sqo+xaydMhgRmKXdlYEhOrtO44lmPC1H3Cb 6Vm7zDKH8VRGA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCHv2] drm/amdgpu: reject errored peers in UALink local vPod integrity check To: "Mukul Joshi" , amd-gfx@lists.freedesktop.org In-Reply-To: <20261130195618.524940-1-mukul.joshi@amd.com> References: <20261130195618.524940-1-mukul.joshi@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 20:16:33 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "amd-gfx" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,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 2 potential issues to consider: - [Medium] drm/amdgpu: incomplete errored peer checks in __check_local_vpod_integrity() - [Low] drm/amdgpu: Fixes trailer references non-ancestor commit 448a35158bee -- commit 0a504a5dd615fecadbcd56a1b790ee1d0ec2fcc6 Author: Mukul Joshi > drm/amdgpu: reject errored peers in UALink local vPod integrity check > > AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state, so > a local peer in the error state passes both the "pPod configured" and > "vPod configured" checks in __check_local_vpod_integrity() and is > treated as a healthy vPod member. The local vPod is then activated > around an accelerator that cannot participate. > > The error state is also entered when pPod validation fails, in which > case the peer's accel_id is unvalidated firmware data and is used to > index vpod.active_accel_bits without a bounds check. > > Handle errored peers explicitly: fail the integrity check if the peer > is a member of this vPod, and skip it otherwise. If the peer's > accel_id is out of range, its membership cannot be determined, so > treat it as a member and fail the check rather than risk activating > the vPod without it. > > Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP config") > Reported-by: Sashiko-bot > Signed-off-by: Mukul Joshi [Severity: Low] Commit 448a35158bee ("drm/amdgpu: Assign accel state based on ASP config") is not an ancestor of this branch; __check_local_vpod_integrity() was introduced on this branch by commit 0e8eb0dcea51 ("drm/amdgpu: Assign accel state based on ASP config"). Should the Fixes: tag reference 0e8eb0dcea51 ("drm/amdgpu: Assign accel state based on ASP config") instead? > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm= /amd/amdgpu/amdgpu_ualink.c > index fa4c3d27d2720..ae591c6ff6c42 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c > @@ -1179,6 +1179,20 @@ static int __check_local_vpod_integrity(struct amd= gpu_device *adev) > } > =20 > accel_id =3D peer_info->ppod.accel_id; > + /* An errored peer's accel_id may have failed validation, in > + * which case its vPod membership is unknown: treat it as a > + * member. > + */ > + if (peer_info->accel_state =3D=3D AMDGPU_UALINK_ACCEL_STATE_ERROR) { > + if (accel_id >=3D AMDGPU_UALINK_ACCEL_MAX || > + test_bit(accel_id, info->vpod.active_accel_bits)) { > + dev_warn(adev->dev, > + "UALINK: integrity fail: errored peer accel_id=3D%u is or may be a= vpod member\n", > + accel_id); > + return -EINVAL; > + } > + continue; > + } > if (!test_bit(accel_id, info->vpod.active_accel_bits)) > continue; > /* peer device vpod not configured */ [Severity: Medium] Can an errored peer whose pPod validation failed still be skipped here if its unvalidated accel_id happens to be below AMDGPU_UALINK_ACCEL_MAX? __check_ppod_info() also fails when ppod->size is 0 or exceeds AMDGPU_UALINK_ACCEL_MAX, or when ppod->accel_id >=3D ppod->size (for example, accel_id =3D 8 on an 8-GPU pPod where active_accel_bits only has bits in 0..7). In those cases accel_id < AMDGPU_UALINK_ACCEL_MAX and test_bit(accel_id, info->vpod.active_accel_bits) is false, so __check_local_vpod_integrity() skips the peer and activates the vPod even though the peer's accel_id failed validation and its membership is unknown. Also, if a peer enters AMDGPU_UALINK_ACCEL_STATE_ERROR with matching ppod.id and vpod.id (__is_vpod_peer(info, peer_info) is true) while its accel_id is not set in info->vpod.active_accel_bits, the first loop skips it via continue, and the second loop in __check_local_vpod_integrity() then overwrites peer_info->n_local_accels and peer_info->local_accels on that errored peer because it only checks __is_vpod_peer(info, peer_info). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130195618.5249= 40-1-mukul.joshi@amd.com?part=3D1