It will cause problems if the guest uses it… ! (Currently, most OSs does not utilize IOMMU by default) BitVisor and AMD IOMMU 2019-12-12 BitVisor Summit 8 8
attacks are now common ThunderClap [NDSS’19] Protect from buggy device drivers For virtualization BitVisor now supports (unsafe) nested virtualization (For my research) VTD_TRANS only protects BitVisor, not the guest 2019-12-12 BitVisor Summit 8 9 CC-BY Brett Gutstein 2019
Address Translation” enables nested translations, but currently no hardware is available We need IOMMU emulation i.e. vIOMMU This is BitVisor. Only emulate necessary parts! 2019-12-12 BitVisor Summit 8 11
= b Dev=0, Fun=0 Dev=31, Fun=7 Bus = 0 Bus = 255 Root Table Context Table For Bus = b Root Table Address Register Dev=d, Fun=f Second-Level Page Table Structures This is what current HW supports
Fun=0 Dev=31, Fun=7 Bus = 0 Bus = 255 Root Table Context Table For Bus = b Root Table Address Register Second-Level Page Table Structures P=1 P=1 TT=0 Translation Type
Fun=0 Dev=31, Fun=7 Bus = 0 Bus = 255 Root Table Context Table For Bus = b Root Table Address Register Second-Level Page Table Structures P=1 P=1 TT=10 If TT=10, untranslated requests are processed as pass-through. (i.e., no address translation is performed) Translation Type
Show DMAR in ACPI Table Allow to access to the VT-d registers Shadow DMA remapping table so that devices managed by BitVisor can DMA If we need no protection to BitVisor, simply Copy root and context table. No need to copy second level page structures. Set TT=10 for devices managed by BitVisor 2019-12-12 BitVisor Summit 8 19
specification allow no explicit IOMMU TLB invalidation if an entry is not on the cache That is, the guest may add new entries w/o IOMMU TLB invalidation Configuring EPT for all entry pages is troublesome The Savior Caching Mode (CM) 2019-12-12 BitVisor Summit 8 21
spec If CM=1, “Any software updates to the remapping structures […] require explicit invalidation.” “Hardware implementations of this architecture must support a value of 0 in this field.”
structures Ensure that the mappings do not contain BitVisor’s memory region Shadowing is necessary even if the mapping does not contain BitVisor’s memory region because the guest might ignore caching mode and implicitly update the entry Create remapping table for BitVisor managed devices (like what VTD_TRANS does) 2019-12-12 BitVisor Summit 8 24
Emulation, ATC’11, https://www.usenix.org/conference/usenixatc11/viommu-efficient-iommu-emulation M. Marka et al., rIOMMU: Efficient IOMMU for I/O Devices that Employ Ring Buffers, ASPLOS’15. O. Peleg et al., Utilizing the IOMMU Scalably, ATC’15. A. Markuze et al., True IOMMU Protection from DMA Attacks: When Copy is Faster than Zero Copy, ASPLOS’16. A. Markuze et al., DAMN: Overhead-free IOMMU protection for networking, ASPLOS’18. B. Morgan et al., IOMMU protection against I/O attacks: a vulnerability and a proof of concept, Journal of the Brazilian Computer Society 2018. A. Theodore Markettos et al., Thunderclap: Exploring Vulnerabilities in Operating System IOMMU Protection via DMA from Untrustworthy Peripherals, NDSS’19, https://thunderclap.io/ 2019-12-12 BitVisor Summit 8 30
level design doc V3, 2016, https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01391.html Jason Wang and Peter Xu, Vhost and VIOMMU, KVM Forum 2016, https://events.static.linuxfound.org/sites/events/files/slides/Vhost_VIOMMU_merged_0810. pdf Eric Auger, vIOMMU/ARM: full emulation and virtio-iommu approaches, KVM Forum 2017, https://www.linux-kvm.org/images/8/8e/Viommu_arm.pdf Peter Xu, Device Assignment with Nested Guest and DPDK, KVM Forum 2018, https://www.linux-kvm.org/images/a/a6/KVM_Forum_2018_viommu_vfio.pdf 2019-12-12 BitVisor Summit 8 31
intel_iommu=on iommu=nopt Linux configure IOMMU for each IOMMU group intel_iommu=on iommu=pt Only VFIO uses IOMMU for the device pass-through To check whether the Linux uses IOMMU "- ) ( 2019-12-12 BitVisor Summit 8 37
VT-d at boot time DISABLE_VTD option disables VT-d by sending commands to Global Command Register Otherwise Mac will fail to boot because they think there is no VT-d (VT-d is concealed by BitVIsor) but the actually VT-d is enabled and something go wrong 2019-12-12 BitVisor Summit 8 39