* [PATCH] powerpc: Don't let userspace trigger a kernel WARN_ON
@ 2018-06-08 3:21 Benjamin Herrenschmidt
0 siblings, 0 replies; only message in thread
From: Benjamin Herrenschmidt @ 2018-06-08 3:21 UTC (permalink / raw)
To: linuxppc-dev
In commit 2865d08dd9ea876524652f3900b4b3b9c8b22e77
"powerpc/mm: Move the DSISR_PROTFAULT sanity check",
I completely missed the fact that an attempt at reading
kernel memory *will* trip the warning.
So this partially reverts it. We keep the test in a
helper to keep the code clean, but we move it back to
after the VMA has been found.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index c01d627e687a..20384445ca44 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -416,9 +416,6 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
return SIGBUS;
}
- /* Additional sanity check(s) */
- sanity_check_fault(is_write, error_code);
-
/*
* The kernel should never take an execute fault nor should it
* take a page fault to a kernel address.
@@ -511,6 +508,10 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
return bad_area(regs, address);
good_area:
+ /* Additional sanity check(s) */
+ sanity_check_fault(is_write, error_code);
+
+ /* Check for VMA access permissions */
if (unlikely(access_error(is_write, is_exec, vma)))
return bad_access(regs, address);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-06-08 3:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 3:21 [PATCH] powerpc: Don't let userspace trigger a kernel WARN_ON Benjamin Herrenschmidt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.