]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
arm64: Honour !PTE_WRITE in set_pte_at() for kernel mappings
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 7 Jan 2016 16:07:20 +0000 (16:07 +0000)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:29:53 +0000 (10:29 +0100)
commit7e91a8575d1b3adc4105f05748ca700ab7fb00a6
tree90655be67e23cb78b29155abd36b176b081b599d
parentdc414a1818445ab265a78c82e023c46f985e537a
arm64: Honour !PTE_WRITE in set_pte_at() for kernel mappings

BugLink: http://bugs.launchpad.net/bugs/1566518
Currently, set_pte_at() only checks the software PTE_WRITE bit for user
mappings when it sets or clears the hardware PTE_RDONLY accordingly. The
kernel ptes are written directly without any modification, relying
solely on the protection bits in macros like PAGE_KERNEL. However,
modifying kernel pte attributes via pte_wrprotect() would be ignored by
set_pte_at(). Since pte_wrprotect() does not set PTE_RDONLY (it only
clears PTE_WRITE), the new permission is not taken into account.

This patch changes set_pte_at() to adjust the read-only permission for
kernel ptes as well. As a side effect, existing PROT_* definitions used
for kernel ioremap*() need to include PTE_DIRTY | PTE_WRITE.

(additionally, white space fix for PTE_KERNEL_ROX)

Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit ac15bd63bbb24238f763ec5b24ee175ec301e8cd)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/arm64/include/asm/pgtable.h