KernelScan.io

HIGH

vfio/cdx MSI UAF

CVE-2026-46036

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI6.3MEDIUM

01

In the Linux kernel, the following vulnerability has been resolved: vfio/cdx: Serialize VFIO_DEVICE_SET_IRQS with a per-device mutex vfio_cdx_set_msi_trigger() reads vdev->config_msi and operates on the vdev->cdx_irqs array based on its value, but provides no serialization against concurrent VFIO_DEVICE_SET_IRQS ioctls. Two callers can race such that one observes config_msi as set while another clears it and frees cdx_irqs via vfio_cdx_msi_disable(), resulting in a use-after-free of the cdx_irqs array. Add a cdx_irqs_lock mutex to struct vfio_cdx_device and acquire it in vfio_cdx_set_msi_trigger(), which is the single chokepoint through which all updates to config_msi, cdx_irqs, and msi_count flow, covering both the ioctl path and the close-device cleanup path. This keeps the test of config_msi atomic with the subsequent enable, disable, or trigger operations. Drop the pre-call !cdx_irqs test from vfio_cdx_irqs_cleanup() as part of this change: the optimization it provided is redundant with the !config_msi early-return inside vfio_cdx_msi_disable(), and leaving the test in place would be an unsynchronized read of state the new lock is meant to protect.

02

Engine v0.2.0

Risk summary

Local attackers with CAP_SYS_RAWIO privileges (root or equivalent) can trigger a use-after-free vulnerability through concurrent VFIO_DEVICE_SET_IRQS ioctl calls against VFIO CDX devices. Successful exploitation can lead to kernel memory corruption, privilege escalation, or system crashes on systems with CDX hardware and VFIO passthrough enabled.

Affecteddrivers/vfio/cdx/intr.c (VFIO CDX driver)

Vulnerability analysis

The vulnerability stems from a race condition in vfio_cdx_set_msi_trigger() where multiple threads can concurrently access the vdev->config_msi flag and vdev->cdx_irqs array without proper synchronization. One thread can observe config_msi as set and proceed to operate on cdx_irqs, while another thread simultaneously clears config_msi and frees the cdx_irqs array via vfio_cdx_msi_disable(), resulting in use-after-free access. The fix introduces a per-device mutex (cdx_irqs_lock) that serializes all operations on the MSI configuration state, ensuring atomic test-and-operate sequences. The attack surface is local-only and requires privileged access to VFIO device files, which is gated by CAP_SYS_RAWIO.

03

BranchFixed inPatch commit
6.126.12.86ddf96e23c366
6.186.18.277b436ade16cc
7.07.0.47530f34ec0ca
mainline7.1-rc1670e8864b1a2