From: Andrew Cooper Date: Wed, 2 Nov 2016 14:43:48 +0000 (+0000) Subject: x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~128 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=12bc22f79117dfae5e59382cdda6b8b6b70a7554;p=xen.git x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses No sane OS would deliberately try this, but make Xen's emulation match real hardware by delivering #GP(0), rather than suffering a VMEntry failure. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Release-acked-by: Wei Liu --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 7a707dcda3..58e1ed8e87 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -4443,6 +4443,7 @@ x86_emulate( (rc = read_ulong(ea.mem.seg, ea.mem.off+2, &base, mode_64bit() ? 8 : 4, ctxt, ops)) ) goto done; + generate_exception_if(!is_canonical_address(base), EXC_GP, 0); sreg.base = base; sreg.limit = limit; if ( op_bytes == 2 )