From: sashiko-bot@kernel.org
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" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH 5/5] vfio/pci: Refuse ioeventfds and dma-buf exports over excluded ranges
Date: Wed, 02 Dec 2026 09:42:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-245340@kernel.org> (raw)
In-Reply-To: <20261202093250.1683744-6-mhonap@nvidia.com>
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 <mhonap@nvidia.com>
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;
>
> - /* Disallow ioeventfds working around MSI-X table writes */
> - if (bar == vdev->msix_bar &&
> - !(pos + count <= vdev->msix_offset ||
> - pos >= vdev->msix_offset + vdev->msix_size))
> + if (vfio_pci_bar_range_excluded(vdev, bar, pos, count,
> + VFIO_PCI_EXCLUDE_WRITE))
> return -EINVAL;
>
> io = 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
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202093250.1683744-1-mhonap@nvidia.com?part=5
next prev parent reply other threads:[~2026-12-02 9:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:32 [PATCH 0/5] vfio/pci: Per-BAR excluded ranges mhonap
2026-12-02 9:32 ` [PATCH 1/5] vfio/pci: Move the excluded windows out of vfio_pci_core_do_io_rw() mhonap
2026-12-02 9:44 ` sashiko-bot
2026-12-02 9:32 ` [PATCH 2/5] vfio/virtio: Release vfio-pci-core state when legacy I/O setup fails mhonap
2026-12-02 9:32 ` [PATCH 3/5] vfio/pci: Add per-BAR excluded ranges and put the MSI-X table on them mhonap
2026-12-02 9:32 ` [PATCH 4/5] vfio/pci: Advertise the mmap areas around excluded ranges mhonap
2026-12-02 9:32 ` [PATCH 5/5] vfio/pci: Refuse ioeventfds and dma-buf exports over " mhonap
2026-12-02 9:42 ` sashiko-bot [this message]
2026-12-02 9:47 ` [PATCH 0/5] vfio/pci: Per-BAR " sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-245340@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=mhonap@nvidia.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.