]> xenbits.xensource.com Git - xen.git/commit
x86/pv: Fix assertions in svm_load_segs()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Sep 2020 09:47:57 +0000 (10:47 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 8 Sep 2020 15:46:31 +0000 (16:46 +0100)
commit1e2d3be2e516e6f415ca6029f651b76a8563a27c
tree931614b3b853ac2778f681e06858ebc5ab54ea73
parentb11910082d90bb1597f6679524eb726a33306672
x86/pv: Fix assertions in svm_load_segs()

OSSTest has shown an assertion failure:
http://logs.test-lab.xenproject.org/osstest/logs/153906/test-xtf-amd64-amd64-1/serial-rimava1.log

This is because we pass a non-NUL selector into svm_load_segs(), which is
something we must not do, as this path does not load the attributes/limits
from the GDT/LDT.

Drop the {fs,gs}_sel parameters from svm_load_segs() and use 0 instead.  This
is acceptable even for non-zero NUL segments, as it is how the IRET
instruction behaves in all CPUs.

Only use the svm_load_segs() path when both FS and GS are NUL, which is the
common case when scheduling a 64bit vcpu with 64bit userspace in context.

Fixes: ad0fd291c5 ("x86/pv: Rewrite segment context switching from scratch")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/arch/x86/hvm/svm/svm.c
xen/include/asm-x86/hvm/svm/svm.h