]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: kvm: fix potential issue with ELF loading
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 May 2021 12:27:38 +0000 (14:27 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 27 May 2021 11:45:53 +0000 (07:45 -0400)
commitfe2386aac73128f6bfef3740c5bef0d991e7bc91
treeae57b2c57ad0d9f12d64478189df726d84e68ba6
parent176f94264682f9905a93791ddaf5417b1d2ff6df
selftests: kvm: fix potential issue with ELF loading

vm_vaddr_alloc() sets up GVA to GPA mapping page by page; therefore, GPAs
may not be continuous if same memslot is used for data and page table allocation.

kvm_vm_elf_load() however expects a continuous range of HVAs (and thus GPAs)
because it does not try to read file data page by page.  Fix this mismatch
by allocating memory in one step.

Reported-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/kvm_util.c