Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752668AbdFUSYg (ORCPT ); Wed, 21 Jun 2017 14:24:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44982 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdFUSYf (ORCPT ); Wed, 21 Jun 2017 14:24:35 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5FC187486C Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=riel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5FC187486C Message-ID: <1498069466.13083.20.camel@redhat.com> Subject: Re: [PATCH v2] binfmt_elf: Use ELF_ET_DYN_BASE only for PIE From: Rik van Riel To: Kees Cook , Andrew Morton Cc: Daniel Micay , Qualys Security Advisory , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Alexander Viro , Dmitry Safonov , Andy Lutomirski , Grzegorz Andrejczuk , Masahiro Yamada , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-hardening@lists.openwall.com Date: Wed, 21 Jun 2017 14:24:26 -0400 In-Reply-To: <20170621173201.GA114489@beast> References: <20170621173201.GA114489@beast> Organization: Red Hat, Inc Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 21 Jun 2017 18:24:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 936 Lines: 25 On Wed, 2017-06-21 at 10:32 -0700, Kees Cook wrote: > To allow for a lower ELF_ET_DYN_BASE, loaders (ET_DYN without INTERP) > are loaded into the mmap region, leaving space available for either > an > ET_EXEC binary with a fixed location or PIE being loaded into mmap by > the > loader. Only PIE programs are loaded offset from ELF_ET_DYN_BASE, > which > means architectures can now safely lower their values without risk of > loaders colliding with their subsequently loaded programs. > > For 64-bit, ELF_ET_DYN_BASE is best set to 4GB to allow runtimes to > use > the entire 32-bit address space for 32-bit pointers. > > Thanks to PaX Team, Daniel Micay, and Rik van Riel for inspiration > and > suggestions on how to implement this solution. > > Fixes: d1fd836dcf00 ("mm: split ET_DYN ASLR from mmap ASLR") > Cc: stable@vger.kernel.org > Signed-off-by: Kees Cook Acked-by: Rik van Riel