]> Git Repo - linux.git/commit
x86/fault: BUG() when uaccess helpers fault on kernel addresses
authorJann Horn <[email protected]>
Tue, 28 Aug 2018 20:14:20 +0000 (22:14 +0200)
committerThomas Gleixner <[email protected]>
Mon, 3 Sep 2018 13:12:09 +0000 (15:12 +0200)
commit9da3f2b74054406f87dff7101a569217ffceb29b
tree12dc39602e4c134a2becbe843925b1e65b6971d8
parent81fd9c18444ed1199b5a6f6776a395292d4256fb
x86/fault: BUG() when uaccess helpers fault on kernel addresses

There have been multiple kernel vulnerabilities that permitted userspace to
pass completely unchecked pointers through to userspace accessors:

 - the waitid() bug - commit 96ca579a1ecc ("waitid(): Add missing
   access_ok() checks")
 - the sg/bsg read/write APIs
 - the infiniband read/write APIs

These don't happen all that often, but when they do happen, it is hard to
test for them properly; and it is probably also hard to discover them with
fuzzing. Even when an unmapped kernel address is supplied to such buggy
code, it just returns -EFAULT instead of doing a proper BUG() or at least
WARN().

Try to make such misbehaving code a bit more visible by refusing to do a
fixup in the pagefault handler code when a userspace accessor causes a #PF
on a kernel address and the current context isn't whitelisted.

Signed-off-by: Jann Horn <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Kees Cook <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Masami Hiramatsu <[email protected]>
Cc: "Naveen N. Rao" <[email protected]>
Cc: Anil S Keshavamurthy <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: [email protected]
Cc: Borislav Petkov <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/mm/extable.c
fs/namespace.c
include/linux/sched.h
mm/maccess.c
This page took 0.055607 seconds and 4 git commands to generate.