Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1977420rwl; Sun, 26 Mar 2023 13:04:42 -0700 (PDT) X-Google-Smtp-Source: AK7set/Yz+ptMtjNqKsuYb7U235BngkS3OOVu0seWGIGKV9u1/eKnVfUZBCQLlHyQCM+6OVI+jsT X-Received: by 2002:a05:6a20:6714:b0:d9:dbb6:2e67 with SMTP id q20-20020a056a20671400b000d9dbb62e67mr9140893pzh.31.1679861082677; Sun, 26 Mar 2023 13:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679861082; cv=none; d=google.com; s=arc-20160816; b=A+Lj8vLRCuYUE5KSWwJAqhkLElvAwUIUqOPfLOinTiMU+XnB7GVVQ7C76CyIx50c5v AMbSlsjqd/SiCARx4hZXoPYEAlUMgO21XVL2mPLeKXw45v7ji+k/H7lF8s5Ziy6aTJ+8 8tRG7rm5Vv9GyRqRULspvV7Mwdb9TO+vEib4U5fHTCUixuCKOoSqheXSLT/trnhPv+9e 43Wio1SH+0ZO+K/KyStLtC6wcajUBeKsh2xGs3E6N9i8KFeWpDom9Sl0R3csY2OQuQeh Ax9MLoT2zpTzF6ue5issF3Q/uBc1pBXPEKaVNVouO78ps5Mz/l7X0JjKJwyEZGfqjBjE o8Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=budMwMqW8tIuFTIfePqvZbV0rAEQ+HiaEFGnaM9O8SA=; b=kfKm6nvEgqoWGQcFBV4l/KDtIhEjFpzUsEBIHs9PU8DYO01xFsUWRto7iovL4POtsg rRyooPTKc41/7HeQqyRxdme71d/j61JsDtcww4862IzM2rinoV0qBCXxHYWZMsOEAJki 3YJxJ/dcQvg5u2Rs7HUO00LHAHM1uX1rhCOUa4Iwtgc5gSMLyPv8g+LKa4V42ZIlmP8z MuBDQz8aM3QCiyzdQRe6PCucNXy3ABm0W5DhKnG5JM6pfBI9dfaGFzo54pb3SINNJYfh UuOVxGE6OkdsBaQrcNDtrvFQgT167pJOx4mjN5H9MiSwOL1/Z1OKj+2MiFFZMpM7TKZx GPcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=AUYfY4kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a628306000000b00625559a78a2si24976350pfe.107.2023.03.26.13.04.27; Sun, 26 Mar 2023 13:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=AUYfY4kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbjCZTvo (ORCPT + 99 others); Sun, 26 Mar 2023 15:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjCZTvn (ORCPT ); Sun, 26 Mar 2023 15:51:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764AF46AF; Sun, 26 Mar 2023 12:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=budMwMqW8tIuFTIfePqvZbV0rAEQ+HiaEFGnaM9O8SA=; b=AUYfY4kAEcGeAfh53LuHc4dHqt PH1KTT9M0FEEbntpKkczLb5/r2ticvR+B4PFq4FGK8xR8OUTTxdianF/FBkQWgmeJ2S/eln4U8LP7 cpvvHUXS3SsXiKWaXO/ONIcu6JVtD5BK9FR4mlyBxKrePYCKHYfdGwwM1zZB+8+RTgodemMnzcnPQ xQm1kBuVjoR0DE99q1GX9COPjXaCBGfu98axD+v7PyIjYuhGWuqN8p9Pv4WOdXjQsqbsBd+pc8Bmy +ZfZ1Ca7A57Vx5n4OEtr0hPbXdRA4juMdufcrYKKjq34ZmfHwrvz5piLsD6LNZYMG/Cm3zPk50YJH E33h3Rnw==; Received: from [2601:1c2:980:9ec0::2764] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pgWOx-00980k-2M; Sun, 26 Mar 2023 19:51:39 +0000 Message-ID: <4de7483e-2240-5a81-e3e8-af7b658695eb@infradead.org> Date: Sun, 26 Mar 2023 12:51:37 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v2] ELF: document some de-facto PT_* ABI quirks Content-Language: en-US To: Alexey Dobriyan , akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Bagas Sanjaya References: <2acb586c-08a9-42d9-a41e-7986cc1383ea@p183> From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexey, On 3/26/23 09:49, Alexey Dobriyan wrote: > Turns out rules about PT_INTERP, PT_GNU_STACK and PT_GNU_PROPERTY > program headers are slightly different. > > Signed-off-by: Alexey Dobriyan > --- > > v2: integrate into documentation build system > > Documentation/ELF/ELF.rst | 32 ++++++++++++++++++++++++++++++++ > Documentation/ELF/index.rst | 10 ++++++++++ > Documentation/index.rst | 1 + > 3 files changed, 43 insertions(+) I'm not sure that ELF merits its own subdirectory or that each item here should be a chapter, but this fixes all of the issues that I pointed out. Thanks. Reviewed-by: Randy Dunlap > new file mode 100644 > --- /dev/null > +++ b/Documentation/ELF/ELF.rst > @@ -0,0 +1,32 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +================================= > +Linux-specific ELF idiosyncrasies > +================================= > + > +Definitions > +=========== > + > +"First" program header is the one with the smallest offset in the file: > +e_phoff. "Last" program header is the one with the biggest offset: > +e_phoff + (e_phnum - 1) * sizeof(Elf_Phdr). > + > +PT_INTERP > +========= > + > +First PT_INTERP program header is used to locate the filename of ELF > +interpreter. Other PT_INTERP headers are ignored (since Linux 2.4.11). > + > +PT_GNU_STACK > +============ > + > +Last PT_GNU_STACK program header defines userspace stack executability > +(since Linux 2.6.6). Other PT_GNU_STACK headers are ignored. > + > +PT_GNU_PROPERTY > +=============== > + > +ELF interpreter's last PT_GNU_PROPERTY program header is used (since > +Linux 5.8). If interpreter doesn't have one, then the last PT_GNU_PROPERTY > +program header of an executable is used. Other PT_GNU_PROPERTY headers > +are ignored. > new file mode 100644 > --- /dev/null > +++ b/Documentation/ELF/index.rst > @@ -0,0 +1,10 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +=== > +ELF > +=== > + > +.. toctree:: > + :maxdepth: 1 > + > + ELF > --- a/Documentation/index.rst > +++ b/Documentation/index.rst > @@ -113,6 +113,7 @@ to ReStructured Text format, or are simply too old. > :maxdepth: 1 > > staging/index > + ELF/index > > > Translations -- ~Randy