xen/arm: Harden the P2M code in p2m_remove_mapping()
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Sat, 16 Jul 2022 14:56:57 +0000 (17:56 +0300)
committerJulien Grall <jgrall@amazon.com>
Wed, 20 Jul 2022 18:12:22 +0000 (19:12 +0100)
commit5a4a2cef085d74a247663ed210e9398264ce3fc8
tree6e2a7af0085b91f381bc8df6f472f42c007082e5
parent52196c8cd9d38c7b028619f046246ea55ff9f6a7
xen/arm: Harden the P2M code in p2m_remove_mapping()

Borrow the x86's check from p2m_remove_page() which was added
by the following commit: c65ea16dbcafbe4fe21693b18f8c2a3c5d14600e
"x86/p2m: don't assert that the passed in MFN matches for a remove"
and adjust it to the Arm code base.

Basically, this check will be strictly needed for the xenheap pages
after applying a subsequent commit which will introduce xenheap based
M2P approach on Arm. But, it will be a good opportunity to harden
the P2M code for *every* RAM pages since it is possible to remove
any GFN - MFN mapping currently on Arm (even with the wrong helpers).

Suggested-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/p2m.c