x86/pod: prevent infinite loop when shattering large pages
authorJulien Grall <julien.grall@linaro.org>
Tue, 28 Nov 2017 12:11:55 +0000 (13:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 28 Nov 2017 12:11:55 +0000 (13:11 +0100)
commita1c6c6768971ea387d7eba0803908ef0928b43ac
tree6bb349a1f70c88be707f5a1fca728f55a3f73aef
parent345bb9cd634421f50b732d4f9c89a649a7a1d0db
x86/pod: prevent infinite loop when shattering large pages

When populating pages, the PoD may need to split large ones using
p2m_set_entry and request the caller to retry (see ept_get_entry for
instance).

p2m_set_entry may fail to shatter if it is not possible to allocate
memory for the new page table. However, the error is not propagated
resulting to the callers to retry infinitely the PoD.

Prevent the infinite loop by return false when it is not possible to
shatter the large mapping.

This is XSA-246.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/p2m-pod.c