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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 898941F5AE for ; Sat, 17 Jul 2021 22:05:23 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88EA6383602F for ; Sat, 17 Jul 2021 22:05:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88EA6383602F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626559522; bh=9Wn2XLuuW1A28VKBJLwbfxUmpSIo383ErH74bU+T2D0=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mcXsZ8bTAEVzdspGRQOF5VJlrcU6Jd5QkFeG0dEei/todnQrVPVaxBhNOhgsicRmx lRJXeBJD6S5PQIZeiwhbB/Kj6m8C81tj5UEdYQPDSmLTVZa2q4Tqy/Ef90+gSt9WyD VjqbtQsBDg0h3X/3NTdAI0e+qf9t7RTNGNLoiEH0= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 23EB13838031 for ; Sat, 17 Jul 2021 22:03:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23EB13838031 Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-KvEQ_bEqMY-DRf4we5ZLiQ-1; Sat, 17 Jul 2021 18:03:49 -0400 X-MC-Unique: KvEQ_bEqMY-DRf4we5ZLiQ-1 Received: by mail-qv1-f72.google.com with SMTP id jo25-20020a0562145019b0290300a4fa83d8so4988595qvb.23 for ; Sat, 17 Jul 2021 15:03:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=9Wn2XLuuW1A28VKBJLwbfxUmpSIo383ErH74bU+T2D0=; b=ccYaz/QtW3Gdc3520CP9ja3MGlU4U+MXCQP+wJDE+FrViwGa1VVNt2Fxk2ArSrzt2b Yxn5QJ/zAJ61WsO0EUD8JNweMqZ3dyXMfSeAOO3hT9QR+ZpOv/b1jdZG35lFoxbl4q0X UtPINLjtVtYmWcruBFhY/7Xli51XvHPC5E5cuiImW7enl6MCyT7MHekKyx29o4c2RRNE oZhFrjCK2AP1OMGaPpjd3woxnixOOpR+RZ9ZRYd7vnPn3lXP+ScEFADrlakos7y9xaKR nlKqx0lTboMh6IVUv9KGr4W26/htHWD6D4As3yFdRpsFuF3mGWXbO0wuZ5fnnXwgicbg YhXg== X-Gm-Message-State: AOAM532jHLXp4zCCwJCm5jRQG5Uuf+l33L2yYs2BPvwEz+0iPlXeF4lC ZKRdfX7UpiqwYEEPAhFwLoagxjpTTeH25q9XKyaaxanzU4C2wtQMXMezoAJiiX/0dF/wsw1MStl 16uVMCGiAFQpNuKmEex+8 X-Received: by 2002:ac8:4cce:: with SMTP id l14mr6579027qtv.219.1626559429165; Sat, 17 Jul 2021 15:03:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwldRbrhTThp1874qyOZ0FXrHyZZpVFQPENRNkxYUdM+8kdY+yRFAEj1qCLPVPFopwkXD9b5Q== X-Received: by 2002:ac8:4cce:: with SMTP id l14mr6579018qtv.219.1626559429018; Sat, 17 Jul 2021 15:03:49 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id j7sm5835661qkd.21.2021.07.17.15.03.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Jul 2021 15:03:48 -0700 (PDT) Subject: Re: [PATCH v8 02/10] Remove __after_morecore_hook To: Siddhesh Poyarekar , libc-alpha@sourceware.org References: <20210713073845.504356-1-siddhesh@sourceware.org> <20210713073845.504356-3-siddhesh@sourceware.org> Organization: Red Hat Message-ID: Date: Sat, 17 Jul 2021 18:03:47 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210713073845.504356-3-siddhesh@sourceware.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Cc: fweimer@redhat.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 7/13/21 3:38 AM, Siddhesh Poyarekar wrote: > Remove __after_morecore_hook from the API and finalize the symbol so > that it can no longer be used in new applications. Old applications > using __after_morecore_hook will find that their hook is no longer > called. OK for 2.34. Tested without regression on x86_64 and i686. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell > --- > malloc/hooks.c | 5 +++++ > malloc/malloc.c | 22 +--------------------- > malloc/malloc.h | 3 --- > 3 files changed, 6 insertions(+), 24 deletions(-) > > diff --git a/malloc/hooks.c b/malloc/hooks.c > index daa5c7cfae..45c91d6502 100644 > --- a/malloc/hooks.c > +++ b/malloc/hooks.c > @@ -17,6 +17,11 @@ > License along with the GNU C Library; see the file COPYING.LIB. If > not, see . */ > > +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34) > +void weak_variable (*__after_morecore_hook) (void) = NULL; > +compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0); OK. > +#endif > + > /* Hooks for debugging versions. The initial hooks just call the > initialization routine, then do the normal work. */ > > diff --git a/malloc/malloc.c b/malloc/malloc.c > index 154f6b460c..24e7854a0e 100644 > --- a/malloc/malloc.c > +++ b/malloc/malloc.c > @@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook) > void *weak_variable (*__memalign_hook) > (size_t __alignment, size_t __size, const void *) > = memalign_hook_ini; > -void weak_variable (*__after_morecore_hook) (void) = NULL; > - OK. > /* This function is called from the arena shutdown hook, to free the > thread cache (if it exists). */ > static void tcache_thread_shutdown (void); > @@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) > LIBC_PROBE (memory_sbrk_more, 2, brk, size); > } > > - if (brk != (char *) (MORECORE_FAILURE)) > - { > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); > - } > - else OK. > + if (brk == (char *) (MORECORE_FAILURE)) > { > /* > If have mmap, try using it as a backup when MORECORE fails or > @@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av) > correction = 0; > snd_brk = (char *) (MORECORE (0)); > } > - else > - { > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); > - } OK. > } > > /* handle non-contiguous cases */ > @@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av) > */ > > MORECORE (-extra); > - /* Call the `morecore' hook if necessary. */ > - void (*hook) (void) = atomic_forced_read (__after_morecore_hook); > - if (__builtin_expect (hook != NULL, 0)) > - (*hook)(); OK. > new_brk = (char *) (MORECORE (0)); > > LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra); > diff --git a/malloc/malloc.h b/malloc/malloc.h > index c1c0896d29..634b7db868 100644 > --- a/malloc/malloc.h > +++ b/malloc/malloc.h > @@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment, > size_t __size, > const void *) > __MALLOC_DEPRECATED; > -extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void) > - __MALLOC_DEPRECATED; OK. > - > > __END_DECLS > #endif /* malloc.h */ > -- Cheers, Carlos.