All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Smith <blackzert@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Kees Cook <keescook@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Jan Kara <jack@suse.cz>, Jerome Glisse <jglisse@redhat.com>,
	Hugh Dickins <hughd@google.com>, Helge Deller <deller@gmx.de>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>, Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [RFC PATCH] Randomization of address chosen by mmap.
Date: Fri, 2 Mar 2018 23:30:28 +0300	[thread overview]
Message-ID: <C9D0E3BA-3AB9-4F0E-BDA5-32378E440986@gmail.com> (raw)
In-Reply-To: <20180228183349.GA16336@bombadil.infradead.org>

> On 28 Feb 2018, at 21:33, Matthew Wilcox <willy@infradead.org> wrote:
> 
> On Wed, Feb 28, 2018 at 08:13:00PM +0300, Ilya Smith wrote:
>>> It would be worth spelling out the "not recommended" bit some more
>>> too: this fragments the mmap space, which has some serious issues on
>>> smaller address spaces if you get into a situation where you cannot
>>> allocate a hole large enough between the other allocations.
>>> 
>> 
>> I’m agree, that's the point.
> 
> Would it be worth randomising the address returned just ever so slightly?
> ie instead of allocating exactly the next address, put in a guard hole
> of (configurable, by default maybe) 1-15 pages?  Is that enough extra
> entropy to foil an interesting number of attacks, or do we need the full
> randomise-the-address-space approach in order to be useful?
> 

This is a really good question. Lets think we choose address with random-length 
guard hole. This length is limited by some configuration as you described. For 
instance let it be 1MB. Now according to current implementation, we still may 
fill this gap with small allocations with size less than 1MB. Attacker will 
going to build attack base on this predictable behaviour - he jus need to spray 
with 1 MB chunks (or less, with some expectation). This attack harder but not 
impossible.

Now lets say we will increase this 1MB to 128MB. Attack is the same, successful 
rate less and more regions needed. Now we increase this value to 48 bit entropy 
and will get my patch (in some form ;))

I hope full randomise-the-address-space approach will work for a long time.

Thanks,
Ilya

WARNING: multiple messages have this Message-ID (diff)
From: Ilya Smith <blackzert@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Kees Cook <keescook@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Michal Hocko <mhocko@suse.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Jan Kara <jack@suse.cz>, Jerome Glisse <jglisse@redhat.com>,
	Hugh Dickins <hughd@google.com>, Helge Deller <deller@gmx.de>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>, Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [RFC PATCH] Randomization of address chosen by mmap.
Date: Fri, 2 Mar 2018 23:30:28 +0300	[thread overview]
Message-ID: <C9D0E3BA-3AB9-4F0E-BDA5-32378E440986@gmail.com> (raw)
In-Reply-To: <20180228183349.GA16336@bombadil.infradead.org>

> On 28 Feb 2018, at 21:33, Matthew Wilcox <willy@infradead.org> wrote:
> 
> On Wed, Feb 28, 2018 at 08:13:00PM +0300, Ilya Smith wrote:
>>> It would be worth spelling out the "not recommended" bit some more
>>> too: this fragments the mmap space, which has some serious issues on
>>> smaller address spaces if you get into a situation where you cannot
>>> allocate a hole large enough between the other allocations.
>>> 
>> 
>> I’m agree, that's the point.
> 
> Would it be worth randomising the address returned just ever so slightly?
> ie instead of allocating exactly the next address, put in a guard hole
> of (configurable, by default maybe) 1-15 pages?  Is that enough extra
> entropy to foil an interesting number of attacks, or do we need the full
> randomise-the-address-space approach in order to be useful?
> 

This is a really good question. Lets think we choose address with random-length 
guard hole. This length is limited by some configuration as you described. For 
instance let it be 1MB. Now according to current implementation, we still may 
fill this gap with small allocations with size less than 1MB. Attacker will 
going to build attack base on this predictable behaviour - he jus need to spray 
with 1 MB chunks (or less, with some expectation). This attack harder but not 
impossible.

Now lets say we will increase this 1MB to 128MB. Attack is the same, successful 
rate less and more regions needed. Now we increase this value to 48 bit entropy 
and will get my patch (in some form ;))

I hope full randomise-the-address-space approach will work for a long time.

Thanks,
Ilya

--
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>

  parent reply	other threads:[~2018-03-02 20:30 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 13:13 [RFC PATCH] Randomization of address chosen by mmap Ilya Smith
2018-02-27 13:13 ` Ilya Smith
2018-02-27 20:52 ` Kees Cook
2018-02-27 20:52   ` Kees Cook
2018-02-27 21:31   ` lazytyped
2018-02-27 21:31     ` lazytyped
2018-02-28 17:13   ` Ilya Smith
2018-02-28 17:13     ` Ilya Smith
2018-02-28 18:33     ` Matthew Wilcox
2018-02-28 18:33       ` Matthew Wilcox
2018-02-28 21:02       ` Daniel Micay
2018-02-28 21:02         ` Daniel Micay
2018-03-03 13:58         ` Ilya Smith
2018-03-03 13:58           ` Ilya Smith
2018-03-03 21:00           ` Daniel Micay
2018-03-03 21:00             ` Daniel Micay
2018-03-04  3:47             ` Matthew Wilcox
2018-03-04  3:47               ` Matthew Wilcox
2018-03-04 20:56               ` Matthew Wilcox
2018-03-04 20:56                 ` Matthew Wilcox
2018-03-05 13:09                 ` Ilya Smith
2018-03-05 13:09                   ` Ilya Smith
2018-03-05 14:23                   ` Daniel Micay
2018-03-05 14:23                     ` Daniel Micay
2018-03-05 16:05                     ` Ilya Smith
2018-03-05 16:05                       ` Ilya Smith
2018-03-05 16:23                   ` Matthew Wilcox
2018-03-05 16:23                     ` Matthew Wilcox
2018-03-05 19:27                     ` Ilya Smith
2018-03-05 19:27                       ` Ilya Smith
2018-03-05 19:47                       ` Matthew Wilcox
2018-03-05 19:47                         ` Matthew Wilcox
2018-03-05 20:20                         ` Ilya Smith
2018-03-05 20:20                           ` Ilya Smith
2018-03-02 20:30       ` Ilya Smith [this message]
2018-03-02 20:30         ` Ilya Smith
2018-03-02 20:48         ` Matthew Wilcox
2018-03-02 20:48           ` Matthew Wilcox
2018-03-03 15:13           ` Ilya Smith
2018-03-03 15:13             ` Ilya Smith
2018-02-28 19:54     ` Kees Cook
2018-02-28 19:54       ` Kees Cook
2018-03-01 13:52       ` Ilya Smith
2018-03-01 13:52         ` Ilya Smith
2018-03-02  7:17 ` 097eb0af45: kernel_BUG_at_mm/hugetlb.c kernel test robot
2018-03-02  7:17   ` kernel test robot
2018-03-02  7:17   ` kernel test robot

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=C9D0E3BA-3AB9-4F0E-BDA5-32378E440986@gmail.com \
    --to=blackzert@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=deller@gmx.de \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=jglisse@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=oleg@redhat.com \
    --cc=willy@infradead.org \
    /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.