From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-40135.protonmail.ch (mail-40135.protonmail.ch [185.70.40.135]) by sourceware.org (Postfix) with ESMTPS id 8B50F3858D32 for ; Fri, 9 Dec 2022 09:02:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8B50F3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=protonmail.com Date: Fri, 09 Dec 2022 09:02:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1670576529; x=1670835729; bh=ehfemXRGIhpDoTxQacB2e8afrkzkRDHGkhuMiddEMwc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=mA8Lh6IRIrrJYFsDNv9YTD9cXr9+Hv7QcKB6TbImDloepDtUu5mkdM52RSG5YvXkI AXHuL+oxX16F0nmGq2GCSQOKrgxvjcTg6gST9HqFcJCTWxkBxNtEo5RKsJrtu+583g 4Sg/umQzfhk+80K95juVDqa/BKw62dQCAnLx1txqe5ymfMWiI4ri2c7C52G8lmsjQu N60HR0AyQ8Y/hzd6lyJqojh36JAyja6iVhTLt1V5GdLqB255y8Pvkt5Com7DHa3mm6 z+tDeFR0yLwjjjo9hs2ieadOp1+efiuyzNLmKKrMnFYGvEZrpyPO1ZLvd+bM/THk+7 wUIlKr9DoXWFg== To: Florian Weimer From: =?utf-8?Q?Yago_Guti=C3=A9rrez?= Cc: =?utf-8?Q?Yago_Guti=C3=A9rrez_via_Libc-alpha?= Subject: Re: [PATCH 0/1] __libc_start_main() now uses auxv to obtain phdr's address [BZ #29864] Message-ID: In-Reply-To: <877cz1hgjl.fsf@oldenburg.str.redhat.com> References: <73l3eC0YTCoWnmm2zGV-SIY9-W5DQ-peyx7secTao121qocwqub-R4Zhrpkai8_LRxy4xsn7ARdHRbI7NnzSysk6ACmQWfiavdpz-tA70xc=@protonmail.com> <877cz1hgjl.fsf@oldenburg.str.redhat.com> Feedback-ID: 34810787:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Oh, I'm sorry, you are right. I wrote the explanations in the bugzilla repo= rt, not here, my bad. I will paste here what I said there. The ELF specification declares a field in the ELF header to contain the off= set inside the binary at which there will be found the program headers tabl= e: phoff. Since a segment may see its in-memory size differ from its in-fil= e size (or the binary may have holes), in-memory offsets are bound to diffe= r too from their in-file counterparts, and hence we may commit an error usi= ng base + phoff to find the address of the phdr's, failing miserably with a= segmentation fault with a perfectly valid ELF. Given that the kernel so nicely provides this piece of information in the a= uxiliar vector, I think it would be best to use it by default, recurring to= other ways only when this field is mysteriously ommited from it or there i= s no auxiliar vector at all. Thank you for your attention, Y. Sent with Proton Mail secure email. ------- Original Message ------- On Thursday, December 8th, 2022 at 19:54, Florian Weimer wrote: > * Yago Guti=C3=A9rrez via Libc-alpha: >=20 > > From bf2371ce732194f652719aff4af0f9021f9cbd90 Mon Sep 17 00:00:00 2001 > > From: =3D?UTF-8?q?Yago=3D20Guti=3DC3=3DA9rrez?=3D yagogl@protonmail.com > > Date: Wed, 7 Dec 2022 12:49:22 +0100 > > Subject: [PATCH 1/1] __libc_start_main() now uses auxv to obtain phdr's > > address [BZ #29864] > > To: libc-alpha@sourceware.org >=20 >=20 > This needs a much more elaborate commit message. >=20 > I don't quite get why you need to add this to _rtld_global. This is > only used by the static startup code. >=20 > This looks like it is a fix for the refactoring in: >=20 > commit 73fc4e28b9464f0e13edc719a5372839970e7ddb > Author: Florian Weimer fweimer@redhat.com >=20 > Date: Mon Feb 28 11:50:41 2022 +0100 >=20 > Linux: Consolidate auxiliary vector parsing (redo) >=20 > And optimize it slightly. >=20 > This is commit 8c8510ab2790039e58995ef3a22309582413d3ff revised. >=20 > In _dl_aux_init in elf/dl-support.c, use an explicit loop > and -fno-tree-loop-distribute-patterns to avoid memset. >=20 > Reviewed-by: Szabolcs Nagy szabolcs.nagy@arm.com >=20 >=20 > What are the actual failures you see? >=20 > Thanks, > Florian