Skip to content

Commit

Permalink
KVM: x86: do not pass poisoned hva to __kvm_set_memory_region
Browse files Browse the repository at this point in the history
__kvm_set_memory_region does not use the hva at all, so trying to
catch use-after-delete is pointless and, worse, it fails access_ok
now that we apply it to all memslots including private kernel ones.
This fixes an AVIC regression.

Fixes: 09d952c ("KVM: check userspace_addr for all memslots")
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Paolo Bonzini committed Jun 11, 2020
1 parent cfb65c1 commit e0135a1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -9951,13 +9951,8 @@ int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
if (!slot || !slot->npages)
return 0;

/*
* Stuff a non-canonical value to catch use-after-delete. This
* ends up being 0 on 32-bit KVM, but there's no better
* alternative.
*/
hva = (unsigned long)(0xdeadull << 48);
old_npages = slot->npages;
hva = 0;
}

for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
Expand Down

0 comments on commit e0135a1

Please sign in to comment.