From: Andrea Parri <parri.andrea@gmail.com>
To: Alex Williamson <alex@shazbot.org>, Ankit Agrawal <ankita@nvidia.com>
Cc: Andrea Parri <parri.andrea@gmail.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Yishai Hadas <yishaih@nvidia.com>,
Shameer Kolothum <skolothumtho@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>,
Jiaqi Yan <jiaqiyan@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] vfio/nvgrace-gpu: Separate the fallback-mode open_device
Date: Thu, 15 Oct 2026 10:19:33 +0200 [thread overview]
Message-ID: <20261015081937.405320-1-parri.andrea@gmail.com> (raw)
In fallback mode, where the ACPI memory properties are missing or the
C2C link is down, nvgrace-gpu opens a device through
nvgrace_gpu_open_device() but closes it through
vfio_pci_core_close_device(). The open registers an empty usemem range
for poison handling that nothing unregisters, so a second open fails
with -EBUSY, and the first open after an unbind hits a KASAN
slab-use-after-free in register_pfn_address_space().
Patch 1 gives the fallback table its own open_device, as Alex suggested
on v1, and is marked for stable. Patch 2 drops a usemem length check
in nvgrace_gpu_open_device() that only existed for fallback mode.
Tested on x86-64 under virtme-ng with KASAN, not on Grace hardware. A
QEMU cxl-type3 function, bound through driver_override, takes the
fallback path and is opened through a noiommu VFIO cdev. On v7.3-rc7
the second open fails with -EBUSY and the open after unbind and rebind
reports the use-after-free. With patch 1, and with the whole series,
neither happens. Patch 2 only affects full mode, which this setup
cannot reach.
Changes in v2:
- Replace the usemem.memlength guards with a core-only open_device for
the fallback table (Alex)
- Add patch 2
- Fallback open no longer fails when BAR0 cannot be mapped; Ankit
confirmed fallback mode does not need that check
- Rebase on v7.3-rc7
v1: https://lore.kernel.org/r/20260925161024.189771-1-parri.andrea@gmail.com/
Andrea Parri (2):
vfio/nvgrace-gpu: Use a core-only open_device in fallback mode
vfio/nvgrace-gpu: Drop the usemem length check in open_device
drivers/vfio/pci/nvgrace-gpu/main.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.53.0
next reply other threads:[~2026-10-15 8:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 8:19 Andrea Parri [this message]
2026-10-15 8:19 ` [PATCH v2 1/2] vfio/nvgrace-gpu: Use a core-only open_device in fallback mode Andrea Parri
2026-10-15 8:19 ` [PATCH v2 2/2] vfio/nvgrace-gpu: Drop the usemem length check in open_device Andrea Parri
2026-10-15 20:26 ` [PATCH v2 0/2] vfio/nvgrace-gpu: Separate the fallback-mode open_device Alex Williamson
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=20261015081937.405320-1-parri.andrea@gmail.com \
--to=parri.andrea@gmail.com \
--cc=alex@shazbot.org \
--cc=ankita@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jiaqiyan@google.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=skolothumtho@nvidia.com \
--cc=yishaih@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®