CVE-2026-99450: vfio/nvgrace-gpu: Use a core-only open_device in fallback mode
In the Linux kernel, the following vulnerability has been resolved:
vfio/nvgrace-gpu: Use a core-only opendevice in fallback mode
When the ACPI memory properties are missing or the C2C link is down, the device is exposed through nvgracegpupcicoreops. That table opens through nvgracegpuopendevice() but closes through vfiopcicoreclosedevice(), so open and close are not symmetric.
nvgracegpuopendevice() registers nvdev->usemem for poison handling unconditionally. In fallback mode usemem.memlength is zero, and registerpfnaddressspace() inserts a node covering [0, ULONGMAX]. Nothing removes it: a second open fails with -EBUSY, and once the device is unbound the node outlives the nvdev that contains it. The next open after a rebind reports:
BUG: KASAN: slab-use-after-free in intervaltreeiterfirst+0x209/0x310 Read of size 8 at addr ffff88800894aa30 by task nvgracerepro/203 Call Trace: <TASK> dumpstacklvl+0x5d/0x80 printreport+0x153/0x4c6 kasanreport+0xe4/0x1a0 intervaltreeiterfirst+0x209/0x310 registerpfnaddressspace+0x97/0x100 nvgracegpuopendevice+0x21c/0x730 vfiodfopen+0x213/0x520 vfiodfioctlbindiommufd+0x3e8/0x6e0 vfiodevicefopsunlioctl+0x782/0x1570 x64sysioctl+0x13c/0x1c0 dosyscall64+0x106/0x630 entrySYSCALL64afterhwframe+0x77/0x7f </TASK>
Allocated by task 188: ... vfioallocdevice+0x3a/0x500 nvgracegpuprobe+0xcb/0x660 localpciprobe+0xcf/0x170 ...
Freed by task 188: ... kfree+0x20d/0x600 devicerelease+0xcf/0x250 kobjectput+0x152/0x2f0 pcideviceremove+0xb0/0x1c0 devicereleasedriverinternal+0x38d/0x540 unbindstore+0xde/0x100 ...
Give the fallback table its own opendevice that only calls vfiopcicoreenable() and vfiopcicorefinishenable(), the counterpart of vfiopcicoreclosedevice(). Fallback mode then never touches the nvgrace memory regions, as Alex suggested.
This should be safe because the fallback table uses the vfio-pci core read, write and mmap handlers, so nothing there uses the state nvgracegpuopendevice() sets up. The one visible difference is that a fallback open no longer fails when BAR0 cannot be mapped, which matches vfio-pci.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Give the VFIO fallback operations table its own open_device that uses the vfio-pci core-only open path, so opening and closing are symmetric and the fallback path does not register nvdev->usemem for poison handling.