From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Weimer Subject: Re: [PATCH v7 22/27] binfmt_elf: Extract .note.gnu.property from an ELF file Date: Mon, 17 Jun 2019 13:08:14 +0200 Message-ID: <87imt4jwpt.fsf@oldenburg2.str.redhat.com> References: <20190606200646.3951-1-yu-cheng.yu@intel.com> <20190606200646.3951-23-yu-cheng.yu@intel.com> <20190607180115.GJ28398@e103592.cambridge.arm.com> <94b9c55b3b874825fda485af40ab2a6bc3dad171.camel@intel.com> <87lfy9cq04.fsf@oldenburg2.str.redhat.com> <20190611114109.GN28398@e103592.cambridge.arm.com> <031bc55d8dcdcf4f031e6ff27c33fd52c61d33a5.camel@intel.com> <20190612093238.GQ28398@e103592.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <20190612093238.GQ28398@e103592.cambridge.arm.com> (Dave Martin's message of "Wed, 12 Jun 2019 10:32:38 +0100") Sender: linux-kernel-owner@vger.kernel.org To: Dave Martin Cc: Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit List-Id: linux-arch.vger.kernel.org * Dave Martin: > On Tue, Jun 11, 2019 at 12:31:34PM -0700, Yu-cheng Yu wrote: >> On Tue, 2019-06-11 at 12:41 +0100, Dave Martin wrote: >> > On Mon, Jun 10, 2019 at 07:24:43PM +0200, Florian Weimer wrote: >> > > * Yu-cheng Yu: >> > > >> > > > To me, looking at PT_GNU_PROPERTY and not trying to support anything is a >> > > > logical choice. And it breaks only a limited set of toolchains. >> > > > >> > > > I will simplify the parser and leave this patch as-is for anyone who wants >> > > > to >> > > > back-port. Are there any objections or concerns? >> > > >> > > Red Hat Enterprise Linux 8 does not use PT_GNU_PROPERTY and is probably >> > > the largest collection of CET-enabled binaries that exists today. >> > >> > For clarity, RHEL is actively parsing these properties today? >> > >> > > My hope was that we would backport the upstream kernel patches for CET, >> > > port the glibc dynamic loader to the new kernel interface, and be ready >> > > to run with CET enabled in principle (except that porting userspace >> > > libraries such as OpenSSL has not really started upstream, so many >> > > processes where CET is particularly desirable will still run without >> > > it). >> > > >> > > I'm not sure if it is a good idea to port the legacy support if it's not >> > > part of the mainline kernel because it comes awfully close to creating >> > > our own private ABI. >> > >> > I guess we can aim to factor things so that PT_NOTE scanning is >> > available as a fallback on arches for which the absence of >> > PT_GNU_PROPERTY is not authoritative. >> >> We can probably check PT_GNU_PROPERTY first, and fallback (based on ld-linux >> version?) to PT_NOTE scanning? > > For arm64, we can check for PT_GNU_PROPERTY and then give up > unconditionally. > > For x86, we would fall back to PT_NOTE scanning, but this will add a bit > of cost to binaries that don't have NT_GNU_PROPERTY_TYPE_0. The ld.so > version doesn't tell you what ELF ABI a given executable conforms to. > > Since this sounds like it's largely a distro-specific issue, maybe there > could be a Kconfig option to turn the fallback PT_NOTE scanning on? I'm worried that this causes interop issues similarly to what we see with VSYSCALL today. If we need both and a way to disable it, it should be something like a personality flag which can be configured for each process tree separately. Ideally, we'd settle on one correct approach (i.e., either always process both, or only process PT_GNU_PROPERTY) and enforce that. Thanks, Florian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:58950 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726730AbfFQLI6 (ORCPT ); Mon, 17 Jun 2019 07:08:58 -0400 From: Florian Weimer Subject: Re: [PATCH v7 22/27] binfmt_elf: Extract .note.gnu.property from an ELF file References: <20190606200646.3951-1-yu-cheng.yu@intel.com> <20190606200646.3951-23-yu-cheng.yu@intel.com> <20190607180115.GJ28398@e103592.cambridge.arm.com> <94b9c55b3b874825fda485af40ab2a6bc3dad171.camel@intel.com> <87lfy9cq04.fsf@oldenburg2.str.redhat.com> <20190611114109.GN28398@e103592.cambridge.arm.com> <031bc55d8dcdcf4f031e6ff27c33fd52c61d33a5.camel@intel.com> <20190612093238.GQ28398@e103592.cambridge.arm.com> Date: Mon, 17 Jun 2019 13:08:14 +0200 In-Reply-To: <20190612093238.GQ28398@e103592.cambridge.arm.com> (Dave Martin's message of "Wed, 12 Jun 2019 10:32:38 +0100") Message-ID: <87imt4jwpt.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-arch-owner@vger.kernel.org List-ID: To: Dave Martin Cc: Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue Message-ID: <20190617110814.xtgrLaqE7CsiTuSqN9MO5QriFGt5jLa9bGtuXpFmb1Q@z> * Dave Martin: > On Tue, Jun 11, 2019 at 12:31:34PM -0700, Yu-cheng Yu wrote: >> On Tue, 2019-06-11 at 12:41 +0100, Dave Martin wrote: >> > On Mon, Jun 10, 2019 at 07:24:43PM +0200, Florian Weimer wrote: >> > > * Yu-cheng Yu: >> > > >> > > > To me, looking at PT_GNU_PROPERTY and not trying to support anything is a >> > > > logical choice. And it breaks only a limited set of toolchains. >> > > > >> > > > I will simplify the parser and leave this patch as-is for anyone who wants >> > > > to >> > > > back-port. Are there any objections or concerns? >> > > >> > > Red Hat Enterprise Linux 8 does not use PT_GNU_PROPERTY and is probably >> > > the largest collection of CET-enabled binaries that exists today. >> > >> > For clarity, RHEL is actively parsing these properties today? >> > >> > > My hope was that we would backport the upstream kernel patches for CET, >> > > port the glibc dynamic loader to the new kernel interface, and be ready >> > > to run with CET enabled in principle (except that porting userspace >> > > libraries such as OpenSSL has not really started upstream, so many >> > > processes where CET is particularly desirable will still run without >> > > it). >> > > >> > > I'm not sure if it is a good idea to port the legacy support if it's not >> > > part of the mainline kernel because it comes awfully close to creating >> > > our own private ABI. >> > >> > I guess we can aim to factor things so that PT_NOTE scanning is >> > available as a fallback on arches for which the absence of >> > PT_GNU_PROPERTY is not authoritative. >> >> We can probably check PT_GNU_PROPERTY first, and fallback (based on ld-linux >> version?) to PT_NOTE scanning? > > For arm64, we can check for PT_GNU_PROPERTY and then give up > unconditionally. > > For x86, we would fall back to PT_NOTE scanning, but this will add a bit > of cost to binaries that don't have NT_GNU_PROPERTY_TYPE_0. The ld.so > version doesn't tell you what ELF ABI a given executable conforms to. > > Since this sounds like it's largely a distro-specific issue, maybe there > could be a Kconfig option to turn the fallback PT_NOTE scanning on? I'm worried that this causes interop issues similarly to what we see with VSYSCALL today. If we need both and a way to disable it, it should be something like a personality flag which can be configured for each process tree separately. Ideally, we'd settle on one correct approach (i.e., either always process both, or only process PT_GNU_PROPERTY) and enforce that. Thanks, Florian