linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will.deacon@arm.com>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	linux390@de.ibm.com, "x86@kernel.org" <x86@kernel.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"David A. Long" <dave.long@linaro.org>,
	"Andrey Ryabinin" <a.ryabinin@samsung.com>,
	"Arun Chandran" <achandran@mvista.com>,
	"Yann Droneaud" <ydroneaud@opteya.com>,
	"Min-Hua Chen" <orca.chen@gmail.com>,
	"Paul Burton" <paul.burton@imgtec.com>,
	"Alex Smith" <alex@alex-smith.me.uk>,
	"Markos Chandras" <markos.chandras@imgtec.com>,
	"Jeff Bailey" <jeffbailey@google.com>,
	"Vineeth Vijayan" <vvijayan@mvista.com>,
	"Michael Holzheu" <holzheu@linux.vnet.ibm.com>,
	"Ben Hutchings" <ben@decadent.org.uk>,
	"Hector Marco-Gisbert" <hecmargi@upv.es>,
	"Borislav Petkov" <bp@suse.de>, "Jan-Simon Möller" <dl9pf@gmx.de>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Linux MIPS Mailing List" <linux-mips@linux-mips.org>,
	linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 4/5] mm: split ET_DYN ASLR from mmap ASLR
Date: Wed, 4 Mar 2015 13:13:15 -0800	[thread overview]
Message-ID: <CAGXu5j+Pu-xeCBcMZZqTgLfKss7Er0pfCxp04a4eWDWhuDryTQ@mail.gmail.com> (raw)
In-Reply-To: <1425442601.9084.9.camel@ellerman.id.au>

On Tue, Mar 3, 2015 at 8:16 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> On Mon, 2015-03-02 at 16:19 -0800, Kees Cook wrote:
>> This fixes the "offset2lib" weakness in ASLR for arm, arm64, mips,
>> powerpc, and x86. The problem is that if there is a leak of ASLR from
>> the executable (ET_DYN), it means a leak of shared library offset as
>> well (mmap), and vice versa. Further details and a PoC of this attack
>> are available here:
>> http://cybersecurity.upv.es/attacks/offset2lib/offset2lib.html
>>
>> With this patch, a PIE linked executable (ET_DYN) has its own ASLR region:
>>
>> $ ./show_mmaps_pie
>> 54859ccd6000-54859ccd7000 r-xp  ...  /tmp/show_mmaps_pie
>> 54859ced6000-54859ced7000 r--p  ...  /tmp/show_mmaps_pie
>> 54859ced7000-54859ced8000 rw-p  ...  /tmp/show_mmaps_pie
>
> Just to be clear, it's the fact that the above vmas are in a different
> address range to those below that shows the patch is working, right?

That's correct, yes. I've called this out explicitly now in the 9/10
patch in v4.

>
>> 7f75be764000-7f75be91f000 r-xp  ...  /lib/x86_64-linux-gnu/libc.so.6
>> 7f75be91f000-7f75beb1f000 ---p  ...  /lib/x86_64-linux-gnu/libc.so.6
>
>
> On powerpc I'm seeing:
>
> # /bin/dash
> # cat /proc/$$/maps
> 524e0000-52510000 r-xp 00000000 08:03 129814                             /bin/dash
> 52510000-52520000 rw-p 00020000 08:03 129814                             /bin/dash
> 10034f20000-10034f50000 rw-p 00000000 00:00 0                            [heap]
> 3fffaeaf0000-3fffaeca0000 r-xp 00000000 08:03 13529                      /lib/powerpc64le-linux-gnu/libc-2.19.so
> 3fffaeca0000-3fffaecb0000 rw-p 001a0000 08:03 13529                      /lib/powerpc64le-linux-gnu/libc-2.19.so
> 3fffaecc0000-3fffaecd0000 rw-p 00000000 00:00 0
> 3fffaecd0000-3fffaecf0000 r-xp 00000000 00:00 0                          [vdso]
> 3fffaecf0000-3fffaed20000 r-xp 00000000 08:03 13539                      /lib/powerpc64le-linux-gnu/ld-2.19.so
> 3fffaed20000-3fffaed30000 rw-p 00020000 08:03 13539                      /lib/powerpc64le-linux-gnu/ld-2.19.so
> 3fffc7070000-3fffc70a0000 rw-p 00000000 00:00 0                          [stack]
>
>
> Whereas previously the /bin/dash vmas were up at 3fff..

Fantastic! Thanks very much for testing!

>
> So looks good to me for powerpc.
>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>

I had a question in the powerpc-specific change that may have gone unnoticed:

Can mmap ASLR be safely enabled in the legacy mmap case here? Other archs
use "mm->mmap_base = TASK_UNMAPPED_BASE + random_factor".

Separate from this series, do you happen to know if this improvement
can be made, or if the legacy mmap on powerpc can't handle this?

Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

  reply	other threads:[~2015-03-04 21:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  0:19 [PATCH v2 0/5] split ET_DYN ASLR from mmap ASLR Kees Cook
2015-03-03  0:19 ` [PATCH 1/5] arm: factor out mmap ASLR into mmap_rnd Kees Cook
2015-03-09 14:48   ` Russell King - ARM Linux
2015-03-03  0:19 ` [PATCH 2/5] mm: expose arch_mmap_rnd when available Kees Cook
2015-03-09 14:49   ` Russell King - ARM Linux
2015-03-03  0:19 ` [PATCH 3/5] mm: move randomize_et_dyn into ELF_ET_DYN_BASE Kees Cook
2015-03-03  0:19 ` [PATCH 4/5] mm: split ET_DYN ASLR from mmap ASLR Kees Cook
2015-03-04  4:16   ` Michael Ellerman
2015-03-04 21:13     ` Kees Cook [this message]
2015-03-04 23:56       ` Michael Ellerman
2015-03-09 15:13   ` Russell King - ARM Linux
2015-03-03  0:19 ` [PATCH 5/5] mm: fold arch_randomize_brk into ARCH_HAS_ELF_RANDOMIZE Kees Cook
2015-03-09 14:51   ` Russell King - ARM Linux
2015-03-03  7:31 ` [PATCH v2 0/5] split ET_DYN ASLR from mmap ASLR Ingo Molnar
2015-03-03 18:03   ` Kees Cook
2015-03-04  4:20     ` Ingo Molnar
2015-03-09 15:15 ` Russell King - ARM Linux
  -- strict thread matches above, loose matches on Subject: below --
2015-02-27  3:07 [PATCH " Kees Cook
2015-02-27  3:07 ` [PATCH 4/5] mm: " Kees Cook

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=CAGXu5j+Pu-xeCBcMZZqTgLfKss7Er0pfCxp04a4eWDWhuDryTQ@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=a.ryabinin@samsung.com \
    --cc=achandran@mvista.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@alex-smith.me.uk \
    --cc=ben@decadent.org.uk \
    --cc=benh@kernel.crashing.org \
    --cc=bp@suse.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.long@linaro.org \
    --cc=dl9pf@gmx.de \
    --cc=hecmargi@upv.es \
    --cc=heiko.carstens@de.ibm.com \
    --cc=holzheu@linux.vnet.ibm.com \
    --cc=jeffbailey@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@amacapital.net \
    --cc=markos.chandras@imgtec.com \
    --cc=mpe@ellerman.id.au \
    --cc=oleg@redhat.com \
    --cc=orca.chen@gmail.com \
    --cc=paul.burton@imgtec.com \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vvijayan@mvista.com \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    --cc=ydroneaud@opteya.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).