All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jann Horn <jann@thejh.net>
To: Solar Designer <solar@openwall.com>
Cc: Daniel Axtens <dja@axtens.net>,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Baoquan He <bhe@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: Re: [RFC] kernel/panic: place an upper limit on number of oopses
Date: Wed, 13 Jan 2016 19:08:19 +0100	[thread overview]
Message-ID: <20160113180819.GA22567@pc.thejh.net> (raw)
In-Reply-To: <20160113002043.GA17146@openwall.com>

[-- Attachment #1: Type: text/plain, Size: 2333 bytes --]

On Wed, Jan 13, 2016 at 03:20:43AM +0300, Solar Designer wrote:
> Jann Horn <jann@thejh.net> wrote:
> > To prevent an attacker from turning a mostly harmless oops into an
> > exploitable issue using a refcounter wraparound caused by repeated
> > oopsing, limit the number of oopses.
> 
> This may also reduce the likelihood of successful exploitation of some
> other vulnerabilities involving memory corruption, where an unsuccessful
> attempt may inadvertently trigger an Oops.  The attacker would then need
> to succeed in fewer than the maximum allowed number of Oops'es.  Jann's
> currently proposed default of 0x100000 is too high to make a difference
> in that respect, but people may set it differently.

I chose such a high value to increase the likelyhood that this gets
included in the kernel by default. Lower values would mitigate more
attacks, but I'm not sure whether they'd be acceptable for everyone.


> On Wed, Jan 13, 2016 at 10:34:39AM +1100, Daniel Axtens wrote:
> > I'm torn between making the limit configurable and not adding to the
> > massive proliferation of config options.
> 
> What about reusing panic_on_oops for the configurable limit?  The
> currently supported values of 0 and 1 would retain their meaning,
> 2 would panic after 2nd Oops, and so on.
> 
> There's overlap with grsecurity's banning of users on Oops, but I think
> it makes sense to have both the trivial change proposed by Jann (perhaps
> with the reuse of panic_on_oops for configuration) and grsecurity-style
> banning (maybe with a low configurable limit, rather than always on
> first Oops).

One edgecase here is that, afaik, grsecurity-style banning isn't very
effective in combination with the subuid mechanism (implemented in
userland, using the newuidmap setuid helper and /etc/subuid) because
it allows every user to control 2^16 kuids (not just inside namespaces,
but also indirectly in the init namespace).
This probably doesn't affect many people though: Debian and Ubuntu ship
newuidmap in a separate package "uidmap" that isn't installed by
default and is only installed by a few people (0.18% on Debian
according to popcon, those probably need it for unprivileged LXC or
so?). Arch ships with newuidmap installed, but without /etc/subuid.
I don't know what other distros do.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Jann Horn <jann@thejh.net>
To: Solar Designer <solar@openwall.com>
Cc: Daniel Axtens <dja@axtens.net>,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Baoquan He <bhe@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [kernel-hardening] Re: [RFC] kernel/panic: place an upper limit on number of oopses
Date: Wed, 13 Jan 2016 19:08:19 +0100	[thread overview]
Message-ID: <20160113180819.GA22567@pc.thejh.net> (raw)
In-Reply-To: <20160113002043.GA17146@openwall.com>

[-- Attachment #1: Type: text/plain, Size: 2333 bytes --]

On Wed, Jan 13, 2016 at 03:20:43AM +0300, Solar Designer wrote:
> Jann Horn <jann@thejh.net> wrote:
> > To prevent an attacker from turning a mostly harmless oops into an
> > exploitable issue using a refcounter wraparound caused by repeated
> > oopsing, limit the number of oopses.
> 
> This may also reduce the likelihood of successful exploitation of some
> other vulnerabilities involving memory corruption, where an unsuccessful
> attempt may inadvertently trigger an Oops.  The attacker would then need
> to succeed in fewer than the maximum allowed number of Oops'es.  Jann's
> currently proposed default of 0x100000 is too high to make a difference
> in that respect, but people may set it differently.

I chose such a high value to increase the likelyhood that this gets
included in the kernel by default. Lower values would mitigate more
attacks, but I'm not sure whether they'd be acceptable for everyone.


> On Wed, Jan 13, 2016 at 10:34:39AM +1100, Daniel Axtens wrote:
> > I'm torn between making the limit configurable and not adding to the
> > massive proliferation of config options.
> 
> What about reusing panic_on_oops for the configurable limit?  The
> currently supported values of 0 and 1 would retain their meaning,
> 2 would panic after 2nd Oops, and so on.
> 
> There's overlap with grsecurity's banning of users on Oops, but I think
> it makes sense to have both the trivial change proposed by Jann (perhaps
> with the reuse of panic_on_oops for configuration) and grsecurity-style
> banning (maybe with a low configurable limit, rather than always on
> first Oops).

One edgecase here is that, afaik, grsecurity-style banning isn't very
effective in combination with the subuid mechanism (implemented in
userland, using the newuidmap setuid helper and /etc/subuid) because
it allows every user to control 2^16 kuids (not just inside namespaces,
but also indirectly in the init namespace).
This probably doesn't affect many people though: Debian and Ubuntu ship
newuidmap in a separate package "uidmap" that isn't installed by
default and is only installed by a few people (0.18% on Debian
according to popcon, those probably need it for unprivileged LXC or
so?). Arch ships with newuidmap installed, but without /etc/subuid.
I don't know what other distros do.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-01-13 18:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12 19:25 [RFC] kernel/panic: place an upper limit on number of oopses Jann Horn
2016-01-12 19:25 ` [kernel-hardening] " Jann Horn
2016-01-12 23:34 ` Daniel Axtens
2016-01-12 23:34   ` [kernel-hardening] " Daniel Axtens
2016-01-12 23:51   ` Jann Horn
2016-01-12 23:51     ` [kernel-hardening] " Jann Horn
2016-01-13  0:20   ` Solar Designer
2016-01-13  0:20     ` [kernel-hardening] " Solar Designer
2016-01-13  0:33     ` Daniel Axtens
2016-01-13  0:33       ` [kernel-hardening] " Daniel Axtens
2016-01-13 18:08     ` Jann Horn [this message]
2016-01-13 18:08       ` Jann Horn
2016-01-17  3:58       ` Jann Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160113180819.GA22567@pc.thejh.net \
    --to=jann@thejh.net \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=dja@axtens.net \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=solar@openwall.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.