From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: [PATCH v4 05/12] elf: Allow arch to tweak initial mmap prot flags Date: Tue, 14 Jan 2020 16:38:59 +0000 Message-ID: <20200114163859.GI30444@arrakis.emea.arm.com> References: <20191211154206.46260-1-broonie@kernel.org> <20191211154206.46260-6-broonie@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20191211154206.46260-6-broonie@kernel.org> Sender: linux-kernel-owner@vger.kernel.org To: Mark Brown Cc: Will Deacon , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , Kristina =?utf-8?Q?Mart=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.orgli List-Id: linux-arch.vger.kernel.org On Wed, Dec 11, 2019 at 03:41:59PM +0000, Mark Brown wrote: > From: Dave Martin > > An arch may want to tweak the mmap prot flags for an > ELFexecutable's initial mappings. For example, arm64 is going to > need to add PROT_BTI for executable pages in an ELF process whose > executable is marked as using Branch Target Identification (an > ARMv8.5-A control flow integrity feature). > > So that this can be done in a generic way, add a hook > arch_elf_adjust_prot() to modify the prot flags as desired: arches > can select CONFIG_HAVE_ELF_PROT and implement their own backend > where necessary. > > By default, leave the prot flags unchanged. > > Signed-off-by: Dave Martin > Reviewed-by: Kees Cook > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.110.172]:54578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726195AbgANQjF (ORCPT ); Tue, 14 Jan 2020 11:39:05 -0500 Date: Tue, 14 Jan 2020 16:38:59 +0000 From: Catalin Marinas Subject: Re: [PATCH v4 05/12] elf: Allow arch to tweak initial mmap prot flags Message-ID: <20200114163859.GI30444@arrakis.emea.arm.com> References: <20191211154206.46260-1-broonie@kernel.org> <20191211154206.46260-6-broonie@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191211154206.46260-6-broonie@kernel.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Mark Brown Cc: Will Deacon , Paul Elliott , Peter Zijlstra , Yu-cheng Yu , Amit Kachhap , Vincenzo Frascino , Marc Zyngier , Eugene Syromiatnikov , Szabolcs Nagy , "H.J. Lu" , Andrew Jones , Kees Cook , Arnd Bergmann , Jann Horn , Richard Henderson , Kristina =?utf-8?Q?Mart=C5=A1enko?= , Thomas Gleixner , Florian Weimer , Sudakshina Das , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Dave Martin Message-ID: <20200114163859.MrlLfZy6Huhzgkv8O2Ip04RKOBj22ZrhWDR90SJ4wTo@z> On Wed, Dec 11, 2019 at 03:41:59PM +0000, Mark Brown wrote: > From: Dave Martin > > An arch may want to tweak the mmap prot flags for an > ELFexecutable's initial mappings. For example, arm64 is going to > need to add PROT_BTI for executable pages in an ELF process whose > executable is marked as using Branch Target Identification (an > ARMv8.5-A control flow integrity feature). > > So that this can be done in a generic way, add a hook > arch_elf_adjust_prot() to modify the prot flags as desired: arches > can select CONFIG_HAVE_ELF_PROT and implement their own backend > where necessary. > > By default, leave the prot flags unchanged. > > Signed-off-by: Dave Martin > Reviewed-by: Kees Cook > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas