public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
@ 2019-01-07  6:56 Ard Biesheuvel
  2019-01-14 11:43 ` Leif Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2019-01-07  6:56 UTC (permalink / raw)
  To: edk2-devel

Ignore calls to ArmSetMemoryAttributes () when the region described
is outside of the 32-bit addressable range. This memory is not
mapped in the first place, and the current code does not deal with
the high bits correctly, resulting in hangs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
index 3b3b20aa9b78..bffab83d4fd0 100644
--- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
@@ -744,6 +744,10 @@ ArmSetMemoryAttributes (
   UINT64        ChunkLength;
   BOOLEAN       FlushTlbs;
 
+  if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) {
+    return EFI_UNSUPPORTED;
+  }
+
   if (Length == 0) {
     return EFI_SUCCESS;
   }
-- 
2.20.1



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

* Re: [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
  2019-01-07  6:56 [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions Ard Biesheuvel
@ 2019-01-14 11:43 ` Leif Lindholm
  2019-01-14 18:46   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2019-01-14 11:43 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: edk2-devel

On Mon, Jan 07, 2019 at 07:56:49AM +0100, Ard Biesheuvel wrote:
> Ignore calls to ArmSetMemoryAttributes () when the region described
> is outside of the 32-bit addressable range. This memory is not
> mapped in the first place, and the current code does not deal with
> the high bits correctly, resulting in hangs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> index 3b3b20aa9b78..bffab83d4fd0 100644
> --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> @@ -744,6 +744,10 @@ ArmSetMemoryAttributes (
>    UINT64        ChunkLength;
>    BOOLEAN       FlushTlbs;
>  
> +  if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) {
> +    return EFI_UNSUPPORTED;
> +  }
> +
>    if (Length == 0) {
>      return EFI_SUCCESS;
>    }
> -- 
> 2.20.1
> 


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

* Re: [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions
  2019-01-14 11:43 ` Leif Lindholm
@ 2019-01-14 18:46   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-01-14 18:46 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel@lists.01.org

On Mon, 14 Jan 2019 at 12:43, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Mon, Jan 07, 2019 at 07:56:49AM +0100, Ard Biesheuvel wrote:
> > Ignore calls to ArmSetMemoryAttributes () when the region described
> > is outside of the 32-bit addressable range. This memory is not
> > mapped in the first place, and the current code does not deal with
> > the high bits correctly, resulting in hangs.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks

Pushed as e695e44545b4..d08575759e5a

> > ---
> >  ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> > index 3b3b20aa9b78..bffab83d4fd0 100644
> > --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> > +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c
> > @@ -744,6 +744,10 @@ ArmSetMemoryAttributes (
> >    UINT64        ChunkLength;
> >    BOOLEAN       FlushTlbs;
> >
> > +  if (BaseAddress > (UINT64)MAX_ADDRESS - Length + 1) {
> > +    return EFI_UNSUPPORTED;
> > +  }
> > +
> >    if (Length == 0) {
> >      return EFI_SUCCESS;
> >    }
> > --
> > 2.20.1
> >


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

end of thread, other threads:[~2019-01-14 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-07  6:56 [PATCH] ArmPkg/ArmMmuLib ARM: disregard high memory when setting permissions Ard Biesheuvel
2019-01-14 11:43 ` Leif Lindholm
2019-01-14 18:46   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox