From: Jan Beulich Date: Fri, 1 Feb 2019 10:27:59 +0000 (+0100) Subject: x86/HVM: __hvm_copy() should not write to p2m_ioreq_server pages X-Git-Tag: RELEASE-4.11.2~105 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d8b2418573fb0c3f2a192620254d08826807d58a;p=people%2Fdwmw2%2Fxen.git x86/HVM: __hvm_copy() should not write to p2m_ioreq_server pages 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 Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant Acked-by: Andrew Cooper master commit: d7bff2bc003cd5fd8c618b70c62b8fcfd9cd187e master date: 2018-11-15 16:42:25 +0100 --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 611545f898..2a34747a09 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3243,6 +3243,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 )