summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/book3s
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2018-01-19 04:50:38 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-20 14:59:04 +0300
commitbca7aacfe8be121ecefb3be609420220b0820c2c (patch)
tree8e49c046113a0e78973ccadb354507715d2a790c /arch/powerpc/include/asm/book3s
parentf2407ef3ba225665ee24965f69bc84435fb590cf (diff)
downloadlinux-bca7aacfe8be121ecefb3be609420220b0820c2c.tar.xz
powerpc: check key protection for user page access
Make sure that the kernel does not access user pages without checking their key-protection. Signed-off-by: Ram Pai <linuxram@us.ibm.com> [mpe: Integrate with upstream version of pte_access_permitted()] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/book3s')
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 449b797f8b7b..1c495068bcfa 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -571,7 +571,14 @@ static inline int pte_present(pte_t pte)
return !!(pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT));
}
+#ifdef CONFIG_PPC_MEM_KEYS
extern bool arch_pte_access_permitted(u64 pte, bool write, bool execute);
+#else
+static inline bool arch_pte_access_permitted(u64 pte, bool write, bool execute)
+{
+ return true;
+}
+#endif /* CONFIG_PPC_MEM_KEYS */
#define pte_access_permitted pte_access_permitted
static inline bool pte_access_permitted(pte_t pte, bool write)
@@ -593,7 +600,8 @@ static inline bool pte_access_permitted(pte_t pte, bool write)
if ((pteval & clear_pte_bits) == clear_pte_bits)
return false;
- return true;
+
+ return arch_pte_access_permitted(pte_val(pte), write, 0);
}
/*