From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [IPv6:2a00:1450:400c:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id CFF8F1A0015 for ; Tue, 3 Mar 2015 18:31:42 +1100 (AEDT) Received: by wghk14 with SMTP id k14so38196949wgh.4 for ; Mon, 02 Mar 2015 23:31:38 -0800 (PST) Sender: Ingo Molnar Date: Tue, 3 Mar 2015 08:31:32 +0100 From: Ingo Molnar To: Kees Cook Subject: Re: [PATCH v2 0/5] split ET_DYN ASLR from mmap ASLR Message-ID: <20150303073132.GA30602@gmail.com> References: <1425341988-1599-1-git-send-email-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1425341988-1599-1-git-send-email-keescook@chromium.org> Cc: linux-mips@linux-mips.org, Arun Chandran , Catalin Marinas , Heiko Carstens , Oleg Nesterov , Min-Hua Chen , Paul Mackerras , "H. Peter Anvin" , Yann Droneaud , linux-s390@vger.kernel.org, Russell King , Andrey Ryabinin , x86@kernel.org, Hector Marco-Gisbert , "David A. Long" , Borislav Petkov , Ben Hutchings , Will Deacon , linux-fsdevel@vger.kernel.org, Borislav Petkov , Alexander Viro , Thomas Gleixner , Michael Holzheu , linux-arm-kernel@lists.infradead.org, Jeff Bailey , Paul Burton , Linus Torvalds , linux-kernel@vger.kernel.org, Ralf Baechle , Andy Lutomirski , Vineeth Vijayan , Markos Chandras , Jan-Simon =?iso-8859-1?Q?M=F6ller?= , Martin Schwidefsky , linux390@de.ibm.com, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, Alex Smith List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , * Kees Cook wrote: > To address the "offset2lib" ASLR weakness[1], this separates ET_DYN > ASLR from mmap ASLR, as already done on s390. The architectures > that are already randomizing mmap (arm, arm64, mips, powerpc, s390, > and x86), have their various forms of arch_mmap_rnd() made available > via the new CONFIG_ARCH_HAS_ELF_RANDOMIZE. For these architectures, > arch_randomize_brk() is collapsed as well. > > This is an alternative to the solutions in: > https://lkml.org/lkml/2015/2/23/442 Looks good so far: Reviewed-by: Ingo Molnar While reviewing this series I also noticed that the following code could be factored out from architecture mmap code as well: - arch_pick_mmap_layout() uses very similar patterns across the platforms, with only few variations. Many architectures use the same duplicated mmap_is_legacy() helper as well. There's usually just trivial differences between mmap_legacy_base() approaches as well. - arch_mmap_rnd(): the PF_RANDOMIZE checks are needlessly exposed to the arch routine - the arch routine should only concentrate on arch details, not generic flags like PF_RANDOMIZE. In theory the mmap layout could be fully parametrized as well: i.e. no callback functions to architectures by default at all: just declarations of bits of randomization desired (or, available address space bits), and perhaps an arch helper to allow 32-bit vs. 64-bit address space distinctions. 'Weird' architectures could provide special routines, but only by overriding the default behavior, which should be generic, safe and robust. Thanks, Ingo