diff mbox series

[edk2,3/4] ArmPkg/CpuDxe: ARM: ignore page table updates that only change permissions

Message ID 1486661891-7888-4-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show
Series ArmPkg: add groundwork for DXE image protection | expand

Commit Message

Ard Biesheuvel Feb. 9, 2017, 5:38 p.m. UTC
Currently, we have not implemented support on 32-bit ARM for managing
permission bits in the page tables. Since the new DXE page protection
for PE/COFF images may invoke EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes()
with only permission attributes set, let's simply ignore those for now.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPkg/Drivers/CpuDxe/Arm/Mmu.c | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Feb. 10, 2017, 5:59 p.m. UTC | #1
On Thu, Feb 09, 2017 at 05:38:10PM +0000, Ard Biesheuvel wrote:
> Currently, we have not implemented support on 32-bit ARM for managing

> permission bits in the page tables. Since the new DXE page protection

> for PE/COFF images may invoke EFI_CPU_ARCH_PROTOCOL.SetMemoryAttributes()

> with only permission attributes set, let's simply ignore those for now.

> 

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


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


> ---

>  ArmPkg/Drivers/CpuDxe/Arm/Mmu.c | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c

> index b6ba975b353a..89e429925ba9 100644

> --- a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c

> +++ b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c

> @@ -680,6 +680,13 @@ SetMemoryAttributes (

>  {

>    EFI_STATUS    Status;

>  

> +  //

> +  // Ignore invocations that only modify permission bits

> +  //

> +  if ((Attributes & EFI_MEMORY_CACHETYPE_MASK) == 0) {

> +    return EFI_SUCCESS;

> +  }

> +

>    if(((BaseAddress & 0xFFFFF) == 0) && ((Length & 0xFFFFF) == 0)) {

>      // Is the base and length a multiple of 1 MB?

>      DEBUG ((EFI_D_PAGE, "SetMemoryAttributes(): MMU section 0x%x length 0x%x to %lx\n", (UINTN)BaseAddress, (UINTN)Length, Attributes));

> -- 

> 2.7.4

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
index b6ba975b353a..89e429925ba9 100644
--- a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
+++ b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c
@@ -680,6 +680,13 @@  SetMemoryAttributes (
 {
   EFI_STATUS    Status;
 
+  //
+  // Ignore invocations that only modify permission bits
+  //
+  if ((Attributes & EFI_MEMORY_CACHETYPE_MASK) == 0) {
+    return EFI_SUCCESS;
+  }
+
   if(((BaseAddress & 0xFFFFF) == 0) && ((Length & 0xFFFFF) == 0)) {
     // Is the base and length a multiple of 1 MB?
     DEBUG ((EFI_D_PAGE, "SetMemoryAttributes(): MMU section 0x%x length 0x%x to %lx\n", (UINTN)BaseAddress, (UINTN)Length, Attributes));