From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d500]) by sourceware.org (Postfix) with ESMTPS id 89EDF3858CDA for ; Thu, 30 Mar 2023 16:08:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89EDF3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:2e14:0:640:2cd1:0]) by forward500b.mail.yandex.net (Yandex) with ESMTP id 9FD155F1AC; Thu, 30 Mar 2023 19:08:33 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id U8MYd53DbeA0-gIub4HjP; Thu, 30 Mar 2023 19:08:32 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1680192513; bh=1Vn7/8VNiEO/DBqkEPBXln5j7fXZgkjeNORY+OUA+Oc=; h=In-Reply-To:From:Date:References:To:Subject:Message-ID; b=t+3ClejgMbRXqTUt024D2WYCsTbjILyHsAwAkwrhvJ8SYRZaX0OPLWtuRwuV1Z0uo WLKzW0HzDSV5GKTuDHjZge0qDS0Z35Sh94cBeaDU1KVPqFolKjozlOENo7n2Ut1yeW gltUlgiq9/JFIJUSoRvy1FWCQK0stUoGlCuPPJts= Authentication-Results: mail-nwsmtp-smtp-production-main-25.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Thu, 30 Mar 2023 21:08:30 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 03/13] elf: dont pass fd to _dl_process_pt_xx Content-Language: en-US To: Adhemerval Zanella Netto , libc-alpha@sourceware.org References: <20230318165110.3672749-1-stsp2@yandex.ru> <20230318165110.3672749-4-stsp2@yandex.ru> <77329e53-bb96-dc39-1f3d-6a5dfa0e7263@linaro.org> From: stsp In-Reply-To: <77329e53-bb96-dc39-1f3d-6a5dfa0e7263@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_NONE,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: 29.03.2023 22:10, Adhemerval Zanella Netto пишет: > > On 18/03/23 13:51, Stas Sergeev via Libc-alpha wrote: >> It is not used in these functions. >> rtld.c:rtld_setup_main_map() does the same. >> >> The test-suite was run on x86_64/64 and showed no regressions. >> >> Signed-off-by: Stas Sergeev >> --- >> elf/dl-load.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/elf/dl-load.c b/elf/dl-load.c >> index fcb39a78d4..ab8b648687 100644 >> --- a/elf/dl-load.c >> +++ b/elf/dl-load.c >> @@ -1379,10 +1379,10 @@ cannot enable executable stack as shared object requires"); >> switch (ph[-1].p_type) >> { >> case PT_NOTE: >> - _dl_process_pt_note (l, fd, &ph[-1]); >> + _dl_process_pt_note (l, -1, &ph[-1]); >> break; >> case PT_GNU_PROPERTY: >> - _dl_process_pt_gnu_property (l, fd, &ph[-1]); >> + _dl_process_pt_gnu_property (l, -1, &ph[-1]); >> break; >> } >> > > It allows both _dl_process_pt_note and _dl_process_pt_gnu_property to know > if the called where rtld code during statup code or dlopen. But you are > right that it is not used. > > However this does not accomplish anything, a better refactor would to just > remove the argument altogether. It at least would simplify the interface > and allow slight better code generation. I tried to do that, but there is also that _dl_process_gnu_property() called from _dl_process_pt_gnu_property(). For aarch64 it has this:       unsigned int feature_1 = *(unsigned int *) data;       if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)         _dl_bti_protect (l, fd); What should I do here to remove that fd?