diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2020-01-24 14:54:40 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-01-28 15:13:17 +0300 |
commit | 6ec20aa2e510b6297906c45f009aa08b2d97269a (patch) | |
tree | 0f2bb05b0963cd7aa4666aa21fa49d01c049bbf1 /arch/powerpc/include/asm/book3s/64/kup-radix.h | |
parent | 3c2659bd1db81ed6a264a9fc6262d51667d655ad (diff) | |
download | linux-6ec20aa2e510b6297906c45f009aa08b2d97269a.tar.xz |
powerpc/32s: Fix bad_kuap_fault()
At the moment, bad_kuap_fault() reports a fault only if a bad access
to userspace occurred while access to userspace was not granted.
But if a fault occurs for a write outside the allowed userspace
segment(s) that have been unlocked, bad_kuap_fault() fails to
detect it and the kernel loops forever in do_page_fault().
Fix it by checking that the accessed address is within the allowed
range.
Fixes: a68c31fc01ef ("powerpc/32s: Implement Kernel Userspace Access Protection")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/f48244e9485ada0a304ed33ccbb8da271180c80d.1579866752.git.christophe.leroy@c-s.fr
Diffstat (limited to 'arch/powerpc/include/asm/book3s/64/kup-radix.h')
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/kup-radix.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h b/arch/powerpc/include/asm/book3s/64/kup-radix.h index f254de956d6a..dbbd22cb80f5 100644 --- a/arch/powerpc/include/asm/book3s/64/kup-radix.h +++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h @@ -95,7 +95,8 @@ static inline void prevent_user_access(void __user *to, const void __user *from, set_kuap(AMR_KUAP_BLOCKED); } -static inline bool bad_kuap_fault(struct pt_regs *regs, bool is_write) +static inline bool +bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write) { return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) && (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : AMR_KUAP_BLOCK_READ)), |