All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Bhupesh Sharma <bhsharma@redhat.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	Daniel Cashman <dcashman@google.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Bhupesh SHARMA <bhupesh.linux@gmail.com>,
	Alexander Graf <agraf@suse.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Anatolij Gustschin <agust@denx.de>,
	Alistair Popple <alistair@popple.id.au>,
	Matt Porter <mporter@kernel.crashing.org>,
	Vitaly Bordug <vitb@kernel.crashing.org>,
	Scott Wood <oss@buserror.net>,
	Kumar Gala <galak@kernel.crashing.org>,
	Daniel Cashman <dcashman@android.com>
Subject: Re: [PATCH 0/2] RFC: Adjust powerpc ASLR elf randomness
Date: Thu, 2 Feb 2017 11:19:28 -0800	[thread overview]
Message-ID: <CAGXu5j+FVDAHx9WvUm1uM9OHQLD4FEeToVfB91hJcPBi3udiNw@mail.gmail.com> (raw)
In-Reply-To: <CACi5LpNrd+fqOCiA3HnJ6brTCW+v0c1tVPcfFS7Ms0tE0LXmQg@mail.gmail.com>

On Thu, Feb 2, 2017 at 10:08 AM, Bhupesh Sharma <bhsharma@redhat.com> wrote:
> On Thu, Feb 2, 2017 at 7:51 PM, Kees Cook <keescook@chromium.org> wrote:
>> On Wed, Feb 1, 2017 at 9:42 PM, Bhupesh Sharma <bhsharma@redhat.com> wrote:
>>> The 2nd patch increases the ELF_ET_DYN_BASE value from the current
>>> hardcoded value of 0x2000_0000 to something more practical,
>>> i.e. TASK_SIZE - PAGE_SHIFT (which makes sense especially for
>>> 64-bit platforms which would like to utilize more randomization
>>> in the load address of a PIE elf).
>>
>> I don't think you want this second patch. Moving ELF_ET_DYN_BASE to
>> the top of TASK_SIZE means you'll be constantly colliding with stack
>> and mmap randomization. 0x20000000 is way better since it randomizes
>> up from there towards the mmap area.
>>
>> Is there a reason to avoid the 32-bit memory range for the ELF addresses?
>
> I think you are right. Hmm, I think I was going by my particular use
> case which might not be required for generic PPC platforms.
>
> I have one doubt though - I have primarily worked on arm64 and x86
> architectures and there I see there 64-bit user space applications
> using the 64-bit load addresses/ranges. I am not sure why PPC64 is
> different historically.

x86's ELF_ET_DYN_BASE is (TASK_SIZE / 3 * 2), so it puts it ET_DYN
base at the top third of the address space. (In theory, this is to
avoid interpreter collisions, but I'm working on removing that
restriction, as it seems pointless.)

Other architectures have small ELF_ET_DYN_BASEs, which is good: it
allows them to have larger entropy for ET_DYN.

-Kees

-- 
Kees Cook
Pixel Security

WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org>
To: Bhupesh Sharma <bhsharma@redhat.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>,
	Daniel Cashman <dcashman@google.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Bhupesh SHARMA <bhupesh.linux@gmail.com>,
	Alexander Graf <agraf@suse.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Anatolij Gustschin <agust@denx.de>,
	Alistair Popple <alistair@popple.id.au>,
	Matt Porter <mporter@kernel.crashing.org>,
	Vitaly Bordug <vitb@kernel.crashing.org>,
	Scott Wood <oss@buserror.net>,
	Kumar Gala <galak@kernel.crashing.org>,
	Daniel Cashman <dcashman@android.com>
Subject: [kernel-hardening] Re: [PATCH 0/2] RFC: Adjust powerpc ASLR elf randomness
Date: Thu, 2 Feb 2017 11:19:28 -0800	[thread overview]
Message-ID: <CAGXu5j+FVDAHx9WvUm1uM9OHQLD4FEeToVfB91hJcPBi3udiNw@mail.gmail.com> (raw)
In-Reply-To: <CACi5LpNrd+fqOCiA3HnJ6brTCW+v0c1tVPcfFS7Ms0tE0LXmQg@mail.gmail.com>

On Thu, Feb 2, 2017 at 10:08 AM, Bhupesh Sharma <bhsharma@redhat.com> wrote:
> On Thu, Feb 2, 2017 at 7:51 PM, Kees Cook <keescook@chromium.org> wrote:
>> On Wed, Feb 1, 2017 at 9:42 PM, Bhupesh Sharma <bhsharma@redhat.com> wrote:
>>> The 2nd patch increases the ELF_ET_DYN_BASE value from the current
>>> hardcoded value of 0x2000_0000 to something more practical,
>>> i.e. TASK_SIZE - PAGE_SHIFT (which makes sense especially for
>>> 64-bit platforms which would like to utilize more randomization
>>> in the load address of a PIE elf).
>>
>> I don't think you want this second patch. Moving ELF_ET_DYN_BASE to
>> the top of TASK_SIZE means you'll be constantly colliding with stack
>> and mmap randomization. 0x20000000 is way better since it randomizes
>> up from there towards the mmap area.
>>
>> Is there a reason to avoid the 32-bit memory range for the ELF addresses?
>
> I think you are right. Hmm, I think I was going by my particular use
> case which might not be required for generic PPC platforms.
>
> I have one doubt though - I have primarily worked on arm64 and x86
> architectures and there I see there 64-bit user space applications
> using the 64-bit load addresses/ranges. I am not sure why PPC64 is
> different historically.

x86's ELF_ET_DYN_BASE is (TASK_SIZE / 3 * 2), so it puts it ET_DYN
base at the top third of the address space. (In theory, this is to
avoid interpreter collisions, but I'm working on removing that
restriction, as it seems pointless.)

Other architectures have small ELF_ET_DYN_BASEs, which is good: it
allows them to have larger entropy for ET_DYN.

-Kees

-- 
Kees Cook
Pixel Security

  reply	other threads:[~2017-02-02 19:19 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02  5:42 [PATCH 0/2] RFC: Adjust powerpc ASLR elf randomness Bhupesh Sharma
2017-02-02  5:42 ` [kernel-hardening] " Bhupesh Sharma
2017-02-02  5:42 ` [PATCH 1/2] powerpc: mm: support ARCH_MMAP_RND_BITS Bhupesh Sharma
2017-02-02  5:42   ` [kernel-hardening] " Bhupesh Sharma
2017-02-02  9:11   ` Balbir Singh
2017-02-02  9:11     ` [kernel-hardening] " Balbir Singh
2017-02-02 18:14     ` Bhupesh Sharma
2017-02-02 18:14       ` [kernel-hardening] " Bhupesh Sharma
2017-02-02 10:23   ` Michael Ellerman
2017-02-02 10:23     ` [kernel-hardening] " Michael Ellerman
2017-02-02 12:22     ` Balbir Singh
2017-02-02 12:22       ` [kernel-hardening] " Balbir Singh
2017-02-02 23:59       ` Michael Ellerman
2017-02-08 12:53     ` Bhupesh Sharma
2017-02-08 12:53       ` [kernel-hardening] " Bhupesh Sharma
2017-02-10 11:01       ` Michael Ellerman
2017-02-10 11:11         ` Bhupesh Sharma
2017-02-16  4:49           ` Bhupesh Sharma
2017-02-24  7:32             ` Bhupesh Sharma
2017-02-24  9:53               ` Michael Ellerman
2017-02-24  9:53                 ` Michael Ellerman
2017-02-02 14:25   ` Kees Cook
2017-02-02 14:25     ` [kernel-hardening] " Kees Cook
2017-02-02 18:04     ` Bhupesh Sharma
2017-02-02 18:04       ` [kernel-hardening] " Bhupesh Sharma
2017-02-02  5:42 ` [PATCH 2/2] powerpc: Redefine ELF_ET_DYN_BASE Bhupesh Sharma
2017-02-02  5:42   ` [kernel-hardening] " Bhupesh Sharma
2017-02-02  6:44 ` [PATCH 0/2] RFC: Adjust powerpc ASLR elf randomness Balbir Singh
2017-02-02  6:44   ` [kernel-hardening] " Balbir Singh
2017-02-02 18:21   ` Bhupesh Sharma
2017-02-02 18:21     ` [kernel-hardening] " Bhupesh Sharma
2017-02-02 14:21 ` Kees Cook
2017-02-02 14:21   ` [kernel-hardening] " Kees Cook
2017-02-02 18:08   ` Bhupesh Sharma
2017-02-02 18:08     ` [kernel-hardening] " Bhupesh Sharma
2017-02-02 19:19     ` Kees Cook [this message]
2017-02-02 19:19       ` Kees Cook
2017-02-02 19:43       ` Bhupesh Sharma
2017-02-02 19:43         ` [kernel-hardening] " Bhupesh Sharma

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+FVDAHx9WvUm1uM9OHQLD4FEeToVfB91hJcPBi3udiNw@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=agraf@suse.com \
    --cc=agust@denx.de \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=bhsharma@redhat.com \
    --cc=bhupesh.linux@gmail.com \
    --cc=dcashman@android.com \
    --cc=dcashman@google.com \
    --cc=galak@kernel.crashing.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=mporter@kernel.crashing.org \
    --cc=oss@buserror.net \
    --cc=paulus@samba.org \
    --cc=vitb@kernel.crashing.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.