All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Arm: relax iomem_access_permitted() check
@ 2021-08-18  7:52 Jan Beulich
  2021-08-18 17:44 ` Julien Grall
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2021-08-18  7:52 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk

Ranges checked by iomem_access_permitted() are inclusive; to permit a
mapping there's no need for access to also have been granted for the
subsequent page.

Fixes: 80f9c3167084 ("xen/arm: acpi: Map MMIO on fault in stage-2 page table for the hardware domain")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1893,7 +1893,7 @@ static bool try_map_mmio(gfn_t gfn)
         return false;
 
     /* The hardware domain can only map permitted MMIO regions */
-    if ( !iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn) + 1) )
+    if ( !iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn)) )
         return false;
 
     return !map_regions_p2mt(d, gfn, 1, mfn, p2m_mmio_direct_c);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Arm: relax iomem_access_permitted() check
  2021-08-18  7:52 [PATCH] Arm: relax iomem_access_permitted() check Jan Beulich
@ 2021-08-18 17:44 ` Julien Grall
  2021-08-19  8:11   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2021-08-18 17:44 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Stefano Stabellini, Volodymyr Babchuk

Hi Jan,

On 18/08/2021 08:52, Jan Beulich wrote:
> Ranges checked by iomem_access_permitted() are inclusive; to permit a
> mapping there's no need for access to also have been granted for the
> subsequent page.

Good catch! OOI, how did you find it?

> 
> Fixes: 80f9c3167084 ("xen/arm: acpi: Map MMIO on fault in stage-2 page table for the hardware domain")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,

> 
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1893,7 +1893,7 @@ static bool try_map_mmio(gfn_t gfn)
>           return false;
>   
>       /* The hardware domain can only map permitted MMIO regions */
> -    if ( !iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn) + 1) )
> +    if ( !iomem_access_permitted(d, mfn_x(mfn), mfn_x(mfn)) )
>           return false;
>   
>       return !map_regions_p2mt(d, gfn, 1, mfn, p2m_mmio_direct_c);
> 

-- 
Julien Grall


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Arm: relax iomem_access_permitted() check
  2021-08-18 17:44 ` Julien Grall
@ 2021-08-19  8:11   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2021-08-19  8:11 UTC (permalink / raw)
  To: Julien Grall; +Cc: Stefano Stabellini, Volodymyr Babchuk, xen-devel

On 18.08.2021 19:44, Julien Grall wrote:
> On 18/08/2021 08:52, Jan Beulich wrote:
>> Ranges checked by iomem_access_permitted() are inclusive; to permit a
>> mapping there's no need for access to also have been granted for the
>> subsequent page.
> 
> Good catch! OOI, how did you find it?

In the course of my large-IOMMU-mappings work I ended up grep-ing for
all uses of the function, and this one - while unrelated to that work -
caught my eye.

>> Fixes: 80f9c3167084 ("xen/arm: acpi: Map MMIO on fault in stage-2 page table for the hardware domain")
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Julien Grall <jgrall@amazon.com>

Thanks.

Jan



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-19  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18  7:52 [PATCH] Arm: relax iomem_access_permitted() check Jan Beulich
2021-08-18 17:44 ` Julien Grall
2021-08-19  8:11   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.