Skip to content

Commit 971f17f

Browse files
bonzinigregkh
authored andcommitted
KVM: x86: check for nEPT/nNPT in slow flush hypercalls
commit 464af6f upstream. Checking is_guest_mode(vcpu) is incorrect, because translate_nested_gpa() is only valid if an L2 guest is running *with nested EPT/NPT enabled*. Instead use the same condition as translate_nested_gpa() itself. Cc: stable@vger.kernel.org Reviewed-by: Sean Christopherson <seanjc@google.com> Fixes: aee7382 ("KVM: x86: Prepare kvm_hv_flush_tlb() to handle L2's GPAs", 2022-11-18) Link: https://patch.msgid.link/20260503200905.106077-1-pbonzini@redhat.com/ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ba7f71b commit 971f17f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/hyperv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
19871987
* flush). Translate the address here so the memory can be uniformly
19881988
* read with kvm_read_guest().
19891989
*/
1990-
if (!hc->fast && is_guest_mode(vcpu)) {
1990+
if (!hc->fast && mmu_is_nested(vcpu)) {
19911991
hc->ingpa = translate_nested_gpa(vcpu, hc->ingpa, 0, NULL);
19921992
if (unlikely(hc->ingpa == INVALID_GPA))
19931993
return HV_STATUS_INVALID_HYPERCALL_INPUT;

0 commit comments

Comments
 (0)