]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
arm64: Update PTE_RDONLY in set_pte_at() for PROT_NONE permission
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 9 Mar 2016 16:31:29 +0000 (16:31 +0000)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:29:53 +0000 (10:29 +0100)
commit60f308a4ce46122d946928af6ce9de2f27afad09
treeaedf0d339ce7cbdab0a36718d6018a14d802163b
parent7e91a8575d1b3adc4105f05748ca700ab7fb00a6
arm64: Update PTE_RDONLY in set_pte_at() for PROT_NONE permission

BugLink: http://bugs.launchpad.net/bugs/1566518
The set_pte_at() function must update the hardware PTE_RDONLY bit
depending on the state of the PTE_WRITE and PTE_DIRTY bits of the given
entry value. However, it currently only performs this for pte_valid()
entries, ignoring PTE_PROT_NONE. The side-effect is that PROT_NONE
mappings would not have the PTE_RDONLY bit set. Without
CONFIG_ARM64_HW_AFDBM, this is not an issue since such PROT_NONE pages
are not accessible anyway.

With commit 2f4b829c625e ("arm64: Add support for hardware updates of
the access and dirty pte bits"), the ptep_set_wrprotect() function was
re-written to cope with automatic hardware updates of the dirty state.
As an optimisation, only PTE_RDONLY is checked to assess the "dirty"
status. Since set_pte_at() does not set this bit for PROT_NONE mappings,
such pages may be considered "dirty" as a result of
ptep_set_wrprotect().

This patch updates the pte_valid() check to pte_present() in
set_pte_at(). It also adds PTE_PROT_NONE to the swap entry bits comment.

Fixes: 2f4b829c625e ("arm64: Add support for hardware updates of the access and dirty pte bits")
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
Tested-by: Ganapatrao Kulkarni <gkulkarni@cavium.com>
Cc: <stable@vger.kernel.org>
(cherry picked from commit fdc69e7df3cb24f18a93192641786e5b7ecd1dfe)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/arm64/include/asm/pgtable.h