From patchwork Thu Feb 2 05:42:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 9551511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CBF41604A7 for ; Thu, 2 Feb 2017 09:41:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5AD8200E9 for ; Thu, 2 Feb 2017 09:41:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA0262839C; Thu, 2 Feb 2017 09:41:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id B48EE200E9 for ; Thu, 2 Feb 2017 09:41:14 +0000 (UTC) Received: (qmail 28164 invoked by uid 550); 2 Feb 2017 09:41:13 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 24104 invoked from network); 2 Feb 2017 05:44:16 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Dfc4oIKKU8rCsFCZwopEA1kNEj2v8I5rSGo3qsIt52c=; b=nzBs746IsLl4c07cCGg907NrL8Nq+ODfKx/yEUKNCLUi2xrPghqozKdEzfjdPxFB6H j7zkxH08E/CauCgPrzEgUx157QlwZxwtfpNVBUxKe9BT69JvJ3l6PLB0cBU1Vogaget8 0MPax7NVoA0MXCUKhwwTOL3F4gArbv0TXbbNS65fdmibnzARuC803QFW+J5L9LPUWxOv wpf/THv+6KFeVk1G9FYlZqLp/Dp0lT0qC1z8phFgqYt8FG2Cr/BnNUXmpdZ/USz6tKN/ g4D356oiCIX6x5nwlKsUkS4sHuwzMiyVfMUp6LxlH3/wre6xY2OA6ZjW7FcOo9/wH7tC 5Cpg== X-Gm-Message-State: AIkVDXKUKDLeN4ecIshAR8YX/po/H10ZNA5odZHmkN+fMeUP6o8ZJ+Do+g37a8jhQS1zzRsQ X-Received: by 10.237.58.41 with SMTP id n38mr6564313qte.134.1486014244936; Wed, 01 Feb 2017 21:44:04 -0800 (PST) From: Bhupesh Sharma 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 , Alexander Graf , Benjamin Herrenschmidt , Paul Mackerras , Anatolij Gustschin , Alistair Popple , Matt Porter , Vitaly Bordug , Scott Wood , Kumar Gala , Daniel Cashman Date: Thu, 2 Feb 2017 11:12:48 +0530 Message-Id: <1486014168-1279-3-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486014168-1279-1-git-send-email-bhsharma@redhat.com> References: <1486014168-1279-1-git-send-email-bhsharma@redhat.com> Subject: [kernel-hardening] [PATCH 2/2] powerpc: Redefine ELF_ET_DYN_BASE X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Anatolij Gustschin Cc: Alistair Popple Cc: Matt Porter Cc: Vitaly Bordug Cc: Scott Wood Cc: Kumar Gala Cc: Daniel Cashman Cc: Kees Cook Signed-off-by: Bhupesh Sharma --- 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)