]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/HVM: __hvm_copy() should not write to p2m_ioreq_server pages
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Nov 2018 15:42:25 +0000 (16:42 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Nov 2018 15:42:25 +0000 (16:42 +0100)
Commit 3bdec530a5 ("x86/HVM: split page straddling emulated accesses in
more cases") introduced a hvm_copy_to_guest_linear() attempt before
falling back to hvmemul_linear_mmio_write(). This is wrong for the
p2m_ioreq_server special case. That change widened a pre-existing issue
though: Other writes to such pages also need to be failed (or forced
through emulation), in particular hypercall buffer writes.

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c

index c0a3db5858a66425959b2d8252f5cc244f2b625b..65ab6a9b23775d3b9cb192e51d3e8ac0b5f28d35 100644 (file)
@@ -3204,6 +3204,12 @@ static enum hvm_translation_result __hvm_copy(
         if ( res != HVMTRANS_okay )
             return res;
 
+        if ( (flags & HVMCOPY_to_guest) && p2mt == p2m_ioreq_server )
+        {
+            put_page(page);
+            return HVMTRANS_bad_gfn_to_mfn;
+        }
+
         p = (char *)__map_domain_page(page) + (addr & ~PAGE_MASK);
 
         if ( flags & HVMCOPY_to_guest )