Commit 831ca609 authored by Avi Kivity's avatar Avi Kivity Committed by Marcelo Tosatti

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: default avatarIVAN ANGELOV <ivangotoy@gmail.com>
Acked-By: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent afc20184
...@@ -1155,7 +1155,9 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) ...@@ -1155,7 +1155,9 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
load_gs_index(svm->host.gs); load_gs_index(svm->host.gs);
#else #else
#ifdef CONFIG_X86_32_LAZY_GS
loadsegment(gs, svm->host.gs); loadsegment(gs, svm->host.gs);
#endif
#endif #endif
for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++)
wrmsrl(host_save_user_msrs[i], svm->host_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) ...@@ -3649,6 +3651,9 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
wrmsrl(MSR_GS_BASE, svm->host.gs_base); wrmsrl(MSR_GS_BASE, svm->host.gs_base);
#else #else
loadsegment(fs, svm->host.fs); loadsegment(fs, svm->host.fs);
#ifndef CONFIG_X86_32_LAZY_GS
loadsegment(gs, svm->host.gs);
#endif
#endif #endif
reload_tss(vcpu); reload_tss(vcpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment