x86: don't latch wrong (stale) GS base addresses
authorJan Beulich <JBeulich@suse.com>
Thu, 26 Oct 2017 07:57:04 +0000 (01:57 -0600)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 27 Oct 2017 12:49:10 +0000 (13:49 +0100)
commita711f6f24a7157ae70d1cc32e61b98f23dc0c584
tree368d9deb587cfbd33b4af900a823c8eb360c3516
parent26a896cde21c6d03de367190034fcc150b1bf2d8
x86: don't latch wrong (stale) GS base addresses

load_segments() writes selector registers before doing any of the base
address updates. Any of these selector loads can cause a page fault in
case it references the LDT, and the LDT page accessed was only recently
installed. Therefore the call tree map_ldt_shadow_page() ->
guest_get_eff_kern_l1e() -> toggle_guest_mode() would in such a case
wrongly latch the outgoing vCPU's GS.base into the incoming vCPU's
recorded state.

Split page table toggling from GS handling - neither
guest_get_eff_kern_l1e() nor guest_io_okay() need more than the page
tables being the kernel ones for the memory access they want to do.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
xen/arch/x86/pv/domain.c
xen/arch/x86/pv/emul-priv-op.c
xen/arch/x86/pv/mm.c
xen/include/asm-x86/domain.h