freenode
Kernel & Low-Level

Linux patch series holds drivers until devices are trusted

Leon Romanovsky's device-trust policy blocks binding until userspace authorizes hardware, with boot exceptions so attestation can still start.

A new Linux driver-core series would stop the kernel from binding drivers, including when userspace attaches one by hand, until a device has been authorized. The point is attestation: today a device can be probed and set up for DMA before userspace has decided it is safe to use.

Leon Romanovsky of NVIDIA wrote the series. It adds a shared trust policy in front of driver setup, rather than leaving authorization as a per-bus habit that drivers and the rest of the kernel cannot share. Each device gets a requested policy and an active trust level. Once a level is accepted, it stays fixed for the device's lifetime. A failed probe or an unbind does not reopen the decision, because hardware configuration and IOMMU state can outlive the driver. Cleanup is supposed to use the same assumptions as setup.

Without new boot options, existing behavior is unchanged: PCI keeps its ACPI and topology restrictions, and USB keeps its current authorized sysfs flow. Administrators can set a default of bus, blocked, adversarial, or unrestricted. Blocked holds every device until authorization. Adversarial allows binding but treats the hardware as potentially hostile. A global blocked policy would also lock out the disks and controllers needed to reach an initrd and perform attestation, so the series allows command-line exceptions by bus and device, and by bus and driver name, including for hardware discovered after boot. Those exceptions are meant to work with built-in drivers, so userspace does not have to win a race against early probing.

Writable sysfs policy requires an explicit boot opt-in, so ordinary systems do not suddenly gain a new way to change attachment rules. The read-only trust attribute reports the active level. Authorization is not identity or firmware verification, and allowing a driver to bind does not stop the device from starting DMA on its own.

PCI is the first bus wired in. External-facing and downstream-of-untrusted devices already start restricted; the series folds that classification into the common policy and drops PCI's separate untrusted flag so IOMMU domain selection and DMA bouncing follow trust instead. Romanovsky wrote that authorization does not yet revisit IOMMU domains or ATS decisions made at discovery. That integration is left for a later series. The stated first target is confidential-computing guests that have no IOMMU.

The series also fixes a USB userspace hole: only the generic USB driver was telling usbfs that a device had gone away, so a device unbound through sysfs could be unplugged without waking a process sleeping in poll. Disconnect now drains those waiters before the device is deleted.