Commit 56b88a3b authored by Richard Weinberger's avatar Richard Weinberger

um: Fix kernel mode fault condition

We have to exclude memory locations <= PAGE_SIZE from
the condition and let the kernel mode fault path catch it.
Otherwise a kernel NULL pointer exception will be reported
as a kernel user space access.

Fixes: d2313084 (um: Catch unprotected user memory access)
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 6b187337
...@@ -220,7 +220,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, ...@@ -220,7 +220,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
show_regs(container_of(regs, struct pt_regs, regs)); show_regs(container_of(regs, struct pt_regs, regs));
panic("Segfault with no mm"); panic("Segfault with no mm");
} }
else if (!is_user && address < TASK_SIZE) { else if (!is_user && address > PAGE_SIZE && address < TASK_SIZE) {
show_regs(container_of(regs, struct pt_regs, regs)); show_regs(container_of(regs, struct pt_regs, regs));
panic("Kernel tried to access user memory at addr 0x%lx, ip 0x%lx", panic("Kernel tried to access user memory at addr 0x%lx, ip 0x%lx",
address, ip); address, ip);
......
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