linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Bhupesh Sharma <bhsharma@redhat.com>
To: linuxppc-dev@lists.ozlabs.org, kernel-hardening@lists.openwall.com
Cc: dcashman@google.com, mpe@ellerman.id.au, bhupesh.linux@gmail.com,
	keescook@chromium.org, Bhupesh Sharma <bhsharma@redhat.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: [PATCH 2/2] powerpc: Redefine ELF_ET_DYN_BASE
Date: Thu,  2 Feb 2017 11:12:48 +0530	[thread overview]
Message-ID: <1486014168-1279-3-git-send-email-bhsharma@redhat.com> (raw)
In-Reply-To: <1486014168-1279-1-git-send-email-bhsharma@redhat.com>

Currently the powerpc arch uses a ELF_ET_DYN_BASE value of 0x20000000
which ends up pushing an elf to a load address which is 32-bit.

On 64-bit platforms, this might be too less especially when one is
trying to increase the randomness of the load address of the ASLR elfs
on such platforms.

This patch makes the powerpc platforms mimic the x86 ones, by ensuring
that the ELF_ET_DYN_BASE is calculated on basis of the current task's
TASK_SIZE.

Cc: Alexander Graf <agraf@suse.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Alistair Popple <alistair@popple.id.au>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Vitaly Bordug <vitb@kernel.crashing.org>
Cc: Scott Wood <oss@buserror.net>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Daniel Cashman <dcashman@android.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
---
 arch/powerpc/include/asm/elf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index ee46ffef608e..dd035f6dd782 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -28,7 +28,7 @@
    the loader.  We need to make sure that it is out of the way of the program
    that it will "exec", and that there is sufficient room for the brk.  */
 
-#define ELF_ET_DYN_BASE	0x20000000
+#define ELF_ET_DYN_BASE	(TASK_SIZE - PAGE_SIZE)
 
 #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)
 
-- 
2.7.4

  parent reply	other threads:[~2017-02-02  5:44 UTC|newest]

Thread overview: 22+ 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 ` [PATCH 1/2] powerpc: mm: support ARCH_MMAP_RND_BITS Bhupesh Sharma
2017-02-02  9:11   ` Balbir Singh
2017-02-02 18:14     ` Bhupesh Sharma
2017-02-02 10:23   ` Michael Ellerman
2017-02-02 12:22     ` Balbir Singh
2017-02-02 23:59       ` [kernel-hardening] " Michael Ellerman
2017-02-08 12:53     ` Bhupesh Sharma
2017-02-10 11:01       ` [kernel-hardening] " 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-02 14:25   ` Kees Cook
2017-02-02 18:04     ` Bhupesh Sharma
2017-02-02  5:42 ` Bhupesh Sharma [this message]
2017-02-02  6:44 ` [PATCH 0/2] RFC: Adjust powerpc ASLR elf randomness Balbir Singh
2017-02-02 18:21   ` Bhupesh Sharma
2017-02-02 14:21 ` Kees Cook
2017-02-02 18:08   ` Bhupesh Sharma
2017-02-02 19:19     ` Kees Cook
2017-02-02 19:43       ` 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=1486014168-1279-3-git-send-email-bhsharma@redhat.com \
    --to=bhsharma@redhat.com \
    --cc=agraf@suse.com \
    --cc=agust@denx.de \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=bhupesh.linux@gmail.com \
    --cc=dcashman@android.com \
    --cc=dcashman@google.com \
    --cc=galak@kernel.crashing.org \
    --cc=keescook@chromium.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 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).