public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value
@ 2016-04-07 11:47 Paolo Bonzini
  2016-04-07 14:40 ` Radim Krčmář
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2016-04-07 11:47 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: rkrcmar, stable

This ensures that the guest doesn't see XSAVE extensions
(e.g. xgetbv1 or xsavec) that the host lacks.

Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/cpuid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 8efb839948e5..bbbaa802d13e 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -534,6 +534,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 			do_cpuid_1_ent(&entry[i], function, idx);
 			if (idx == 1) {
 				entry[i].eax &= kvm_cpuid_D_1_eax_x86_features;
+				cpuid_mask(&entry[i].eax, CPUID_D_1_EAX);
 				entry[i].ebx = 0;
 				if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
 					entry[i].ebx =
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value
  2016-04-07 11:47 Paolo Bonzini
@ 2016-04-07 14:40 ` Radim Krčmář
  0 siblings, 0 replies; 5+ messages in thread
From: Radim Krčmář @ 2016-04-07 14:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-kernel, kvm, stable

2016-04-07 13:47+0200, Paolo Bonzini:
> This ensures that the guest doesn't see XSAVE extensions
> (e.g. xgetbv1 or xsavec) that the host lacks.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value
@ 2016-05-26 11:44 Paolo Bonzini
  2016-05-26 16:36 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2016-05-26 11:44 UTC (permalink / raw)
  To: stable; +Cc: rkrcmar

commit 316314cae15fb0e3869b76b468f59a0c83ac3d4e upstream.

This ensures that the guest doesn't see XSAVE extensions
(e.g. xgetbv1 or xsavec) that the host lacks.

Cc: stable@vger.kernel.org
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Conflicts:
	arch/x86/kvm/cpuid.c

[4.5 does have CPUID_D_1_EAX, but earlier kernels don't, so use
 the numeric value.  This is consistent with other occurrences
 of cpuid_mask in arch/x86/kvm/cpuid.c - Paolo]
---
 arch/x86/kvm/cpuid.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 6525e926f566..2e1fd586b895 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -509,6 +509,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 			do_cpuid_1_ent(&entry[i], function, idx);
 			if (idx == 1) {
 				entry[i].eax &= kvm_supported_word10_x86_features;
+				cpuid_mask(&entry[i].eax, 10);
 				entry[i].ebx = 0;
 				if (entry[i].eax & (F(XSAVES)|F(XSAVEC)))
 					entry[i].ebx =
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value
  2016-05-26 11:44 [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value Paolo Bonzini
@ 2016-05-26 16:36 ` Greg KH
  2016-05-26 16:51   ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2016-05-26 16:36 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: stable, rkrcmar

On Thu, May 26, 2016 at 01:44:06PM +0200, Paolo Bonzini wrote:
> commit 316314cae15fb0e3869b76b468f59a0c83ac3d4e upstream.
> 
> This ensures that the guest doesn't see XSAVE extensions
> (e.g. xgetbv1 or xsavec) that the host lacks.
> 
> Cc: stable@vger.kernel.org
> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Conflicts:
> 	arch/x86/kvm/cpuid.c

Why is this here?

> 
> [4.5 does have CPUID_D_1_EAX, but earlier kernels don't, so use
>  the numeric value.  This is consistent with other occurrences
>  of cpuid_mask in arch/x86/kvm/cpuid.c - Paolo]

What stable tree(s) do you want this applied to?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value
  2016-05-26 16:36 ` Greg KH
@ 2016-05-26 16:51   ` Paolo Bonzini
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2016-05-26 16:51 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, rkrcmar



On 26/05/2016 18:36, Greg KH wrote:
> On Thu, May 26, 2016 at 01:44:06PM +0200, Paolo Bonzini wrote:
>> commit 316314cae15fb0e3869b76b468f59a0c83ac3d4e upstream.
>>
>> This ensures that the guest doesn't see XSAVE extensions
>> (e.g. xgetbv1 or xsavec) that the host lacks.
>>
>> Cc: stable@vger.kernel.org
>> Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>> Conflicts:
>> 	arch/x86/kvm/cpuid.c
> 
> Why is this here?

It's why the patch couldn't be lifted straight from Linus's tree.  "git
cherry-pick" places it here.  Granted, this time it doesn't add much
information since the patch touched one file only.

>>
>> [4.5 does have CPUID_D_1_EAX, but earlier kernels don't, so use
>>  the numeric value.  This is consistent with other occurrences
>>  of cpuid_mask in arch/x86/kvm/cpuid.c - Paolo]
> 
> What stable tree(s) do you want this applied to?

All where it applies.

Paolo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-26 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-26 11:44 [PATCH] KVM: x86: mask CPUID(0xD,0x1).EAX against host value Paolo Bonzini
2016-05-26 16:36 ` Greg KH
2016-05-26 16:51   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2016-04-07 11:47 Paolo Bonzini
2016-04-07 14:40 ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox