mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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:
1 parent
16c36d27f2
commit
63b4c9bfb7
1 file changed
+4
-1
+4
-1
@@ -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;
|
||||
}
|
||||
|
||||