Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp839341ybl; Thu, 22 Aug 2019 05:48:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRdAWT6TBgUPN6HisRRmgNR6pdczFNcuHEElKXCsw3SZCLK+wCTdV1GYrTvmZkgRIerPrJ X-Received: by 2002:a63:9245:: with SMTP id s5mr34372065pgn.123.1566478114997; Thu, 22 Aug 2019 05:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566478114; cv=none; d=google.com; s=arc-20160816; b=dYJ4V+q7Jpl3vRlwg4abyKFNW0f7RCoHV3Z1XIDKMR6adf+A5d7GWQyQH9GiFwomzb PR3STeV68uKu/DRqNK5vB/oyLOJyH4bftiMZ8QH0IUvXt7EGDXanNhuvP1pYFsLWc/cT 1T2lIKql5KpshaDIKZ+Wq7JXfs6y4wjtnA8wxBJcsJoMSf8bRDQz569ZvgFIpTH1ACnN BrQ4f5smWKZzJqa0boJF6FppWXKMJsUIfNk2U3z6gdCtlXClregsDq1dj3YkLdS6Wv4d ijBNsFGKUouKqMioZnSZtV8O7BbGD/MrGOm4tql9pCa8LavbOTq9+f6YRjdZuowUTQgj 3wLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=nMhImEwO8k2Mub3aNHnUXW7e80NirgiNgU7VgKpkiYc=; b=UPEbQAiveColMVmhZ7cEZsWlth5WIPRnVeHoz8UvBJMhhCdAnxdTBnK7WVT2pnioi2 duKcYj9DASS9D/pE0tcBBo13SY/5ZAkuZpzRgliqxhLNQMwQyo5JPA2ds75EylMDE6q1 LhFUXxddHCZ8PSU9ZglLwWfcELO2/7w3fmw6ffO/maUCG086FV4NxN6OUZBs2HviCZkC ZFEsZ+VN/NM7nLmfNM2JRW5EguHib4gtfqL2kQ1RSA6v8EJbcMisss0/kRrTz3zpn4W/ ysuEuezE4lAR46iW3NWq0VGvwUkvJ/yyb6LcaR47eB3quker/n1mXcPmacSHdXW10yDY 6+tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si7528834pld.197.2019.08.22.05.48.19; Thu, 22 Aug 2019 05:48:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731615AbfHVLM4 (ORCPT + 99 others); Thu, 22 Aug 2019 07:12:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33574 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbfHVLM4 (ORCPT ); Thu, 22 Aug 2019 07:12:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF8098D5BA6; Thu, 22 Aug 2019 11:12:55 +0000 (UTC) Received: from oldenburg2.str.redhat.com (dhcp-192-200.str.redhat.com [10.33.192.200]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE9B16E710; Thu, 22 Aug 2019 11:12:54 +0000 (UTC) From: Florian Weimer To: Dave Martin Cc: "H.J. Lu" , Yu-cheng Yu , binutils@sourceware.org, linux-kernel@vger.kernel.org Subject: Re: ELF NT_GNU_PROPERTY_TYPE_0 Questions References: <20190822110049.GE27757@arm.com> Date: Thu, 22 Aug 2019 13:12:53 +0200 In-Reply-To: <20190822110049.GE27757@arm.com> (Dave Martin's message of "Thu, 22 Aug 2019 12:00:50 +0100") Message-ID: <87k1b5xxl6.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Thu, 22 Aug 2019 11:12:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dave Martin: > Hi there, > > Can you clarify a couple of points about the SysV ABI Linux > Extensions [1] for me? > > 1) Can there be more than one NT_GNU_PROPERTY_TYPE_0 note in a valid > ELF file? I think the answer should be "no". Yes, if it has been produced by a link editors which does not about property notes. The ELF file still needs to be treated as valid, but the note should be ignored. > 2) Is is permissible for an ELF ET_EXEC or ET_DYN file that contains > an NT_GNU_PROPERTY_TYPE_0 property not to have a PT_GNU_PROPERTY phdrs > entry mapping it? Except for historical usage by RedHat (which > apparently can be worked round in userspace) it seems reasonable for > the answer to be "no", at least for Linux. Using an older link editor on a CET-enabled distribution will produce such binaries, too. The ELF file still needs to be treated as valid, but the property date should be ignored. > 3) Is it permissible for the PT_GNU_PROPERTY phdr (if present) to > map anything other than precisely one NT_GNU_PROPERTY_TYPE_0 > note? I think the answer should be "no". Correct. Additional processing logic in the link editor is needed. > 4) Is an NT_GNU_PROPERTY_TYPE_0 note allowed to contain two or more > properties with the same pr_type? I think the answer should be "no". H.J. needs to answer that. > 5) What's the rationale for sorting the properties by pr_type? I can > see this would make it easier for the linker to merge > NT_GNU_PROPERTY_TYPE_0 notes from different files, but I'm wondering > whether the kernel really needs to enforce the ordering when loading > an ELF. The kernel doesn't need to merge property lists together. Likewise. > 6) Do you have a view on the best way to define the Elf_Prop type in > headers? bfd elf-bfd.h seems to have elf_property, but this doesn't > follow the style of the public ELF headers. We should put it into in glibc. We don't want to rely on UAPI headers there because this version of is used in many places. Thanks, Florian