mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-21 14:34:19 +00:00
KVM: kvm_clear_guest_page(): fix empty_zero_page usage
Using the address of 'empty_zero_page' as source address in order to clear a page is wrong. On some architectures empty_zero_page is only the pointer to the struct page of the empty_zero_page. Therefore the clear page operation would copy the contents of a couple of struct pages instead of clearing a page. For kvm only arm/arm64 are affected by this bug. To fix this use the ZERO_PAGE macro instead which will return the struct page address of the empty_zero_page on all architectures. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
This commit is contained in:
parent
521ee0cfb8
commit
8a3caa6d74
1 changed files with 3 additions and 2 deletions
|
@ -1615,8 +1615,9 @@ EXPORT_SYMBOL_GPL(kvm_read_guest_cached);
|
||||||
|
|
||||||
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len)
|
int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len)
|
||||||
{
|
{
|
||||||
return kvm_write_guest_page(kvm, gfn, (const void *) empty_zero_page,
|
const void *zero_page = (const void *) __va(page_to_phys(ZERO_PAGE(0)));
|
||||||
offset, len);
|
|
||||||
|
return kvm_write_guest_page(kvm, gfn, zero_page, offset, len);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(kvm_clear_guest_page);
|
EXPORT_SYMBOL_GPL(kvm_clear_guest_page);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue