diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2011-01-14 16:45:01 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-02-09 18:31:36 +0200 |
commit | 893a5ab6ee7d51b231ed45aa844f8088642cb6bf (patch) | |
tree | 9bb299eb2b957b47371d09fd33a307882e7b9e7a /arch/x86/kvm | |
parent | 0b0abeaf3d30cec03ac6497fe978b8f7edecc5ae (diff) | |
download | linux-893a5ab6ee7d51b231ed45aa844f8088642cb6bf.tar.gz linux-893a5ab6ee7d51b231ed45aa844f8088642cb6bf.tar.bz2 linux-893a5ab6ee7d51b231ed45aa844f8088642cb6bf.zip |
KVM: SVM: Make sure KERNEL_GS_BASE is valid when loading gs_index
The gs_index loading code uses the swapgs instruction to
switch to the user gs_base temporarily. This is unsave in an
lightweight exit-path in KVM on AMD because the
KERNEL_GS_BASE MSR is switches lazily. An NMI happening in
the critical path of load_gs_index may use the wrong GS_BASE
value then leading to unpredictable behavior, e.g. a
triple-fault.
This patch fixes the issue by making sure that load_gs_index
is called only with a valid KERNEL_GS_BASE value loaded in
KVM.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/svm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 25bd1bc5aad2..54ce246a383e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1150,8 +1150,8 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) kvm_load_ldt(svm->host.ldt); #ifdef CONFIG_X86_64 loadsegment(fs, svm->host.fs); - load_gs_index(svm->host.gs); wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); + load_gs_index(svm->host.gs); #else loadsegment(gs, svm->host.gs); #endif |