x86: fix GS-base-dirty determination
authorJan Beulich <jbeulich@suse.com>
Tue, 24 Oct 2017 16:12:31 +0000 (18:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Oct 2017 16:12:31 +0000 (18:12 +0200)
commit91f85280b9b80852352fcad73d94ed29fafb88da
tree225800facc3e03c242c78d9550b42f5fe3f43ae5
parentb8acf328ac86fbb45831917a61e94be2de34294d
x86: fix GS-base-dirty determination

load_segments() writes the two MSRs in their "canonical" positions
(GS_BASE for the user base, SHADOW_GS_BASE for the kernel one) and uses
SWAPGS to switch them around if the incoming vCPU is in kernel mode. In
order to not leave a stale kernel address in GS_BASE when the incoming
guest is in user mode, the check on the outgoing vCPU needs to be
dependent upon the mode it is currently in, rather than blindly looking
at the user base.

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/domain.c