From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cross.elm.relay.mailchannels.net (cross.elm.relay.mailchannels.net [23.83.212.46]) by sourceware.org (Postfix) with ESMTPS id BA7053858C62 for ; Fri, 30 Jun 2023 17:08:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA7053858C62 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 519C964228A; Fri, 30 Jun 2023 17:08:54 +0000 (UTC) Received: from pdx1-sub0-mail-a286.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id A36F4641E71; Fri, 30 Jun 2023 17:08:53 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1688144933; a=rsa-sha256; cv=none; b=Cj9KAQqgpiL73yquMhtZCTF16jZUUDULnrLNQVJr6NIYQIDVCBMuzG+aowmAv+ERM29f5O W4oDPWQyX8f3ULq3BLc2GaGS/aPKaGgNstwU5L0oRI2emFTGIRIdxIBH15PT9MlV931dng ZuaziF+kpmWD+kgkhQte9ywBofE4kpBSsW08PetlPgtDur+h0xBedwSC00Q1CPe/NHk3Rm c3E3bflFnl8JalpJkPi3+qcqTvc7Ou5mjyqX0KeCUGS58FMoXGGKIH39i+lMBmmicEcAhr f2B0WommGXhkeWzvatevrf3VDMsBz0juvtork8JEHL9IQn0DKUskmdNFn4HGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1688144933; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v68Qel/f+wNouFh7Zz8QspSAU3GIkyO81lCMOp/Cc8c=; b=q4JHpnrja7umerlsEQA9Huyx6RTPIunr6BmJGmUpnXk7GKv9fY3Ma3WB0wiw5B877MuCgr /B/eKEhyECSdySb6v2px2C/l6WJ5cisCPIpcaoj3QkRw4bA8IGH8wC3BYrJLgBOHtpZFrL yqF6kZNnrQqyEstosgNPvyGu36POhpffyf9RDU4FlpDd1WmZ457LSpNhzQoHaTH7Ay3HWB dP48/LyaPBDM6/SqAp6Mo+vqsyuvL4rNq5nVUNhDUxnNMa6iuam9WGl0gNb0kOTsTQh7tY 6elgivikUnzYv3gGtOie8RP6jHO5Pf9G4AykFFO1U0yv4HhnmlLxx5nUM4uIcg== ARC-Authentication-Results: i=1; rspamd-9fcc56855-lfnmh; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Soft-Exultant: 2c2e3d5224154a1f_1688144934119_451203785 X-MC-Loop-Signature: 1688144934119:2904283224 X-MC-Ingress-Time: 1688144934119 Received: from pdx1-sub0-mail-a286.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.217.230 (trex/6.9.1); Fri, 30 Jun 2023 17:08:54 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-09-174-91-45-44.dsl.bell.ca [174.91.45.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a286.dreamhost.com (Postfix) with ESMTPSA id 4Qt1xc6BZtz7v; Fri, 30 Jun 2023 10:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1688144933; bh=v68Qel/f+wNouFh7Zz8QspSAU3GIkyO81lCMOp/Cc8c=; h=Date:Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding; b=hw0aLcrwwPAjARp3V8o1abjcwUTUo0yHxJQgAdDKiIyeR1dweQJQT5UwI8zLp8uC/ 74EhgL9UgOTNKaEfHwpE6cberWkwJk2xE0c6qeB1AMnlYjKz7aDDqEJa4K5WfaqZac LwTlK/b0w5hs5O3u8xBLW5rJ5/Ycen9RG5rl7yqevFWsYNiiS13B7WctLuc5oz86bM nrCnGPd9yT7SPl5A3bKFKJHY+m7XqIHvN5h9MKaEWMGfuUvPSrGRl5jwgMzV/KLbKa oR63aRX56RpiaRymgMNem0LjtOqZCsiedTbrJVgcfJXeqVPaI+DOxTs76Qj72DnATy B8v8zl1may8zw== Message-ID: Date: Fri, 30 Jun 2023 13:08:51 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3 14/16] libio/bits/stdio2-decl.h: Avoid PLT entries with _FORTIFY_SOURCE Content-Language: en-US From: Siddhesh Poyarekar To: Frederic Berat Cc: libc-alpha@sourceware.org References: <20230628084246.778302-1-fberat@redhat.com> <20230628084246.778302-15-fberat@redhat.com> <514ef51d-5501-5af9-baf6-4885cbcd9fc7@gotplt.org> <89555123-2e8c-c771-22ad-f5a2d41812eb@gotplt.org> In-Reply-To: <89555123-2e8c-c771-22ad-f5a2d41812eb@gotplt.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3035.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 2023-06-30 11:48, Siddhesh Poyarekar wrote: > On 2023-06-30 11:38, Frederic Berat wrote: >> >> >> On Fri, Jun 30, 2023 at 5:30 PM Siddhesh Poyarekar >> > wrote: >> >> >> >>     On 2023-06-28 04:42, Frédéric Bérat wrote: >>      > The change is meant to avoid unwanted PLT entry for the >>     fgets_unlocked >>      > routine when _FORTIFY_SOURCE is set. >>      > --- >>      >   libio/bits/stdio2-decl.h | 2 +- >>      >   1 file changed, 1 insertion(+), 1 deletion(-) >>      > >>      > diff --git a/libio/bits/stdio2-decl.h b/libio/bits/stdio2-decl.h >>      > index 114b06d24b..d7ef7283d6 100644 >>      > --- a/libio/bits/stdio2-decl.h >>      > +++ b/libio/bits/stdio2-decl.h >>      > @@ -122,7 +122,7 @@ extern size_t __fread_chk (void *__restrict >>     __ptr, size_t __ptrlen, >>      >                          FILE *__restrict __stream) __wur; >>      > >>      >   #ifdef __USE_GNU >>      > -extern char *__REDIRECT (__fgets_unlocked_alias, >>      > +extern char *__REDIRECT_FORTIFY (__fgets_unlocked_alias, >>      >                        (char *__restrict __s, int __n, >>      >                         FILE *__restrict __stream), >> fgets_unlocked) >>      >       __wur __attr_access ((__write_only__, 1, 2)); >> >>     Why not the same for all the others? >> >> >> I tend to avoid modifying things that are not strictly necessary. If >> that happens to be needed on other aliases, then everything is ready >> for it, but it seems I didn't stumbled upon a case where it was ... >> When you look at it, the same way I didn't create >> libc_hidden_def/proto for all the routines here (like e.g. >> __fread_chk) if that wasn't needed. > > So there's a slight difference; the __REDIRECT_FORTIFY is essentially an > assurance that whenever there's an internal use of this function, the > alias will redirect to that internal alias.  The hidden_def adds an > alias, which is unnecessary until there's an actual internal use and the > hidden_proto is only a complement to the hidden_def. > > In that sense, I think the __REDIRECT_FORTIFY should be for all function > aliases, not just the ones that are currently being used. On second thoughts, I think it's OK to leave it as only for functions that are actually referenced internally for now. We can leave it to the localplt check to catch the extra PLT refs and then fix this up. So unless someone else thinks otherwise: Reviewed-by: Siddhesh Poyarekar Sid