]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmMmuLib ARM: handle unmapped sections when updating permissions
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 30 Nov 2018 11:28:27 +0000 (12:28 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 3 Dec 2018 14:55:35 +0000 (15:55 +0100)
The ARM ArmMmuLib code currently does not take into account that
setting permissions on a region should take into account that a
region may not be mapped yet to begin with.

So when updating a section descriptor whose old value is zero,
pass in the address explicitly.

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

index ec51e072ab43571dde03f29ff529643a7fc6dc07..889b22867dc79081a6a8bb79736533ccd8a27126 100644 (file)
@@ -695,8 +695,12 @@ UpdateSectionEntries (
     } else {\r
       // still a section entry\r
 \r
-      // mask off appropriate fields\r
-      Descriptor = CurrentDescriptor & ~EntryMask;\r
+      if (CurrentDescriptor != 0) {\r
+        // mask off appropriate fields\r
+        Descriptor = CurrentDescriptor & ~EntryMask;\r
+      } else {\r
+        Descriptor = ((UINTN)FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT;\r
+      }\r
 \r
       // mask in new attributes and/or permissions\r
       Descriptor |= EntryValue;\r