From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Subject: Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE Date: Fri, 23 Jun 2017 17:01:42 +1000 Message-ID: <87podvp4q1.fsf@concordia.ellerman.id.au> References: <1498154792-49952-1-git-send-email-keescook@chromium.org> <1498154792-49952-4-git-send-email-keescook@chromium.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from ozlabs.org ([103.22.144.67]:36559 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754467AbdFWHBp (ORCPT ); Fri, 23 Jun 2017 03:01:45 -0400 In-Reply-To: <1498154792-49952-4-git-send-email-keescook@chromium.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andrew Morton Cc: Kees Cook , Russell King , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , James Hogan , Pratyush Anand , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com Kees Cook writes: > Now that explicitly executed loaders are loaded in the mmap region, > position PIE binaries lower in the address space to avoid possible > collisions with mmap or stack regions. For 64-bit, align to 4GB to > allow runtimes to use the entire 32-bit address space for 32-bit > pointers. The change log and subject are a bit out of whack with the actual patch because previously we used 512MB. How about? powerpc: Move ELF_ET_DYN_BASE to 4GB / 4MB Now that explicitly executed loaders are loaded in the mmap region, we have more freedom to decide where we position PIE binaries in the address space to avoid possible collisions with mmap or stack regions. For 64-bit, align to 4GB to allow runtimes to use the entire 32-bit address space for 32-bit pointers. On 32-bit use 4MB. Is there any particular reasoning behind the 4MB value on 32-bit? I gave this a quick spin and it booted OK on all my test boxes, which covers 64-bit/32-bit kernel and userspace. So seems to work! Acked-by: Michael Ellerman cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org ([103.22.144.67]:36559 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754467AbdFWHBp (ORCPT ); Fri, 23 Jun 2017 03:01:45 -0400 From: Michael Ellerman Subject: Re: [PATCH 3/4] powerpc: Reduce ELF_ET_DYN_BASE In-Reply-To: <1498154792-49952-4-git-send-email-keescook@chromium.org> References: <1498154792-49952-1-git-send-email-keescook@chromium.org> <1498154792-49952-4-git-send-email-keescook@chromium.org> Date: Fri, 23 Jun 2017 17:01:42 +1000 Message-ID: <87podvp4q1.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-arch-owner@vger.kernel.org List-ID: To: Kees Cook , Andrew Morton Cc: Russell King , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , James Hogan , Pratyush Anand , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com Message-ID: <20170623070142.1kCZwvvXX6OnJS8021t0yiX42bfQxURGNdJYRXZstlc@z> Kees Cook writes: > Now that explicitly executed loaders are loaded in the mmap region, > position PIE binaries lower in the address space to avoid possible > collisions with mmap or stack regions. For 64-bit, align to 4GB to > allow runtimes to use the entire 32-bit address space for 32-bit > pointers. The change log and subject are a bit out of whack with the actual patch because previously we used 512MB. How about? powerpc: Move ELF_ET_DYN_BASE to 4GB / 4MB Now that explicitly executed loaders are loaded in the mmap region, we have more freedom to decide where we position PIE binaries in the address space to avoid possible collisions with mmap or stack regions. For 64-bit, align to 4GB to allow runtimes to use the entire 32-bit address space for 32-bit pointers. On 32-bit use 4MB. Is there any particular reasoning behind the 4MB value on 32-bit? I gave this a quick spin and it booted OK on all my test boxes, which covers 64-bit/32-bit kernel and userspace. So seems to work! Acked-by: Michael Ellerman cheers