Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1496645
| From | "Roberts, William C" <william.c.roberts@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] printk: introduce kptr_restrict level 3 |
| Date | 2016-10-06 15:20 +0200 |
| Message-ID | <spgKB-A6-1@gated-at.bofh.it> (permalink) |
| References | <soYNI-4PT-13@gated-at.bofh.it> <sp0cN-64z-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> -----Original Message-----
> From: keescook@google.com [mailto:keescook@google.com] On Behalf Of Kees
> Cook
> Sent: Wednesday, October 5, 2016 3:34 PM
> To: Roberts, William C <william.c.roberts@intel.com>
> Cc: kernel-hardening@lists.openwall.com; Jonathan Corbet <corbet@lwn.net>;
> linux-doc@vger.kernel.org; LKML <linux-kernel@vger.kernel.org>; Nick
> Desaulniers <ndesaulniers@google.com>; Dave Weinstein <olorin@google.com>
> Subject: Re: [PATCH] printk: introduce kptr_restrict level 3
>
> On Wed, Oct 5, 2016 at 11:04 AM, <william.c.roberts@intel.com> wrote:
> > From: William Roberts <william.c.roberts@intel.com>
> >
> > Some out-of-tree modules do not use %pK and just use %p, as it's the
> > common C paradigm for printing pointers. Because of this,
> > kptr_restrict has no affect on the output and thus, no way to contain
> > the kernel address leak.
>
> Solving this is certainly a good idea -- I'm all for finding a solid solution.
>
> > Introduce kptr_restrict level 3 that causes the kernel to treat %p as
> > if it was %pK and thus always prints zeros.
>
> I'm worried that this could break kernel internals where %p is being used and not
> exposed to userspace. Maybe those situations don't exist...
Not saying they don't I didn't find any.
>
> Regardless, I would rather do what Grsecurity has done in this area, and whitelist
> known-safe values instead. For example, they have %pP for approved pointers,
> and %pX for approved
> dereference_function_descriptor() output. Everything else is censored if it is a
> value in kernel memory and destined for a user-space memory
> buffer:
>
> if ((unsigned long)ptr > TASK_SIZE && *fmt != 'P' && *fmt != 'X' && *fmt !=
> 'K' && is_usercopy_object(buf)) {
> printk(KERN_ALERT "grsec: kernel infoleak detected!
> Please report this log to spender@grsecurity.net.\n");
> dump_stack();
> ptr = NULL;
> }
>
> The "is_usercopy_object()" test is something we can add, which is testing for a
> new SLAB flag that is used to mark slab caches as either used by user-space or
> not, which is done also through whitelisting.
> (For more details on this, see:
> http://www.openwall.com/lists/kernel-hardening/2016/06/08/10)
>
> Would you have time/interest to add the slab flags and is_usercopy_object()?
> The hardened usercopy part of the slab whitelisting can be separate, since it likely
> needs a different usercopy interface to sanely integrate with upstream.
I could likely take this on. I would need to read up on the links and have a better concept
of what it is.
>
> -Kees
>
> --
> Kees Cook
> Nexus Security
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] printk: introduce kptr_restrict level 3 william.c.roberts@intel.com - 2016-10-05 20:10 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Kees Cook <keescook@chromium.org> - 2016-10-05 21:40 +0200
RE: [PATCH] printk: introduce kptr_restrict level 3 "Roberts, William C" <william.c.roberts@intel.com> - 2016-10-06 15:20 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-10-05 23:00 +0200
RE: [PATCH] printk: introduce kptr_restrict level 3 "Roberts, William C" <william.c.roberts@intel.com> - 2016-10-06 15:30 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Christoph Hellwig <hch@infradead.org> - 2016-10-06 15:40 +0200
RE: [PATCH] printk: introduce kptr_restrict level 3 "Roberts, William C" <william.c.roberts@intel.com> - 2016-10-06 15:50 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Christoph Hellwig <hch@infradead.org> - 2016-10-06 16:00 +0200
RE: [PATCH] printk: introduce kptr_restrict level 3 "Roberts, William C" <william.c.roberts@intel.com> - 2016-10-06 17:10 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Kees Cook <keescook@chromium.org> - 2016-10-06 23:10 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Joe Perches <joe@perches.com> - 2016-10-06 23:30 +0200
Re: [PATCH] printk: introduce kptr_restrict level 3 Kees Cook <keescook@chromium.org> - 2016-10-06 23:30 +0200
RE: [PATCH] printk: introduce kptr_restrict level 3 "Roberts, William C" <william.c.roberts@intel.com> - 2016-10-07 16:30 +0200
Re: [kernel-hardening] RE: [PATCH] printk: introduce kptr_restrict level 3 Jann Horn <jann@thejh.net> - 2016-10-06 16:10 +0200
Re: [kernel-hardening] RE: [PATCH] printk: introduce kptr_restrict level 3 Jann Horn <jann@thejh.net> - 2016-10-06 16:50 +0200
Re: [kernel-hardening] RE: [PATCH] printk: introduce kptr_restrict level 3 Jann Horn <jann@thejh.net> - 2016-10-07 14:00 +0200
csiph-web