]> xenbits.xensource.com Git - xen.git/commitdiff
x86/emul: Reject LGDT/LIDT attempts with non-canonical base addresses
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 2 Nov 2016 14:43:48 +0000 (14:43 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 3 Nov 2016 12:23:23 +0000 (12:23 +0000)
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>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 7a707dcda3f21fbaa59df6b620ac5298fd84f486..58e1ed8e8765ef0a39f0fa7a576cbf333aa2d561 100644 (file)
@@ -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 )