Why VT-d Direct memory access (DMA) is a method that allows an
9 Slides337.50 KB
Why VT-d Direct memory access (DMA) is a method that allows an input/output (I/O) device to send or receive data directly to or from the main memory, bypassing the CPU to speed up memory operations. The process is managed by a chip known as a DMA controller (DMAC). Performance vs Security DMA Attack : An attacker exploits the presence of high-speed expansion ports that permit direct memory access to penetrate a system. Ex : Firewire device - No hardware / operating system mediation - Wide availability of devices with ports to transfer data at high speed. - Manifest as social engineering attack, offering a device as gift. Solution a) Installation of signed device drivers and restricted access to devices, b) IOMMU technology
Virtualization Technology for directed IO - Overview Intel VT-d : Hardware support for isolation of devices and restriction of device accesses to the owner of the device. Capabilities of VT-d a) IO device assignment b) DMA remapping c) Interrupt remapping - Assignment of devices to VMs Address translation for device DMA transfers - Isolation and routing of device interrupts
DMA remapping Domain – Abstract isolated environment to which a subset of physical memory is allotted. DMA remapping hardware Assigns a device to a domain through a set of paging structures Any access by a device to system memory is intercepted and determined whether access is permitted [ RVM ].
Different models of IO virtualization a) Emulation of device functionality in software b) Direct assignment of devices to VM c) Sharing of devices A device itself has multiple functional interfaces and each of which may be assigned to individual VMs
OS usage of DMA remapping a) OS protection : An OS may define a domain with its critical code and data structures, restricting its access from all IO devices b) DMA isolation : An OS could define multiple domains and assign one or more IO devices to each domain. c) Shared virtual memory : It is possible to share virtual address space of applications with IO devices, enabling sharing of data with devices.
VMM usage of DMA remapping Direct assignment of devices : a) Driver for an assigned device runs in the partition to which it is assigned b) Guest software interacts with hardware directly, with no or minimal VMM involvement. c) VMM is invoked only when guest software performs configuration access, interrupt management
DMA address translation A domain has a view of the address space, that is different from host physical address space, similar to that of virtual machine address space. A DMA request would have information such as a) Device identity originating the request b) Type of access c) Target address Remapping hardware translates the address in DMA request to HPA before forwarding to memory controllers.
Address translation structures Source Identifier : For PCI express devices, the device identifier is composed of bus/device/function Top level structure is called root-table (4k bytes) and consists of 256 entries. Each entry in root table consist of fields such as ‘present flag’ and ‘context table pointer’ Second level structures is called context table and each entry consist of a) Translation type – which type of requests are allowed b) Domain identifier – software assigned field that identifies a domain
How does a device is assigned to a VM ? - Assign the same memory range exported to VM to a domain ‘d’. - Mark domain identifier in the context table entry for the device.