diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-09-08 03:57:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-20 16:32:49 -0400 |
commit | df04abfd181acc276ba6762c8206891ae10ae00d (patch) | |
tree | 03afe92ae5ef3e51035ab871e0b29742d11eb0d1 /fs/proc/kcore.c | |
parent | f5beeb1851ea6f8cfcf2657f26cb24c0582b4945 (diff) |
fs/proc/kcore.c: Add bounce buffer for ktext data
We hit hardened usercopy feature check for kernel text access by reading
kcore file:
usercopy: kernel memory exposure attempt detected from ffffffff8179a01f (<kernel text>) (4065 bytes)
kernel BUG at mm/usercopy.c:75!
Bypassing this check for kcore by adding bounce buffer for ktext data.
Reported-by: Steve Best <sbest@redhat.com>
Fixes: f5509cc18daa ("mm: Hardened usercopy")
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/kcore.c')
-rw-r--r-- | fs/proc/kcore.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index bd3ac9dca252..5c89a07e3d7f 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -509,7 +509,12 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) | |||
509 | if (kern_addr_valid(start)) { | 509 | if (kern_addr_valid(start)) { |
510 | unsigned long n; | 510 | unsigned long n; |
511 | 511 | ||
512 | n = copy_to_user(buffer, (char *)start, tsz); | 512 | /* |
513 | * Using bounce buffer to bypass the | ||
514 | * hardened user copy kernel text checks. | ||
515 | */ | ||
516 | memcpy(buf, (char *) start, tsz); | ||
517 | n = copy_to_user(buffer, buf, tsz); | ||
513 | /* | 518 | /* |
514 | * We cannot distinguish between fault on source | 519 | * We cannot distinguish between fault on source |
515 | * and fault on destination. When this happens | 520 | * and fault on destination. When this happens |