Files
Linux/include/linux
Jann Horn 9da3f2b740 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 96ca579a1e ("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]
2018-09-03 15:12:09 +02:00
..
…
…
…
…
2018-07-15 13:55:44 +02:00
…
…
…
…
2018-08-09 14:05:30 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-15 18:10:01 -03:00
…
…
…
…
…
…
…
…
…
…
…
2018-07-24 14:43:26 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-15 18:10:01 -03:00
2018-06-19 10:06:29 -07:00
2018-06-19 10:06:29 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-22 10:52:48 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-07-22 14:13:43 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-07-24 19:11:26 +02:00
…
…
…
…
…
2018-07-12 10:04:29 -04:00
…
…
…
…
…
…
…
…
…
…
2018-07-27 09:57:23 +10:00
…
…
…
…
…
…
2018-06-28 20:32:51 +09:00
…
…
…
…
…
…
…
…
…
…
…
2018-06-07 17:34:37 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-08 11:06:20 +02:00
…
…
…
…
…
…
2018-06-22 13:43:27 +09:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-21 12:33:21 +02:00
…
…
…
2018-07-12 21:35:28 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-07 17:34:35 -07:00
…
…
…
…
…
…
…
…
…
…
2018-06-07 17:34:39 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-22 10:52:45 -07:00
…
…
…
…
…
…
…
…
…
…
…
2018-07-10 17:22:35 +02:00
…
…
…
…
…
…
…
…
…
2018-06-07 17:34:36 -07:00
…
…
…
…
…
…
…
2018-08-15 14:59:03 -05:00
…
…
2018-07-19 11:34:23 +01:00
…
2018-06-07 17:34:35 -07:00
…
…
2018-07-25 13:41:22 -07:00
2018-07-21 10:43:12 -05:00
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-22 10:52:46 -07:00
…
…
…
…
…
…
2018-07-20 01:11:45 +02:00
…
…
…
2018-08-02 17:33:06 -04:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-08-02 17:16:05 +02:00
…
…
2018-06-29 08:48:06 -06:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-07 17:34:35 -07:00
…
…
…
2018-07-07 17:25:23 +02:00
…
…
…
…
2018-07-03 09:20:44 +02:00
…
…
…
…
…
…
2018-08-16 12:14:42 -07:00
…
…
…
…
…
…
…
…
…
…
…
…
…
2018-06-20 11:35:56 +02:00
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…