Skip to content

Commit 3b0c0c9

Browse files
philipderrinRussell King
authored andcommitted
ARM: 8721/1: mm: dump: check hardware RO bit for LPAE
When CONFIG_ARM_LPAE is set, the PMD dump relies on the software read-only bit to determine whether a page is writable. This concealed a bug which left the kernel text section writable (AP2=0) while marked read-only in the software bit. In a kernel with the AP2 bug, the dump looks like this: ---[ Kernel Mapping ]--- 0xc0000000-0xc0200000 2M RW NX SHD 0xc0200000-0xc0600000 4M ro x SHD 0xc0600000-0xc0800000 2M ro NX SHD 0xc0800000-0xc4800000 64M RW NX SHD The fix is to check that the software and hardware bits are both set before displaying "ro". The dump then shows the true perms: ---[ Kernel Mapping ]--- 0xc0000000-0xc0200000 2M RW NX SHD 0xc0200000-0xc0600000 4M RW x SHD 0xc0600000-0xc0800000 2M RW NX SHD 0xc0800000-0xc4800000 64M RW NX SHD Fixes: ded9477 ("ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE") Signed-off-by: Philip Derrin <philip@cog.systems> Tested-by: Neil Dick <neil@cog.systems> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent 29337b6 commit 3b0c0c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm/mm/dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ static const struct prot_bits section_bits[] = {
129129
.val = PMD_SECT_USER,
130130
.set = "USR",
131131
}, {
132-
.mask = L_PMD_SECT_RDONLY,
133-
.val = L_PMD_SECT_RDONLY,
132+
.mask = L_PMD_SECT_RDONLY | PMD_SECT_AP2,
133+
.val = L_PMD_SECT_RDONLY | PMD_SECT_AP2,
134134
.set = "ro",
135135
.clear = "RW",
136136
#elif __LINUX_ARM_ARCH__ >= 6

0 commit comments

Comments
 (0)