]> xenbits.xensource.com Git - xen.git/commit
x86/PoD: Eager sweep for zeroed pages
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 29 Oct 2015 12:36:25 +0000 (13:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 29 Oct 2015 12:36:25 +0000 (13:36 +0100)
commit101ce53266866144e724ed593173bc4098b300b9
tree3551c7b0ac2cc4f456e5f39f6928a49d45e97661
parentd46896ebbb23f3a9fef2eb6066ae614fd1acfd96
x86/PoD: Eager sweep for zeroed pages

Based on the contents of a guests physical address space,
p2m_pod_emergency_sweep() could degrade into a linear memcmp() from 0 to
max_gfn, which runs non-preemptibly.

As p2m_pod_emergency_sweep() runs behind the scenes in a number of contexts,
making it preemptible is not feasible.

Instead, a different approach is taken.  Recently-populated pages are eagerly
checked for reclaimation, which amortises the p2m_pod_emergency_sweep()
operation across each p2m_pod_demand_populate() operation.

Note that in the case that a 2M superpage can't be reclaimed as a superpage,
it is shattered if 4K pages of zeros can be reclaimed.  This is unfortunate
but matches the previous behaviour, and is required to avoid regressions
(domain crash from PoD exhaustion) with VMs configured close to the limit.

This is CVE-2015-7970 / XSA-150.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/p2m-pod.c
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/p2m.h