[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250426212253.40473-1-chath@bu.edu>
Date: Sat, 26 Apr 2025 21:22:47 +0000
From: Chathura Rajapaksha <chathura.abeyrathne.lk@...il.com>
To: kvm@...r.kernel.org
Cc: Chathura Rajapaksha <chath@...edu>,
Alex Williamson <alex.williamson@...hat.com>,
Paul Moore <paul@...l-moore.com>,
Eric Paris <eparis@...hat.com>,
Giovanni Cabiddu <giovanni.cabiddu@...el.com>,
Xin Zeng <xin.zeng@...el.com>,
Yahui Cao <yahui.cao@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Kevin Tian <kevin.tian@...el.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Yunxiang Li <Yunxiang.Li@....com>,
Dongdong Zhang <zhangdongdong@...incomputing.com>,
Avihai Horon <avihaih@...dia.com>,
linux-kernel@...r.kernel.org,
audit@...r.kernel.org
Subject: [RFC PATCH 0/2] vfio/pci: Block and audit accesses to unassigned config regions
Some PCIe devices trigger PCI bus errors when accesses are made to
unassigned regions within their PCI configuration space. On certain
platforms, this can lead to host system hangs or reboots.
The current vfio-pci driver allows guests to access unassigned regions
in the PCI configuration space. Therefore, when such a device is passed
through to a guest, the guest can induce a host system hang or reboot
through crafted configuration space accesses, posing a threat to
system availability.
This patch series introduces:
1. Support for blocking guest accesses to unassigned
PCI configuration space, and the ability to bypass this access control
for specific devices. The patch introduces three module parameters:
block_pci_unassigned_write:
Blocks write accesses to unassigned config space regions.
block_pci_unassigned_read:
Blocks read accesses to unassigned config space regions.
uaccess_allow_ids:
Specifies the devices for which the above access control is bypassed.
The value is a comma-separated list of device IDs in
<vendor_id>:<device_id> format.
Example usage:
To block guest write accesses to unassigned config regions for all
passed through devices except for the device with vendor ID 0x1234 and
device ID 0x5678:
block_pci_unassigned_write=1 uaccess_allow_ids=1234:5678
2. Auditing support for config space accesses to unassigned regions.
When enabled, this logs such accesses for all passthrough devices.
This feature is controlled via a new Kconfig option:
CONFIG_VFIO_PCI_UNASSIGNED_ACCESS_AUDIT
A new audit event type, AUDIT_VFIO, has been introduced to support
this, allowing administrators to monitor and investigate suspicious
behavior by guests.
This proposal is intended to harden VFIO passthrough in environments
where guests are untrusted or system reliability is critical.
Any feedback and comments are greatly appreciated.
Chathura Rajapaksha (2):
block accesses to unassigned PCI config regions
audit accesses to unassigned PCI config regions
drivers/vfio/pci/Kconfig | 12 +++
drivers/vfio/pci/vfio_pci_config.c | 164 ++++++++++++++++++++++++++++-
include/uapi/linux/audit.h | 1 +
3 files changed, 176 insertions(+), 1 deletion(-)
base-commit: f1a3944c860b0615d0513110d8cf62bb94adbb41
--
2.34.1
Powered by blists - more mailing lists