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 12866606A322 for ; Wed, 2 Dec 2026 09:43:00 +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=T+YVdEZR Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7514A10FD0D; Wed, 2 Dec 2026 09:42:54 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 13A6910FD0D for ; Wed, 2 Dec 2026 09:42:49 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 589BC61D2B; Wed, 2 Dec 2026 09:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63CF11F000C1; Wed, 2 Dec 2026 09:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796204567; bh=XXTgJBWRslkSVH3Dx8EKprSNEilSB9g7KXKSC36JpKI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=T+YVdEZRUCYqq0dq3AuJUbj9PfGkcIqnsFAQeYx7tqQKHE330ITbX3IVhJNRTZeze sNKLT3j+KjlYW/1/K5AWWMskCFTBDbpEXQYIMn4NZBXkQCEZx2OeLlDSy+6/TiD6zV FNHTuuv3NutIzt5fQ/INyoga86cg9A4G7zWe+k/Vli7gNOyi05ZoEfwlji5O5liK90 XcMwe6TogH+7DnE2k0L9p0LTTmocYg/2D0kRXw1rSHsBwRs6nm9Fd4aYaRg+O8nnSA 1+YVn7JJYeDqNj2m+3GPJv6CEtTwWpAgPpd4orFy1BEfkgAHHfbGOCT5SpPD3S7jub zGIe3+tsnRETQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/5] vfio/pci: Refuse ioeventfds and dma-buf exports over excluded ranges To: mhonap@nvidia.com Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-cxl@vger.kernel.org, media-ci@linuxtv.org, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202093250.1683744-6-mhonap@nvidia.com> References: <20261202093250.1683744-1-mhonap@nvidia.com> <20261202093250.1683744-6-mhonap@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 09:42: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_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] vfio/pci: missing alignment check in vfio_pci_ioeventfd() [1] -- commit a0e0e83a63bca771356893cca68d9c824c8b8bc6 Author: Manish Honap vfio/pci: Refuse ioeventfds and dma-buf exports over excluded ranges This commit rejects ioeventfds that overlap write-excluded BAR ranges and dma-buf exports that overlap mmap-excluded BAR ranges. > diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci= _rdwr.c > index 04aed725325c4..e620798f90078 100644 > --- a/drivers/vfio/pci/vfio_pci_rdwr.c > +++ b/drivers/vfio/pci/vfio_pci_rdwr.c > @@ -475,10 +475,8 @@ int vfio_pci_ioeventfd(struct vfio_pci_core_device *= vdev, loff_t offset, > if (pos + count > pci_resource_len(pdev, bar)) > return -EINVAL; > =20 > - /* Disallow ioeventfds working around MSI-X table writes */ > - if (bar =3D=3D vdev->msix_bar && > - !(pos + count <=3D vdev->msix_offset || > - pos >=3D vdev->msix_offset + vdev->msix_size)) > + if (vfio_pci_bar_range_excluded(vdev, bar, pos, count, > + VFIO_PCI_EXCLUDE_WRITE)) > return -EINVAL; > =20 > io =3D vfio_pci_core_get_iomap(vdev, bar); [Severity: Critical] This problem wasn't introduced by this patch, but should vfio_pci_ioeventfd() reject an offset where pos is not naturally aligned to count [1]? Without an alignment check (such as !IS_ALIGNED(pos, count)), userspace can register an ioeventfd at an unaligned BAR offset. When the eventfd fires, vfio_pci_ioeventfd_do_write() passes the unaligned io + pos address to vfio_pci_core_iowriteN(), which triggers an unhandled alignment fault on device memory on architectures with strict MMIO alignment such as arm64. [1] https://sashiko.dev/#/bug/linux-37b4aa33-2a11-48a3-939f-b70ba1577441 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202093250.1683= 744-1-mhonap@nvidia.com?part=3D5