Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1497133
| From | Jann Horn <jann@thejh.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [kernel-hardening] RE: [PATCH] printk: introduce kptr_restrict level 3 |
| Date | 2016-10-07 14:00 +0200 |
| Message-ID | <spBYJ-8jM-17@gated-at.bofh.it> (permalink) |
| References | <soYNI-4PT-13@gated-at.bofh.it> <sph3Y-GK-21@gated-at.bofh.it> <sphdE-Kt-19@gated-at.bofh.it> <sphwZ-18h-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Thu, Oct 06, 2016 at 04:05:53PM +0200, Jann Horn wrote:
> On Thu, Oct 06, 2016 at 01:47:47PM +0000, Roberts, William C wrote:
> > > -----Original Message-----
> > > From: Christoph Hellwig [mailto:hch@infradead.org]
> > > Sent: Thursday, October 6, 2016 9:32 AM
> > > To: Roberts, William C <william.c.roberts@intel.com>
> > > Cc: kernel-hardening@lists.openwall.com; corbet@lwn.net; linux-
> > > doc@vger.kernel.org; linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH] printk: introduce kptr_restrict level 3
> > >
> > > On Wed, Oct 05, 2016 at 02:04:46PM -0400, 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.
> > >
> > > So what? We a) don't care about out of tree modules and b) you could just triviall
> > > fix them up if you care.
> >
> > Out of tree modules still affect core kernel security. I would also bet money, that somewhere
> > In-tree someone has put a %p when they wanted a %pK. So this method is just quite error
> > prone. We currently have a blacklist approach versus whitelist.
>
> grep says you have a point:
>
> $ grep -IR 'seq_printf.*%p[^FfSsBRrhbMmIiEUVKNadCDgG].*&'
> drivers/dma/qcom/hidma_dbg.c: seq_printf(s, "dev_trca=%p\n", &dmadev->dev_trca);
> drivers/dma/qcom/hidma_dbg.c: seq_printf(s, "dev_evca=%p\n", &dmadev->dev_evca);
>
> $ grep -IR 'pr_info.*%p[^FfSsBRrhbMmIiEUVKNadCDgG].*&'
> drivers/misc/lkdtm_heap.c: pr_info("Allocated memory %p-%p\n", base, &base[offset * 2]);
>
> $ grep -IR 'pr_err.*%p[^FfSsBRrhbMmIiEUVKNadCDgG].*&'
> drivers/net/ethernet/qlogic/qlge/qlge_dbg.c: pr_err("rx_ring->cqicb = %p\n", &rx_ring->cqicb);
Actually, I think I missed something here.
We don't really want to censor pointers in dmesg, right? dmesg can
contain pointers by design - and in particular, when an oops
happens, the register dump will reveal pointers. dmesg should just
be restricted using dmesg_restrict.
(What is annoying, though, is that e.g. Debian's default rsyslog
config sends all KERN_EMERG messages to all active PTYs by default,
meaning that on a system with such a config, making the kernel oops
can be used to leak some ASLR information.)
(And why does __die() in arch/x86/kernel/dumpstack.c use KERN_EMERG
for CONFIG_X86_32, but KERN_ALERT for !CONFIG_X86_32?)
Back to linux.kernel | Previous | Next — Previous 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