]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 8722/1: mm: make STRICT_KERNEL_RWX effective for LPAE
authorPhilip Derrin <philip@cog.systems>
Mon, 13 Nov 2017 23:55:25 +0000 (00:55 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Tue, 21 Nov 2017 15:10:07 +0000 (15:10 +0000)
commit75fe3b0399a61fd3f6c0bf3c9120bf2365f2a6f4
treea21d5b4f3044abb133eeb03cb12db8664b964abd
parent02ec89c563f75e8a5dad28d1af5faa5811afba4f
ARM: 8722/1: mm: make STRICT_KERNEL_RWX effective for LPAE

Currently, for ARM kernels with CONFIG_ARM_LPAE and
CONFIG_STRICT_KERNEL_RWX enabled, the 2MiB pages mapping the
kernel code and rodata are writable. They are marked read-only in
a software bit (L_PMD_SECT_RDONLY) but the hardware read-only bit
is not set (PMD_SECT_AP2).

For user mappings, the logic that propagates the software bit
to the hardware bit is in set_pmd_at(); but for the kernel,
section_update() writes the PMDs directly, skipping this logic.

The fix is to set PMD_SECT_AP2 for read-only sections in
section_update(), at the same time as L_PMD_SECT_RDONLY.

Fixes: 92f78c966a0d ("ARM: 8275/1: mm: fix PMD_SECT_RDONLY undeclared compile error")
Signed-off-by: Philip Derrin <philip@cog.systems>
Reported-by: Neil Dick <neil@cog.systems>
Tested-by: Neil Dick <neil@cog.systems>
Tested-by: Laura Abbott <labbott@redhat.com>
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/init.c