]> asedeno.scripts.mit.edu Git - linux.git/commit
ARM: 8721/1: mm: dump: check hardware RO bit for LPAE
authorPhilip Derrin <philip@cog.systems>
Mon, 13 Nov 2017 23:55:26 +0000 (00:55 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Tue, 21 Nov 2017 15:10:07 +0000 (15:10 +0000)
commit3b0c0c922ff4be275a8beb87ce5657d16f355b54
treec12be9315a645c400e1e62b91158237be85eb6d0
parent29337b60ab5d2a499847c26d45e3cb81f62c2f26
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: ded947798469 ("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>
arch/arm/mm/dump.c