android_kernel_oneplus_msm8998/arch/arm64
Catalin Marinas 70d65587f0 arm64: Update PTE_RDONLY in set_pte_at() for PROT_NONE permission
commit fdc69e7df3cb24f18a93192641786e5b7ecd1dfe upstream.

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 2f4b829c62 ("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: 2f4b829c62 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-04 14:48:42 -07:00
..
boot ls2080a/dts: Add little endian property for GPIO IP block 2015-12-11 16:13:03 -08:00
configs arm64 fixes and clean-ups: 2015-11-12 15:33:11 -08:00
crypto arm64: crypto: reduce priority of core AES cipher 2015-11-18 12:09:08 +00:00
include arm64: Update PTE_RDONLY in set_pte_at() for PROT_NONE permission 2016-05-04 14:48:42 -07:00
kernel arm64: replace read_lock to rcu lock in call_step_hook 2016-04-20 15:42:14 +09:00
kvm arm/arm64: KVM: Fix ioctl error handling 2016-03-09 15:34:51 -08:00
lib arm64: add KASAN support 2015-10-12 17:46:36 +01:00
mm arm64: vmemmap: use virtual projection of linear region 2016-03-09 15:34:52 -08:00
net arm64: bpf: add 'store immediate' instruction 2015-12-03 11:38:31 -05:00
xen arm: xen: implement multicall hypercall support. 2014-04-24 13:09:46 +01:00
Kconfig arm64 fixes: 2015-11-27 11:09:59 -08:00
Kconfig.debug arm64: remove redundant FRAME_POINTER kconfig option and force to select it 2015-11-10 10:36:00 +00:00
Kconfig.platforms ARM: DT updates for v4.4 2015-11-10 15:06:26 -08:00
Makefile arm64: errata: Add -mpc-relative-literal-loads to build flags 2016-03-03 15:07:08 -08:00