From mboxrd@z Thu Jan 1 00:00:00 1970 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 EB5CC606A31A for ; Wed, 2 Dec 2026 06:21:57 +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=c1dlqIct Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53DA910E24D; Wed, 2 Dec 2026 06:21:52 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B99710E24D for ; Wed, 2 Dec 2026 06:21:46 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 569AD61C7B; Wed, 2 Dec 2026 06:21:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE8411F008A0; Wed, 2 Dec 2026 06:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796192505; bh=WmwYhwHr46p2aJ3BVQs/58f1rAcTztBOM/6kMxxZzBE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=c1dlqIctk9JQZ33MuwT3kQ3jaACeZOMEccuYTCR7uglnpeukLPPxhhoRK8Lar7UCD nytFgHQTNnxzGOqFEMQkhm1sbFmwoIZ6Md6hmgiCcM/bI+wNRVe28G6F9dq08nD99G 0UYUV6kBurlz3nFWyEvpXGhoibgz9/GmKGqAChVjBARFGCI2Qm9n4ipbhTbze1JG9a yTotTg3F8u4yPLdDtKFjeKNc1tq1Ys4M/Z69par4KtLqVWQ97Hb3ZEmxQSwcu+ejr5 WkQyPp5T2gDOBQ/r/uwm4x6TrQ0fPYrCZnNhVF9CRnrIcbQFkgHHDcPPZ8yrI0GaTT YsQXwvO+XJBiw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/imagination: Add padding field check for GPU info query To: "Brajesh Gupta" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261202-dev_query_ioctl_fix-v1-1-853cc03874b7@imgtec.com> References: <20261202-dev_query_ioctl_fix-v1-1-853cc03874b7@imgtec.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 06:21:44 +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 1 potential issue to consider: - [Medium] drm/imagination: PVR_UOBJ_MIN_SIZE() omits _padding_c for gpu_info query -- commit cd677bd5a1613ad8844eebb1535c2ad50d57f5e9 Author: Brajesh Gupta drm/imagination: Add padding field check for GPU info query This commit updates pvr_dev_query_gpu_info_get() to copy the userspace struct drm_pvr_dev_query_gpu_info and reject non-zero _padding_c values. > diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imag= ination/pvr_drv.c > index 2d522a8e46ad6..566d5d3738622 100644 > --- a/drivers/gpu/drm/imagination/pvr_drv.c > +++ b/drivers/gpu/drm/imagination/pvr_drv.c > @@ -365,6 +365,12 @@ pvr_dev_query_gpu_info_get(struct pvr_device *pvr_de= v, > return 0; > } > =20 > + err =3D PVR_UOBJ_GET(gpu_info, args->size, args->pointer); > + if (err < 0) > + return err; > + if (gpu_info._padding_c) > + return -EINVAL; [Severity: Medium] Can userspace bypass the gpu_info._padding_c check by passing args->size =3D=3D 12? In drivers/gpu/drm/imagination/pvr_drv.h, PVR_UOBJ_MIN_SIZE() still declares struct drm_pvr_dev_query_gpu_info with num_phantoms as its last required field rather than _padding_c: drivers/gpu/drm/imagination/pvr_drv.h: PVR_UOBJ_DECL(struct drm_pvr_dev_query_gpu_info, num_phantoms) \ PVR_UOBJ_DECL(struct drm_pvr_dev_query_runtime_info, cdm_max_local_mem_siz= e_regs) \ PVR_UOBJ_DECL(struct drm_pvr_dev_query_quirks, _padding_c) \ PVR_UOBJ_DECL(struct drm_pvr_dev_query_enhancements, _padding_c) \ Because min_stride is 12 bytes instead of 16, PVR_UOBJ_GET() accepts args->size values in the range 12..15, copies only those bytes from userspace, and leaves the uncopied bytes of gpu_info._padding_c zeroed in kernel memory. Updating PVR_UOBJ_DECL() for struct drm_pvr_dev_query_gpu_info to use _padding_c, matching the quirks and enhancements queries, would enforce the full 16-byte minimum size. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202-dev_query_= ioctl_fix-v1-1-853cc03874b7@imgtec.com?part=3D1