xen/arm: mm: Handle permission flags when adding a new mapping
authorJulien Grall <julien.grall@arm.com>
Mon, 9 Oct 2017 13:23:40 +0000 (14:23 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 10 Oct 2017 21:25:25 +0000 (14:25 -0700)
Currently, all the new mappings will be read-write non-executable. Allow the
caller to use other permissions.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c

index c1dad61a20c7d57a9309050b575df1ec492ad60d..2329ccee834adb3a0553bd24a8b9b8a5f28d85ad 100644 (file)
@@ -1022,6 +1022,9 @@ static int create_xen_entries(enum xenmap_operation op,
                 if ( op == RESERVE )
                     break;
                 pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags));
+                pte.pt.ro = PAGE_RO_MASK(flags);
+                pte.pt.xn = PAGE_XN_MASK(flags);
+                BUG_ON(!pte.pt.ro && !pte.pt.xn);
                 pte.pt.table = 1;
                 write_pte(entry, pte);
                 break;