Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1475094

[PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature
Date 2016-09-02 14:30 +0200
Message-ID <scVLz-7Si-25@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


One of the bullets for hardened usercopy feature is:
  - object must not overlap with kernel text

which is what we expose via /proc/kcore. We can hit
this check and crash the system very easily just by
reading the text area in kcore file:

  usercopy: kernel memory exposure attempt detected from ffffffff8179a01f (<kernel text>) (4065 bytes)
  kernel BUG at mm/usercopy.c:75!

Omitting kernel text area from kcore when there's
hardened usercopy feature is enabled.

Fixes: f5509cc18daa ("mm: Hardened usercopy")
Reported-by: Steve Best <sbest@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 fs/proc/kcore.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index a939f5ed7f89..e322d4e0be4d 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -629,8 +629,12 @@ static int __init proc_kcore_init(void)
 		pr_err("couldn't create /proc/kcore\n");
 		return 0; /* Always returns 0. */
 	}
+
+#ifndef CONFIG_HARDENED_USERCOPY
 	/* Store text area if it's special */
 	proc_kcore_text_init();
+#endif
+
 	/* Store vmalloc area */
 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
 		VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@kernel.org> - 2016-09-02 14:30 +0200
  Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-02 17:20 +0200
    Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-02 18:20 +0200
    Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-05 10:50 +0200
      Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-05 18:30 +0200
      Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Kees Cook <keescook@chromium.org> - 2016-09-06 20:00 +0200
        Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-06 20:40 +0200
          Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-06 21:50 +0200
            Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-06 21:50 +0200
              Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Kees Cook <keescook@chromium.org> - 2016-09-07 19:20 +0200
                Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-07 19:30 +0200
        Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 09:40 +0200
          Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-07 18:40 +0200
            Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-07 19:00 +0200
              Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 21:30 +0200
                Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 23:30 +0200
                Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened  usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-08 01:00 +0200

csiph-web