]> xenbits.xensource.com Git - xen.git/commit
x86/p2m: don't assert that the passed in MFN matches for a remove
authorJan Beulich <jbeulich@suse.com>
Fri, 3 Apr 2020 08:56:55 +0000 (10:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 3 Apr 2020 08:56:55 +0000 (10:56 +0200)
commitc65ea16dbcafbe4fe21693b18f8c2a3c5d14600e
tree3e0cf9aed3daa1b9840c26aa56106e6afd1dafd8
parenta6b051a87a586347969bfbaa6925ac0f0c845413
x86/p2m: don't assert that the passed in MFN matches for a remove

guest_physmap_remove_page() gets handed an MFN from the outside, yet
takes the necessary lock to prevent further changes to the GFN <-> MFN
mapping itself. While some callers, in particular guest_remove_page()
(by way of having called get_gfn_query()), hold the GFN lock already,
various others (most notably perhaps the 2nd instance in
xenmem_add_to_physmap_one()) don't. While it also is an option to fix
all the callers, deal with the issue in p2m_remove_page() instead:
Replace the ASSERT() by a conditional and split the loop into two, such
that all checking gets done before any modification would occur.

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