diff mbox series

[Xen-devel,v2,23/24] xen/arm: mm: Handle permission flags when adding a new mapping

Message ID 20170912100330.2168-24-julien.grall@arm.com
State Superseded
Headers show
Series xen/arm: Memory subsystem clean-up | expand

Commit Message

Julien Grall Sept. 12, 2017, 10:03 a.m. UTC
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>

---
    Changes in v2:
        - Switch the runtime check to a BUG_ON()
---
 xen/arch/arm/mm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefano Stabellini Sept. 19, 2017, 11:17 p.m. UTC | #1
On Tue, 12 Sep 2017, Julien Grall wrote:
> 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>
> 
> ---
>     Changes in v2:
>         - Switch the runtime check to a BUG_ON()

Since you are at it, could you please also turn the other runtime check
few lines below into another BUG_ON (under MODIFY)?


> ---
>  xen/arch/arm/mm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 8a56f37821..a6b228ba9b 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -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;
> -- 
> 2.11.0
>
Julien Grall Oct. 2, 2017, 1:30 p.m. UTC | #2
Hi Stefano,

On 20/09/17 00:17, Stefano Stabellini wrote:
> On Tue, 12 Sep 2017, Julien Grall wrote:
>> 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>
>>
>> ---
>>      Changes in v2:
>>          - Switch the runtime check to a BUG_ON()
> 
> Since you are at it, could you please also turn the other runtime check
> few lines below into another BUG_ON (under MODIFY)?

I would prefer to keep the runtime check in MODIFY for now. It is not 
really critical and I plan to ditch create_xen_entries fairly soon.

This series is actually a preparatory for what's coming up.

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 8a56f37821..a6b228ba9b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -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;