x86/PV: check GDT/LDT limits during emulation
authorJan Beulich <jbeulich@suse.com>
Thu, 31 Oct 2019 16:07:21 +0000 (17:07 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 31 Oct 2019 16:07:21 +0000 (17:07 +0100)
commitca185ab0a7d37f04ca0e6d74364814085b45b2a7
treee368dbb2d4d0a7e879e57f94e68dc306bc1c9603
parent00474079f2b00ca031799a057bb0b3e97f17fe3a
x86/PV: check GDT/LDT limits during emulation

Accesses beyond the LDT limit originating from emulation would trigger
the ASSERT() in pv_map_ldt_shadow_page(). On production builds such
accesses would cause an attempt to promote the touched page (offset from
the present LDT base address) to a segment descriptor one. If this
happens to succeed, guest user mode would be able to elevate its
privileges to that of the guest kernel. This is particularly easy when
there's no LDT at all, in which case the LDT base stored internally to
Xen is simply zero.

Also adjust the ASSERT() that was triggering: It was off by one to
begin with, and for production builds we also better use
ASSERT_UNREACHABLE() instead with suitable recovery code afterwards.

This is XSA-298.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 93021cbe880a8013691a48d0febef8ed7d3e3ebd
master date: 2019-10-31 16:08:16 +0100
xen/arch/x86/pv/emul-gate-op.c
xen/arch/x86/pv/emulate.c
xen/arch/x86/pv/mm.c