All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Popov <alex.popov@linux.com>
To: Christopher Lameter <cl@linux.com>, Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Andy Lutomirski <luto@kernel.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Tejun Heo <tj@kernel.org>, Daniel Mack <daniel@zonque.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Helge Deller <deller@gmx.de>, Rik van Riel <riel@redhat.com>,
	Linux-MM <linux-mm@kvack.org>, Tycho Andersen <tycho@docker.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	alex.popov@linux.com
Subject: Re: [v3] mm: Add SLUB free list pointer obfuscation
Date: Fri, 28 Jul 2017 01:48:56 +0300	[thread overview]
Message-ID: <515333f5-1815-8591-503e-c0cf6941670e@linux.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707261154140.9167@nuc-kabylake>

Hello Christopher and Kees,

On 26.07.2017 19:55, Christopher Lameter wrote:
> On Wed, 26 Jul 2017, Kees Cook wrote:
> 
>>>> What happens if, instead of BUG_ON, we do:
>>>>
>>>> if (unlikely(WARN_RATELIMIT(object == fp, "double-free detected"))
>>>>         return;
>>>
>>> This may work for the free fastpath but the set_freepointer function is
>>> use in multiple other locations. Maybe just add this to the fastpath
>>> instead of to this fucnction?
>>
>> Do you mean do_slab_free()?
> 
> Yes inserting these lines into do_slab_free() would simple ignore the
> double free operation in the fast path and that would be safe.

I don't really like ignoring double-free. I think, that:
  - it will hide dangerous bugs in the kernel,
  - it can make some kernel exploits more stable.
I would rather add BUG_ON to set_freepointer() behind SLAB_FREELIST_HARDENED. Is
it fine?

At the same time avoiding the consequences of some double-free errors is better
than not doing that. It may be considered as kernel "self-healing", I don't
know. I can prepare a second patch for do_slab_free(), as you described. Would
you like it?

Best regards,
Alexander

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Popov <alex.popov@linux.com>
To: Christopher Lameter <cl@linux.com>, Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Andy Lutomirski <luto@kernel.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Tejun Heo <tj@kernel.org>, Daniel Mack <daniel@zonque.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Helge Deller <deller@gmx.de>, Rik van Riel <riel@redhat.com>,
	Linux-MM <linux-mm@kvack.org>, Tycho Andersen <tycho@docker.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	alex.popov@linux.com
Subject: Re: [v3] mm: Add SLUB free list pointer obfuscation
Date: Fri, 28 Jul 2017 01:48:56 +0300	[thread overview]
Message-ID: <515333f5-1815-8591-503e-c0cf6941670e@linux.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707261154140.9167@nuc-kabylake>

Hello Christopher and Kees,

On 26.07.2017 19:55, Christopher Lameter wrote:
> On Wed, 26 Jul 2017, Kees Cook wrote:
> 
>>>> What happens if, instead of BUG_ON, we do:
>>>>
>>>> if (unlikely(WARN_RATELIMIT(object == fp, "double-free detected"))
>>>>         return;
>>>
>>> This may work for the free fastpath but the set_freepointer function is
>>> use in multiple other locations. Maybe just add this to the fastpath
>>> instead of to this fucnction?
>>
>> Do you mean do_slab_free()?
> 
> Yes inserting these lines into do_slab_free() would simple ignore the
> double free operation in the fast path and that would be safe.

I don't really like ignoring double-free. I think, that:
  - it will hide dangerous bugs in the kernel,
  - it can make some kernel exploits more stable.
I would rather add BUG_ON to set_freepointer() behind SLAB_FREELIST_HARDENED. Is
it fine?

At the same time avoiding the consequences of some double-free errors is better
than not doing that. It may be considered as kernel "self-healing", I don't
know. I can prepare a second patch for do_slab_free(), as you described. Would
you like it?

Best regards,
Alexander

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Popov <alex.popov@linux.com>
To: Christopher Lameter <cl@linux.com>, Kees Cook <keescook@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Andy Lutomirski <luto@kernel.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Tejun Heo <tj@kernel.org>, Daniel Mack <daniel@zonque.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Helge Deller <deller@gmx.de>, Rik van Riel <riel@redhat.com>,
	Linux-MM <linux-mm@kvack.org>, Tycho Andersen <tycho@docker.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	alex.popov@linux.com
Subject: [kernel-hardening] Re: [v3] mm: Add SLUB free list pointer obfuscation
Date: Fri, 28 Jul 2017 01:48:56 +0300	[thread overview]
Message-ID: <515333f5-1815-8591-503e-c0cf6941670e@linux.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707261154140.9167@nuc-kabylake>

Hello Christopher and Kees,

On 26.07.2017 19:55, Christopher Lameter wrote:
> On Wed, 26 Jul 2017, Kees Cook wrote:
> 
>>>> What happens if, instead of BUG_ON, we do:
>>>>
>>>> if (unlikely(WARN_RATELIMIT(object == fp, "double-free detected"))
>>>>         return;
>>>
>>> This may work for the free fastpath but the set_freepointer function is
>>> use in multiple other locations. Maybe just add this to the fastpath
>>> instead of to this fucnction?
>>
>> Do you mean do_slab_free()?
> 
> Yes inserting these lines into do_slab_free() would simple ignore the
> double free operation in the fast path and that would be safe.

I don't really like ignoring double-free. I think, that:
  - it will hide dangerous bugs in the kernel,
  - it can make some kernel exploits more stable.
I would rather add BUG_ON to set_freepointer() behind SLAB_FREELIST_HARDENED. Is
it fine?

At the same time avoiding the consequences of some double-free errors is better
than not doing that. It may be considered as kernel "self-healing", I don't
know. I can prepare a second patch for do_slab_free(), as you described. Would
you like it?

Best regards,
Alexander

  parent reply	other threads:[~2017-07-27 22:49 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  0:27 [PATCH v3] mm: Add SLUB free list pointer obfuscation Kees Cook
2017-07-06  0:27 ` [kernel-hardening] " Kees Cook
2017-07-06  0:27 ` Kees Cook
2017-07-06 13:43 ` Christoph Lameter
2017-07-06 13:43   ` [kernel-hardening] " Christoph Lameter
2017-07-06 13:43   ` Christoph Lameter
2017-07-06 15:48   ` Kees Cook
2017-07-06 15:48     ` [kernel-hardening] " Kees Cook
2017-07-06 15:48     ` Kees Cook
2017-07-06 15:55     ` Christoph Lameter
2017-07-06 15:55       ` [kernel-hardening] " Christoph Lameter
2017-07-06 15:55       ` Christoph Lameter
2017-07-06 16:16       ` [kernel-hardening] " Daniel Micay
2017-07-06 16:16         ` Daniel Micay
2017-07-06 16:16         ` Daniel Micay
2017-07-06 17:53       ` Rik van Riel
2017-07-06 17:53         ` [kernel-hardening] " Rik van Riel
2017-07-06 17:53         ` Rik van Riel
2017-07-06 18:50         ` Kees Cook
2017-07-06 18:50           ` [kernel-hardening] " Kees Cook
2017-07-06 18:50           ` Kees Cook
2017-07-07 13:50           ` Christoph Lameter
2017-07-07 13:50             ` [kernel-hardening] " Christoph Lameter
2017-07-07 13:50             ` Christoph Lameter
2017-07-07 16:51             ` Kees Cook
2017-07-07 16:51               ` [kernel-hardening] " Kees Cook
2017-07-07 16:51               ` Kees Cook
2017-07-07 17:06               ` Christoph Lameter
2017-07-07 17:06                 ` [kernel-hardening] " Christoph Lameter
2017-07-07 17:06                 ` Christoph Lameter
2017-07-07 18:43                 ` Kees Cook
2017-07-07 18:43                   ` [kernel-hardening] " Kees Cook
2017-07-07 18:43                   ` Kees Cook
2017-07-24 21:17 ` [v3] " Alexander Popov
2017-07-24 21:17   ` [kernel-hardening] " Alexander Popov
2017-07-24 21:17   ` Alexander Popov
2017-07-25  9:42   ` Alexander Popov
2017-07-25  9:42     ` [kernel-hardening] " Alexander Popov
2017-07-25  9:42     ` Alexander Popov
2017-07-26  0:21   ` Kees Cook
2017-07-26  0:21     ` [kernel-hardening] " Kees Cook
2017-07-26  0:21     ` Kees Cook
2017-07-26 14:08     ` Christopher Lameter
2017-07-26 14:08       ` [kernel-hardening] " Christopher Lameter
2017-07-26 14:08       ` Christopher Lameter
2017-07-26 16:20       ` Kees Cook
2017-07-26 16:20         ` [kernel-hardening] " Kees Cook
2017-07-26 16:20         ` Kees Cook
2017-07-26 16:55         ` Christopher Lameter
2017-07-26 16:55           ` [kernel-hardening] " Christopher Lameter
2017-07-26 16:55           ` Christopher Lameter
2017-07-26 17:13           ` Kees Cook
2017-07-26 17:13             ` [kernel-hardening] " Kees Cook
2017-07-26 17:13             ` Kees Cook
2017-07-27 15:15             ` Christopher Lameter
2017-07-27 15:15               ` [kernel-hardening] " Christopher Lameter
2017-07-27 15:15               ` Christopher Lameter
2017-07-27 22:48           ` Alexander Popov [this message]
2017-07-27 22:48             ` [kernel-hardening] " Alexander Popov
2017-07-27 22:48             ` Alexander Popov
2017-07-27 23:53             ` Christopher Lameter
2017-07-27 23:53               ` [kernel-hardening] " Christopher Lameter
2017-07-27 23:53               ` Christopher Lameter
2017-07-31 20:17               ` Alexander Popov
2017-07-31 20:17                 ` [kernel-hardening] " Alexander Popov
2017-07-31 20:17                 ` Alexander Popov

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=515333f5-1815-8591-503e-c0cf6941670e@linux.com \
    --to=alex.popov@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=cl@linux.com \
    --cc=daniel@zonque.org \
    --cc=deller@gmx.de \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=josh@joshtriplett.org \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=penberg@kernel.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tj@kernel.org \
    --cc=tycho@docker.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.