Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796208402; b=cfPisn887O75MIZD74V6RDG9VkHShG1urJ0QO8Llhpxx/iLbYDPxIwetiGWy+d+KvwD9 u/BH5HCjGjI0c7JG3UtWsl7w4zx/KgxIKpfWDz50OaESZX4Yi44iDJFWSYfi3h/x56YBg 8foewjUowARYyKJJkFQ7XD3waSxe6YK0l2QI0hRGOpXOxAg1f1XXxqeMY9J2sQm7jFunu QQ+88nLQq+/5yjqiTe0fAPgUF99h2ZYkzTROt5NgTQnM7BRMjGk3m9aq8krauk1R7aKMy NDceMeijEvwEQXn8yzoY0O9XMc3DdBF+xKoO5s9eazOJDEPHDV2u7h523aw2cBcgvQw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796208402; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=nlK7YBGPHA+qwy0kJpeZ1T3OfKvnXs17oWgABNioBEA=; b=LlaJDOAdo2zpEGOBM+bnXgpQOZ50Vu/emSehz7ONk2vEqHqMWVnZtIcWOgQTL+vFD/Wu zbvk6Yux8UW0A5brnVkSYvE1VsCuz8YrtZ78mQRkdpZtSaA9J6iuAW2q8ZxKlfu1NuTRI 7ppC/Ez6NS9hoapUqCjeNTsplKMJLuESimyBhZMRgXxnguygQrVCbrT/amEaL4cEaZLR1 8jFD0yLQG2n7Na0+Ra/mgJiBjiDNKwSCRqrocOxyKJOKdaDt7A/p/enXO19ZMMWlD9bcy o0ersUjTcbgwI9cGU2VmbKBmOb0b7j0g/kAlBKYJZxCssVG2nXnWudLykFm5wDHJ2RA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JL8a3uAi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AC77606A33B for ; Wed, 2 Dec 2026 10:46:41 +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=JL8a3uAi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B5A11F00896; Wed, 2 Dec 2026 10:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796208401; bh=nlK7YBGPHA+qwy0kJpeZ1T3OfKvnXs17oWgABNioBEA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=JL8a3uAiAOTc4E2Bb+bCtDf/LJMS1jBH2plS48+qTpq5XwN9yIOxdwuZ1LujJ3apD tt2SsLnRCDL4f5mqTF0E7mDoP8DQn43UvjlQ3uVmU5x2BBhsNkJpFYGEvU03QkpU3N Y87Mem61SNeK0v6XQkms19DQZNCSUqSzDSyB03PjhqhhiIy3C689ZjE27TjAPidoGw 9fyKFJhhBZTNtu3DlppGKEyMEXkg2urKzeFfF5otWKBzcq/yUhL+mgWfVXfgx1Ngdn SNwnvMUrHNrBdm4L4EAhTFWVZuYXUis2mRYxTEx4mTIEainBlNAvs8Ob02M+lGMCG8 FYCse49UREBzQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 4/4] drm/virtio: wire blob ioctl creation to userptr objects Reply-To: sashiko-reviews@lists.linux.dev To: "Honglei Huang" Cc: dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202101658.1209083-5-honghuan@amd.com> References: <20261202101658.1209083-1-honghuan@amd.com> <20261202101658.1209083-5-honghuan@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 10:46:41 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/virtio: out-of-bounds user page pinning in verify_blob() on size ALIGN() It also noticed 1 related pre-existing issue this patch does not introduce: - [Critical] drm/virtio: silent blob size truncation in verify_blob() [1] -- commit 47f959d0cfefd215bffd18078894e965cea40441 Author: Honglei Huang drm/virtio: wire blob ioctl creation to userptr objects This commit wires the blob resource creation ioctl to userptr objects, adds support for the VIRTIO_GPU_F_BLOB_READONLY feature, and adjusts blob size a= nd userptr alignment handling. > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/vir= tio/virtgpu_ioctl.c > index 81e70a12b3569..454d0e9a7d59d 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c [ ... ] > @@ -538,10 +565,16 @@ static int verify_blob(struct virtio_gpu_device *vg= dev, > params->blob =3D true; > params->blob_flags =3D rc_blob->blob_flags; > params->blob_hints =3D rc_blob->blob_hints; > + params->userptr =3D rc_blob->userptr; [Severity: Critical] This problem wasn't introduced by this patch, but does assigning the 64-bit rc_blob->size to params->size just above this [1] silently truncate blob sizes over 4 GB on 32-bit architectures? params->size is an unsigned long, so on 32-bit systems the upper 32 bits of rc_blob->size are discarded before alignment checks, allocation, and host command submission, allocating a smaller buffer than userspace requested. > - if (vgdev->has_blob_alignment && > - !IS_ALIGNED(params->size, vgdev->blob_alignment)) > - return -EINVAL; > + if (vgdev->has_blob_alignment) { > + params->size =3D ALIGN(params->size, > + max_t(uint32_t, vgdev->blob_alignment, > + PAGE_SIZE)); > + > + if (!IS_ALIGNED(params->userptr, vgdev->blob_alignment)) > + return -EINVAL; > + } > =20 > return 0; > } [Severity: High] When params->userptr is non-zero and vgdev->blob_alignment is larger than PAGE_SIZE, can rounding params->size up to vgdev->blob_alignment cause virtio_gpu_userptr_create() to pin guest pages past the end of the user-supplied buffer? Unlike shmem or VRAM blobs that allocate new backing storage of params->siz= e, virtio_gpu_userptr_init() sets userptr->npages =3D params->size >> PAGE_SHI= FT and virtio_gpu_userptr_get_pages() pins that many pages from current->mm starting at userptr->start. If userspace passes a userptr buffer whose size is not a multiple of vgdev->blob_alignment, the extra pages past rc_blob->userptr + rc_blob->size either fail in pin_user_pages_fast() with -EFAULT or pin and export unrelated pages from an adjacent VMA to the host device. [1] https://sashiko.dev/#/bug/linux-20577b57-1c85-44eb-8080-3e8c4e2bce2a --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202101658.1209= 083-1-honghuan@amd.com?part=3D4