From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9325CC31E51 for ; Tue, 18 Jun 2019 09:12:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 704D82084B for ; Tue, 18 Jun 2019 09:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729236AbfFRJM5 (ORCPT ); Tue, 18 Jun 2019 05:12:57 -0400 Received: from foss.arm.com ([217.140.110.172]:58496 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbfFRJM4 (ORCPT ); Tue, 18 Jun 2019 05:12:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D7DD344; Tue, 18 Jun 2019 02:12:56 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F3EB3F246; Tue, 18 Jun 2019 02:12:52 -0700 (PDT) Date: Tue, 18 Jun 2019 10:12:50 +0100 From: Dave Martin To: Thomas Gleixner Cc: Florian Weimer , Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , 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 Subject: Re: [PATCH v7 22/27] binfmt_elf: Extract .note.gnu.property from an ELF file Message-ID: <20190618091248.GB2790@e103592.cambridge.arm.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> <87imt4jwpt.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 02:20:40PM +0200, Thomas Gleixner wrote: > On Mon, 17 Jun 2019, Florian Weimer wrote: > > * Dave Martin: > > > On Tue, Jun 11, 2019 at 12:31:34PM -0700, Yu-cheng Yu wrote: > > >> 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. > > Chose one and only the one which makes technically sense and is not some > horrible vehicle. > > Everytime we did those 'oh we need to make x fly workarounds' we regretted > it sooner than later. So I guess that points to keeping PT_NOTE scanning always available as a fallback on x86. This sucks a bit, but if there are binaries already in the wild that rely on this, I don't think we have much choice... I'd still favour a Kconfig option to allow this support to be suppressed by arches that don't have a similar legacy to be compatible with. Cheers ---Dave From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Martin Subject: Re: [PATCH v7 22/27] binfmt_elf: Extract .note.gnu.property from an ELF file Date: Tue, 18 Jun 2019 10:12:50 +0100 Message-ID: <20190618091248.GB2790@e103592.cambridge.arm.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> <87imt4jwpt.fsf@oldenburg2.str.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Thomas Gleixner Cc: Florian Weimer , Yu-cheng Yu , x86@kernel.org, "H. Peter Anvin" , 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 List-Id: linux-api@vger.kernel.org On Mon, Jun 17, 2019 at 02:20:40PM +0200, Thomas Gleixner wrote: > On Mon, 17 Jun 2019, Florian Weimer wrote: > > * Dave Martin: > > > On Tue, Jun 11, 2019 at 12:31:34PM -0700, Yu-cheng Yu wrote: > > >> 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. > > Chose one and only the one which makes technically sense and is not some > horrible vehicle. > > Everytime we did those 'oh we need to make x fly workarounds' we regretted > it sooner than later. So I guess that points to keeping PT_NOTE scanning always available as a fallback on x86. This sucks a bit, but if there are binaries already in the wild that rely on this, I don't think we have much choice... I'd still favour a Kconfig option to allow this support to be suppressed by arches that don't have a similar legacy to be compatible with. Cheers ---Dave