The entry iommu_device
The test device service of the IOMMU: a device service of the virtio block device of the disk of the measures that gives its device an address that it did not declare. The root service starts it in place of the block service for the one client iommu (src/modules/tests/iommu); no other process can start it. The design is The IOMMU: The proof in the repository.
What it shows. On a machine with the IOMMU, a device reaches only the pages that its service declared with Memory_Physical, and sends only the message interrupts that its service was given:
- 1. It declares its queue and a data object of two pages, writes a block of the disk from the first page and reads it into the second: the bytes arrive, and the message interrupt of the device arrives through its entry.
- 2. It writes a block of zeros, then reads it into the interrupt addresses: each write of the device there is a message that names an entry that the kernel did not give it. On the IOMMU of Intel the kernel writes the line of the refused interrupt; the emulated IOMMU of AMD records no event for such a message, so no line comes there.
- 3. It declares a new page with a known pattern, then closes its handle and keeps its mapping: the kernel takes the page out of the domain of the device at the close, and the service can still read it.
- 4. It gives the address of that page to the device as the buffer of a read of the same block.
- 5. It waits until the device needs a reset or used the request, and checks that the page keeps its pattern. The kernel writes the line of the DMA fault, with the device and the address.
The forged messages come before the DMA fault: a virtio device of QEMU that needs a reset does no more requests.
- 6. Behind a conventional bridge, where the root service gives it the registers of the other device there too, it starts its device again, then closes those registers: its domain ends, its next declaration is refused, with a line of the kernel, and a read of the device into a page that it declared before does not end and does not reach the page. The tool gives the disk a new size after the line of that read: the service waits for it, and no interrupt of the device arrives.
Then it answers the commands of the block ring, so that its client sees that the machine goes on.
What a reader sees. No window: the lines iommu_device: ... on the log, each one with "as it must" when the rule held. On a machine with no IOMMU the device writes the page, and the line says so. The writes go to the disk of the measures, which holds no data of a process.
iommu_device module with an entry
- Hash
fae2ce236a99898a3ca9c5d0d7697d231f6b3d6b37813085bc0796e2592cdc9a- Size
49152 bytes- Exports
0- Imports
0- Imported by
0- License
- MIT
The test device service of the IOMMU: a device service of the virtio block device of the disk of the measures that gives its device an address that it did not declare
| Fact | Value |
|---|---|
| Kind | Modules with an entry |
| Source | src/modules/tests/iommu_device |
| Boot image | yes: in the boot image, 49152 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
entry() |
entry
entry()
- Form
- The entry of the module: one parameter, an address, fixed by the contract.
src/modules/tests/iommu_device/main.odin:177
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
What the root service gives it
| What | Value | As the root service says |
|---|---|---|
| Grants | The disk of the measures for its one client iommu (driver_start). | |
| Other terms of its start grant set | none | |
| Budget that it asks for |
| The budget of a block service: it drives one disk through one ring. |
The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).
