x86/mm: add explicit preemption checks to L3 (un)validation
authorJan Beulich <jbeulich@suse.com>
Tue, 5 Mar 2019 12:51:46 +0000 (13:51 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Mar 2019 12:51:46 +0000 (13:51 +0100)
commitbac4567a67d5e8b916801ea5a04cf8b443dfb245
treea430492fa13f3ae7d9a645f666d735d0ae748c44
parent176ebf9c8bc2828f6637eb61cc1cf166e302c699
x86/mm: add explicit preemption checks to L3 (un)validation

When recursive page tables are used at the L3 level, unvalidation of a
single L4 table may incur unvalidation of two levels of L3 tables, i.e.
a maximum iteration count of 512^3 for unvalidating an L4 table. The
preemption check in free_l2_table() as well as the one in
_put_page_type() may never be reached, so explicit checking is needed in
free_l3_table().

When recursive page tables are used at the L4 level, the iteration count
at L4 alone is capped at 512^2. As soon as a present L3 entry is hit
which itself needs unvalidation (and hence requiring another nested loop
with 512 iterations), the preemption checks added here kick in, so no
further preemption checking is needed at L4 (until we decide to permit
5-level paging for PV guests).

The validation side additions are done just for symmetry.

This is part of XSA-290.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c