Skip to contentSkip to conversation

KVM: nVMX: do not leak PML full vmexit to L1

PATCH Applied Ladi Prosek 4 participants 9 messages Mar 31, 2017 – May 2, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: nVMX: do not leak PML full vmexit to L1

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")
---
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +3 -0
index 2ee00db..6051832 100644
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw

2017-03-31 10:19+0200, Ladi Prosek:

Quoted 9 lines

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")

---

Good catch,

Quoted 20 lines
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +3 -0
index 2ee00db..6051832 100644
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#2 lore raw
In reply to Ladi Prosek
Quoted 18 lines · Ladi Prosek

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")
---
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +0 -0
index 2ee00db..6051832 100644

arch/x86/kvm/vmx.c static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) · line 8206

Quoted 9 lines
arch/x86/kvm/vmx.c +3 -0
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}
Signature · 3 lines
Thanks,

David
#3 lore raw
In reply to Ladi Prosek
Quoted 2 lines · Ladi Prosek

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

I wonder if a whitelist of vmexits would make more sense, compared to defaulting to passing them through. But I don't know the history of this

Quoted 6 lines

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")
Signature · 3 lines
Thanks,

David
maintainer
#4 lore raw
Quoted 5 lines · David Hildenbrand
Quoted 2 lines

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

I wonder if a whitelist of vmexits would make more sense, compared to defaulting to passing them through. But I don't know the history of this

I checked the other day and it's really 50-50 between "return true" and "return false" vmexits. Adding a WARNing would probably make even more sense. :)

Thanks,

Paolo

#5 lore raw
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines · David Hildenbrand
Quoted 2 lines

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

Quoted 7 lines
Quoted 2 lines

I wonder if a whitelist of vmexits would make more sense, compared to defaulting to passing them through. But I don't know the history of this

I checked the other day and it's really 50-50 between "return true" and "return false" vmexits. Adding a WARNing would probably make even more sense. :)

Well, a whitelist will make sure that L1 really only sees what you want it to see. As an alternative, specify all of them explicitly (white+black list - should that currently already be done? haven't checked it), default to "false" and print a WARNing (unhandled exit code). But don't expose it to L1. (just what I have in mind).

Quoted 4 lines

Thanks,

Paolo

Signature · 3 lines
Thanks,

David
#6 lore raw
In reply to Ladi Prosek

2017-03-31 10:19+0200, Ladi Prosek:

Quoted 9 lines

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")

---

Applied to kvm/master, thanks.

Quoted 20 lines
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +3 -0
index 2ee00db..6051832 100644
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}
Signature · 1 line
2.9.3
maintainer
#7 lore raw
In reply to Ladi Prosek
Quoted 18 lines · Ladi Prosek

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")
---
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +0 -0
index 2ee00db..6051832 100644

arch/x86/kvm/vmx.c static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) · line 8206

Quoted 9 lines
arch/x86/kvm/vmx.c +3 -0
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}

This fell through the cracks, I'm queueing it now.

Paolo

#8 lore raw

2017-05-02 15:05+0200, Paolo Bonzini:

Quoted 22 lines · Ladi Prosek
Quoted 21 lines

The PML feature is not exposed to guests so we should not be forwarding the vmexit either.

This commit fixes BSOD 0x20001 (HYPERVISOR_ERROR) when running Hyper-V enabled Windows Server 2016 in L1 on hardware that supports PML.

Fixes 843e4330573c ("KVM: VMX: Add PML support in VMX")
---
 arch/x86/kvm/vmx.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kvm/vmx.c +1 -0
index 2ee00db..6051832 100644
@@ -8198,6 +8198,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 		return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
 	case EXIT_REASON_PREEMPTION_TIMER:
 		return false;
+	case EXIT_REASON_PML_FULL:
Quoted 8 lines

arch/x86/kvm/vmx.c static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) · line 8206

Quoted 6 lines
arch/x86/kvm/vmx.c +2 -0
+		/* We don't expose PML support to L1. */
+		return false;
 	default:
 		return true;
 	}

This fell through the cracks, I'm queueing it now.

It is in Linus' tree as ab007cc94ff9, we are just missing it in queue and next as they haven't merged yet.