Commit bca7aacf authored by Ram Pai's avatar Ram Pai Committed by Michael Ellerman

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: default avatarRam Pai <linuxram@us.ibm.com>
[mpe: Integrate with upstream version of pte_access_permitted()]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent f2407ef3
...@@ -571,7 +571,14 @@ static inline int pte_present(pte_t pte) ...@@ -571,7 +571,14 @@ static inline int pte_present(pte_t pte)
return !!(pte_raw(pte) & cpu_to_be64(_PAGE_PRESENT)); 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); 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 #define pte_access_permitted pte_access_permitted
static inline bool pte_access_permitted(pte_t pte, bool write) 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) ...@@ -593,7 +600,8 @@ static inline bool pte_access_permitted(pte_t pte, bool write)
if ((pteval & clear_pte_bits) == clear_pte_bits) if ((pteval & clear_pte_bits) == clear_pte_bits)
return false; return false;
return true;
return arch_pte_access_permitted(pte_val(pte), write, 0);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment