Skip to content

Commit e0135a1

Browse files
committed
KVM: x86: do not pass poisoned hva to __kvm_set_memory_region
__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 <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent cfb65c1 commit e0135a1

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9951,13 +9951,8 @@ int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
99519951
if (!slot || !slot->npages)
99529952
return 0;
99539953

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

99639958
for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {

0 commit comments

Comments
 (0)