]> xenbits.xensource.com Git - xen.git/commit
AMD/IOMMU: update live PTEs atomically
authorJan Beulich <jbeulich@suse.com>
Tue, 20 Oct 2020 13:16:49 +0000 (15:16 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Oct 2020 13:16:49 +0000 (15:16 +0200)
commit7739ffda81784853ca6b0156331f5d1923303fa7
treee0ce63c680d1edf97a458f1419d4dc7c1c33f961
parent4f35f7fa29a0f87dcfdbd3f1a43dbd08b072ac4e
AMD/IOMMU: update live PTEs atomically

Updating a live PTE bitfield by bitfield risks the compiler re-ordering
the individual updates as well as splitting individual updates into
multiple memory writes. Construct the new entry fully in a local
variable, do the check to determine the flushing needs on the thus
established new entry, and then write the new entry by a single insn.

Similarly using memset() to clear a PTE is unsafe, as the order of
writes the function does is, at least in principle, undefined.

This is part of XSA-347.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
master commit: 3b055121c5410e2c3105d6d06aa24ca0d58868cd
master date: 2020-10-20 14:22:52 +0200
xen/drivers/passthrough/amd/iommu_map.c