]> xenbits.xensource.com Git - xen.git/commit
x86emul: de-duplicate scatters to the same linear address
authorJan Beulich <jbeulich@suse.com>
Tue, 19 Oct 2021 08:02:39 +0000 (10:02 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 19 Oct 2021 08:02:39 +0000 (10:02 +0200)
commita8cddbac5051020bb4a59a7f0ea27500c51063fb
tree50a186f85381e58a555d48206f582d17f831d0bd
parent3ae80dea4601764818d1e5b84bd1e4479c0d4790
x86emul: de-duplicate scatters to the same linear address

The SDM specifically allows for earlier writes to fully overlapping
ranges to be dropped. If a guest did so, hvmemul_phys_mmio_access()
would crash it if varying data was written to the same address. Detect
overlaps early, as doing so in hvmemul_{linear,phys}_mmio_access() would
be quite a bit more difficult. To maintain proper faulting behavior,
instead of dropping earlier write instances of fully overlapping slots
altogether, write the data of the final of these slots multiple times.
(We also can't pull ahead the [single] write of the data of the last of
the slots, clearing all involved slots' op_mask bits together, as this
would yield incorrect results if there were intervening partially
overlapping ones.)

Note that due to cache slot use being linear address based, there's no
similar issue with multiple writes to the same physical address (mapped
through different linear addresses).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c