From: Avi Kivity <[email protected]>

commit 831ca6093ca486060721f5c3c74f97b10f3172b9 upstream.

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 <[email protected]>
Acked-By: Joerg Roedel <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
---
 arch/x86/kvm/svm.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 63fec15..9cc8496 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1153,8 +1153,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]);
 }
@@ -3641,6 +3643,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);
-- 
1.7.1

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to