x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order
authorJan Beulich <jbeulich@suse.com>
Thu, 6 Jan 2022 15:12:39 +0000 (16:12 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 6 Jan 2022 15:12:39 +0000 (16:12 +0100)
commitced5685208f4525edc3aa86f41eeaee5ccc9fe31
tree3f3ec404b1884f21fa22b2e631b72ebfee17020b
parent6330e328ba157ed5df417f463ba8621fee731e63
x86/altp2m: p2m_altp2m_get_or_propagate() should honor present page order

Prior to XSA-304 the only caller merely happened to not use any further
the order value that it passes into the function. Already then this was
a latent issue: The function really should, in the "get" case, hand back
the order the underlying mapping actually uses (or actually the smaller
of the two), such that (going forward) there wouldn't be any action on
unrelated mappings (in particular ones which did already diverge from
the host P2M).

Similarly in the "propagate" case only the smaller of the two orders
should actually get used for creating the new entry, again to avoid
altering mappings which did already diverge from the host P2M.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tamas K Lengyel <tamas@tklengyel.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/include/asm/p2m.h
xen/arch/x86/mm/p2m.c