aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-03-08 09:09:51 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-17 12:08:33 -0400
commit831ca6093ca486060721f5c3c74f97b10f3172b9 (patch)
treecdd06aaa0b11787f2e579a1e60eadfe4dd94d85a /arch/x86/kvm/svm.c
parentafc20184b7d24693a934f652e135598a497c9448 (diff)
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>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-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)
1155 wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); 1155 wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
1156 load_gs_index(svm->host.gs); 1156 load_gs_index(svm->host.gs);
1157#else 1157#else
1158#ifdef CONFIG_X86_32_LAZY_GS
1158 loadsegment(gs, svm->host.gs); 1159 loadsegment(gs, svm->host.gs);
1159#endif 1160#endif
1161#endif
1160 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) 1162 for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
1161 wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); 1163 wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]);
1162} 1164}
@@ -3649,6 +3651,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
3649 wrmsrl(MSR_GS_BASE, svm->host.gs_base); 3651 wrmsrl(MSR_GS_BASE, svm->host.gs_base);
3650#else 3652#else
3651 loadsegment(fs, svm->host.fs); 3653 loadsegment(fs, svm->host.fs);
3654#ifndef CONFIG_X86_32_LAZY_GS
3655 loadsegment(gs, svm->host.gs);
3656#endif
3652#endif 3657#endif
3653 3658
3654 reload_tss(vcpu); 3659 reload_tss(vcpu);