File 581b2c3b-x86-emul-reject-LGDT-LIDT-with-non-canonical-addresses.patch of Package xen.4216
# Commit 12bc22f79117dfae5e59382cdda6b8b6b70a7554
# Date 2016-11-03 12:23:23 +0000
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Andrew Cooper <andrew.cooper3@citrix.com>
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 <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <JBeulich@suse.com>
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -4005,6 +4005,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);
reg.base = base;
reg.limit = limit;
if ( op_bytes == 2 )