mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
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: 09d952c971
("KVM: check userspace_addr for all memslots")
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
cfb65c15d7
commit
e0135a104c
1 changed files with 1 additions and 6 deletions
|
@ -9951,13 +9951,8 @@ int __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa, u32 size)
|
||||||
if (!slot || !slot->npages)
|
if (!slot || !slot->npages)
|
||||||
return 0;
|
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;
|
old_npages = slot->npages;
|
||||||
|
hva = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
|
for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
|
||||||
|
|
Loading…
Reference in a new issue