summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity2011-03-08 15:09:51 +0100
committerMarcelo Tosatti2011-03-17 17:08:33 +0100
commit831ca6093ca486060721f5c3c74f97b10f3172b9 (patch)
treecdd06aaa0b11787f2e579a1e60eadfe4dd94d85a
parentKVM: x86: Remove useless regs_page pointer from kvm_lapic (diff)
downloadkernel-qcow2-linux-831ca6093ca486060721f5c3c74f97b10f3172b9.tar.gz
kernel-qcow2-linux-831ca6093ca486060721f5c3c74f97b10f3172b9.tar.xz
kernel-qcow2-linux-831ca6093ca486060721f5c3c74f97b10f3172b9.zip
KVM: SVM: Load %gs earlier if CONFIG_X86_32_LAZY_GS=n
With CONFIG_CC_STACKPROTECTOR, we need a valid %gs at all times, so disable lazy reload and do an eager reload immediately after the vmexit. Reported-by: IVAN ANGELOV <ivangotoy@gmail.com> Acked-By: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 8d61df4a02c7..6bb15d583e47 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1155,8 +1155,10 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
load_gs_index(svm->host.gs);
#else
+#ifdef CONFIG_X86_32_LAZY_GS
loadsegment(gs, svm->host.gs);
#endif
+#endif
for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
}
@@ -3649,6 +3651,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
wrmsrl(MSR_GS_BASE, svm->host.gs_base);
#else
loadsegment(fs, svm->host.fs);
+#ifndef CONFIG_X86_32_LAZY_GS
+ loadsegment(gs, svm->host.gs);
+#endif
#endif
reload_tss(vcpu);