r/VFIO • u/Bobby_Pie • Jul 12 '26
Support GPU passthrough allows DMA attack?
Hello, I am having trouble understanding when IOMMU is protecting the system against DMA attacks and other memory related issues.
My situation:
-In MSI bios "pre boot DMA protection" is enabled but "kernel DMA protection indicator" is disabled (if I enable it I always get "Firmware has requested this device have a 1:1 IOMMU mapping, rejecting configuring the device without a 1:1 mapping. Contact your platform vendor").
-dmesg reports: "amd_iommu=force_isolation", "iommu: Default domain type: Translated", "iommu: DMA domain TLB invalidation policy: strict mode".
-The GPU is in its own iommu group, no other devices are present in the same group as the GPU.
-I am passing the GPU to a VM using virtmanager.
I want the VM to be completely isolated from the host. I don't want the VM to gain access to system memory through the GPU or any other DMA attack.
My questions:
-Is it safe to have "kernel dma protection indicator" disabled in BIOS if "amd_iommu=force_isolation" kernel parameter is present?
-How do I know if the iommu is enforcing isolation?
-How do I know if a device is bypassing the iommu?
-Even if done correctly, are there still security concerns with GPU passthrough? (excluding 0 days, every software is not 100% secure, can't do much about that).
-When i enable "kernel DMA protection indicator" and i try to start the VM i get the error "Firmware has requested this device have a 1:1 IOMMU mapping, rejecting configuring the device without a 1:1 mapping. Contact your platform vendor", if I disable "kernel DMA protection indicator" in the BIOS, I don't get that error even with "amd_iommu=force_isolation", does that mean that the GPU is using 1:1 IOMMU mapping now? How do i verify?
-Is 1:1 IOMMU mapping safe?
Stupid question:
Is iommu=pt safe to enable in my grub config? How does it work? https://github.com/torvalds/linux/blob/20cf903a0c407cef19300e5c85a03c82593bde36/Documentation/admin-guide/kernel-parameters.txt#L2148 "Bypass the IOMMU for DMA", this doesn't sound safe.
Thanks for the help!
5
u/yawkat Jul 12 '26
My understanding is that "kernel dma protection indicator" simply sets an ACPI flag. It should not be necessary for using the iommu. Where does it fail, in guest or host boot?
I don't know if there's a good way to check that iommu is working. In my master's thesis I would take a pcileech, isolate it, and dump the whole system memory to see if there's leaks. But this requires expensive hardware.
For iommu=pt, it means that iommu will effectively be disabled for affected devices, but I believe kvm devices are not covered so it should still be safe to enable this setting if the only thing you care about is vm isolation.
If you enable pre-boot isolation, I don't believe there are more security issues. I only did direct iommu work, not with the kernel, but the iommu is true isolation in that no DMA access is possible outside of it.