* [PATCH] KVM: SVM: Load %gs earlier if CONFIG_X86_32_LAZY_GS=n
@ 2011-03-08 14:13 Avi Kivity
2011-03-08 14:26 ` Roedel, Joerg
0 siblings, 1 reply; 2+ messages in thread
From: Avi Kivity @ 2011-03-08 14:13 UTC (permalink / raw)
To: Marcelo Tosatti, kvm, Joerg Roedel, IVAN ANGELOV
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.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
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 8d61df4..6bb15d5 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);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: SVM: Load %gs earlier if CONFIG_X86_32_LAZY_GS=n
2011-03-08 14:13 [PATCH] KVM: SVM: Load %gs earlier if CONFIG_X86_32_LAZY_GS=n Avi Kivity
@ 2011-03-08 14:26 ` Roedel, Joerg
0 siblings, 0 replies; 2+ messages in thread
From: Roedel, Joerg @ 2011-03-08 14:26 UTC (permalink / raw)
To: Avi Kivity; +Cc: Marcelo Tosatti, kvm@vger.kernel.org, IVAN ANGELOV
On Tue, Mar 08, 2011 at 09:13:11AM -0500, Avi Kivity wrote:
> 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>
> Signed-off-by: Avi Kivity <avi@redhat.com>
Acked-By: Joerg Roedel <joerg.roedel@amd.com>
> ---
> 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 8d61df4..6bb15d5 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);
> --
> 1.7.1
>
--
AMD Operating System Research Center
Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-08 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-08 14:13 [PATCH] KVM: SVM: Load %gs earlier if CONFIG_X86_32_LAZY_GS=n Avi Kivity
2011-03-08 14:26 ` Roedel, Joerg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox