AMD/IOMMU: re-arrange/complete re-assignment handling
authorJan Beulich <jbeulich@suse.com>
Wed, 25 Aug 2021 13:06:08 +0000 (15:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 25 Aug 2021 13:06:08 +0000 (15:06 +0200)
commit19587584f2f780547a8216b1b9d5cdf3dde29131
treef44fca8e85e441f999aabca8aecc9c0102eea79e
parentfe6da097d460ebcaa7158b6b3949a0d208cf3120
AMD/IOMMU: re-arrange/complete re-assignment handling

Prior to the assignment step having completed successfully, devices
should not get associated with their new owner. Hand the device to DomIO
(perhaps temporarily), until after the de-assignment step has completed.

De-assignment of a device (from other than Dom0) as well as failure of
reassign_device() during assignment should result in unity mappings
getting torn down. This in turn requires switching to a refcounted
mapping approach, as was already used by VT-d for its RMRRs, to prevent
unmapping a region used by multiple devices.

This is CVE-2021-28696 / part of XSA-378.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
master commit: 899272539cbe1acda736a850015416fff653a1b6
master date: 2021-08-25 14:16:26 +0200
xen/drivers/passthrough/amd/iommu.h
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/amd/pci_amd_iommu.c