xen/arm: mm: Access a PT entry before the table is unmapped

xen_pt_next_level() will retrieve the MFN from the entry right after the
page-table has been unmapped.

After calling xen_unmap_table(), there is no guarantee the mapping will
still be valid. Depending on the implementation, this may result to a
data abort in Xen.

Re-order the code to retrieve the MFN before the table is unmapped.

Fixes: 53abb9a1dc ("xen/arm: mm: Rework Xen page-tables walk during update")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Release-acked-by: Paul Durrant <paul@xen.org>
This commit is contained in:
Julien Grall authored and Stefano Stabellini committed 2020-06-08 10:33:28 -07:00
1 parent 16c36d27f2
commit 63b4c9bfb7
1 file changed
+4 -1
+4 -1
View File
@@ -1036,6 +1036,7 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
{
lpae_t *entry;
int ret;
mfn_t mfn;
entry = *table + offset;
@@ -1053,8 +1054,10 @@ static int xen_pt_next_level(bool read_only, unsigned int level,
if ( lpae_is_mapping(*entry, level) )
return XEN_TABLE_SUPER_PAGE;
mfn = lpae_get_mfn(*entry);
xen_unmap_table(*table);
*table = xen_map_table(lpae_get_mfn(*entry));
*table = xen_map_table(mfn);
return XEN_TABLE_NORMAL_PAGE;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.