On Wed, 8 Jul 2026 15:36:04 +0200 Cédric Le Goater <[email protected]> wrote:
> The vfio_known_safe_misalignment() whitelist (currently TPM CRB only) > requires a new entry every time a device exposes a non-page-aligned > region, which does not scale. Arguable as we have exactly one class of device so far that's validated as safe. > Replace it with a DMA capability check: a region that is not > page-aligned or is smaller than a host page can never be a valid DMA > target, so a page-offset mismatch is harmless and only traced. Only > warn for page-aligned, page-sized regions where the mismatch could > indicate a real mapping problem. But it's the composition into the address space and how that address space is defined to the guest that matters. Imagine a minimum counter example to the test presented here, a page-size range of RAM in the VM is composed by a device as two contiguous sub-page MemoryRegions. We only see the individual MRs here, they're each sub-page, the shape suggests they're not DMA targets, but together they map contiguously into the VM address space. KVM can trap and emulate them as normal RAM. QEMU emulated devices can DMA to them as RAM. VFIO cannot map them through the IOMMU. That is what this test is meant to validate. The judgment that the control register range for a TPM device presented as a RAM MR is not a meaningful DMA target for a vfio device is the thing that cannot be determined based only on the shape of the MR. > This removes the TPM CRB dependency from the VFIO listener and > eliminates the need for per-device whitelisting entirely. And removes the diagnostic it provided. Thanks, Alex
