KVM: kvm_clear_guest_page(): fix empty_zero_page usage
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 18 Nov 2013 09:35:55 +0000 (10:35 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:18:20 +0000 (17:18 +0200)
commit4ae68e1ee672530df9236b07ff267f06e107bc9a
tree70db739c8766637e0568ad103d788c3d40890d82
parent52031ff6011942b7e29788b9ce5066cb45fe3e4e
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>
(cherry picked from commit 8a3caa6d74597c2a083f7c87f866891a0b12540b)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/kvm_main.c