From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, PDS_RDNS_DYNAMIC_FP,RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DFB081F61A for ; Mon, 12 Dec 2022 10:56:10 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ZxzGbVHe"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC5763986412 for ; Mon, 12 Dec 2022 10:56:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC5763986412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670842569; bh=l+IEKPySVmI0FRzbPZ+ZOzqOqJP9w3dJNs1mkzaHg4I=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZxzGbVHeS4tXDF8w4Sq5sYzqVgMuq0LZTmM8ih5TIiDh09LepEODnVaLLvt9TtxfM 5IOQagbRs6aDwZ50GX3+icr0dpALSLJbO3K+F4+WVfwtMk5xRY/mWjZdhXny7CPtvo VBfK380xZpVQ6fx5ndH0IzAL93i6LCOjGy3017nQ= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B51A33889E18 for ; Mon, 12 Dec 2022 10:55:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B51A33889E18 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-24aHoFDUMK-vtXo-baUzeA-1; Mon, 12 Dec 2022 05:55:46 -0500 X-MC-Unique: 24aHoFDUMK-vtXo-baUzeA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA429803D4B; Mon, 12 Dec 2022 10:55:45 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF39D492B00; Mon, 12 Dec 2022 10:55:44 +0000 (UTC) To: Adhemerval Zanella via Libc-alpha Cc: Fangrui Song , Adhemerval Zanella Subject: Re: [PATCH 4/7] Move libc_freeres_ptrs and libc_subfreeres to weak functions References: <20221115193159.173838-1-adhemerval.zanella@linaro.org> <20221115193159.173838-5-adhemerval.zanella@linaro.org> Date: Mon, 12 Dec 2022 11:55:40 +0100 In-Reply-To: <20221115193159.173838-5-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Tue, 15 Nov 2022 16:31:56 -0300") Message-ID: <87cz8ouc0j.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" * Adhemerval Zanella via Libc-alpha: > diff --git a/crypt/md5-crypt.c b/crypt/md5-crypt.c > index 7c4fb9fb97..9660cdd698 100644 > --- a/crypt/md5-crypt.c > +++ b/crypt/md5-crypt.c > @@ -299,10 +299,7 @@ __md5_crypt_r (const char *key, const char *salt, char *buffer, int buflen) > return buffer; > } > > -#ifndef _LIBC > -# define libc_freeres_ptr(decl) decl > -#endif > -libc_freeres_ptr (static char *buffer); > +static char *buffer; > > char * > __md5_crypt (const char *key, const char *salt) > @@ -330,7 +327,10 @@ __md5_crypt (const char *key, const char *salt) > static void > __attribute__ ((__destructor__)) > free_mem (void) > +#else > +void > +__md5_crypt_freemem (void) > +#endif > { > free (buffer); > } > -#endif > diff --git a/crypt/sha256-crypt.c b/crypt/sha256-crypt.c > index a98a968a8b..75fd582429 100644 > --- a/crypt/sha256-crypt.c > +++ b/crypt/sha256-crypt.c > @@ -386,10 +386,7 @@ __sha256_crypt_r (const char *key, const char *salt, char *buffer, int buflen) > return buffer; > } > > -#ifndef _LIBC > -# define libc_freeres_ptr(decl) decl > -#endif > -libc_freeres_ptr (static char *buffer); > +static char *buffer; > > /* This entry point is equivalent to the `crypt' function in Unix > libcs. */ > @@ -422,7 +419,10 @@ __sha256_crypt (const char *key, const char *salt) > static void > __attribute__ ((__destructor__)) > free_mem (void) > +#else > +void > +__sha256_crypt_freemem (void) > +#endif > { > free (buffer); > } > -#endif > diff --git a/crypt/sha512-crypt.c b/crypt/sha512-crypt.c > index ea13527c09..ae6ecaef16 100644 > --- a/crypt/sha512-crypt.c > +++ b/crypt/sha512-crypt.c > @@ -408,10 +408,7 @@ __sha512_crypt_r (const char *key, const char *salt, char *buffer, int buflen) > return buffer; > } > > -#ifndef _LIBC > -# define libc_freeres_ptr(decl) decl > -#endif > -libc_freeres_ptr (static char *buffer); > +static char *buffer; > > /* This entry point is equivalent to the `crypt' function in Unix > libcs. */ > @@ -444,7 +441,10 @@ __sha512_crypt (const char *key, const char *salt) > static void > __attribute__ ((__destructor__)) > free_mem (void) > +#else > +void > +__sha512_crypt_freemem (void) > +#endif > { > free (buffer); > } > -#endif I think you should delete the entire deallocation logic, or make use of the ELF destructor unconditional. This wasn't linked into libc, so it wasn't run from __libc_freeres, and the hook registration was a no-op. (I believe, I haven't checked.) Thanks, Florian