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=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 [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 B4C651F8C6 for ; Wed, 28 Jul 2021 08:17:15 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4589398CC0D for ; Wed, 28 Jul 2021 08:17:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4589398CC0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627460234; bh=2N/7//lUWv+u3IvIElTcbm2Wy4xLkVqZpUB3qXubRLY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=i50I1yjci1htEdST9YVPUgbxuN0xxWgqqeNI61M4L5QTUwjWO8BvcWcKTEwWuVI+C DLbGFmmsoY4DkRgjSHTbob7MeZxi6tRh0YfDGvtzHgXyta6n33GlzMILuj7O3iMtBJ mKvc/ikjzYwvtKaIHNFC2MFrgYToPXa8J1MgCmLk= Received: from quail.birch.relay.mailchannels.net (quail.birch.relay.mailchannels.net [23.83.209.151]) by sourceware.org (Postfix) with ESMTPS id 2387E3988417 for ; Wed, 28 Jul 2021 07:29:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2387E3988417 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 C24C0342450; Wed, 28 Jul 2021 07:29:07 +0000 (UTC) Received: from pdx1-sub0-mail-a75.g.dreamhost.com (100-96-18-103.trex.outbound.svc.cluster.local [100.96.18.103]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 39F52341E99; Wed, 28 Jul 2021 07:29:07 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a75.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.18.103 (trex/6.3.3); Wed, 28 Jul 2021 07:29:07 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Lettuce-Bubble: 5ead703b23086af6_1627457347459_2256673054 X-MC-Loop-Signature: 1627457347459:1883706745 X-MC-Ingress-Time: 1627457347459 Received: from pdx1-sub0-mail-a75.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a75.g.dreamhost.com (Postfix) with ESMTP id CDE9A8C384; Wed, 28 Jul 2021 00:29:06 -0700 (PDT) Received: from rhbox.redhat.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a75.g.dreamhost.com (Postfix) with ESMTPSA id 0F7F48C382; Wed, 28 Jul 2021 00:29:03 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a75 To: libc-alpha@sourceware.org Subject: [PATCH v2] __cxa_thread_atexit_impl: Abort on allocation failure [BZ #18524] Date: Wed, 28 Jul 2021 12:58:54 +0530 Message-Id: <20210728072854.3915796-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Siddhesh Poyarekar via Libc-alpha Reply-To: Siddhesh Poyarekar Cc: fweimer@redhat.com Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Abort in the unlikely event that allocation fails when trying to register a TLS destructor. --- stdlib/cxa_thread_atexit_impl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_i= mpl.c index 577ed30931..d789f043f2 100644 --- a/stdlib/cxa_thread_atexit_impl.c +++ b/stdlib/cxa_thread_atexit_impl.c @@ -72,6 +72,7 @@ is not very different from a case where __call_tls_dtors is called af= ter _dl_close_worker on the DSO and hence is an accepted execution. */ =20 +#include #include #include =20 @@ -104,6 +105,8 @@ __cxa_thread_atexit_impl (dtor_func func, void *obj, = void *dso_symbol) =20 /* Prepend. */ struct dtor_list *new =3D calloc (1, sizeof (struct dtor_list)); + if (__glibc_unlikely (new =3D=3D NULL)) + __libc_fatal ("failed to register TLS destructor: out of memory"); new->func =3D func; new->obj =3D obj; new->next =3D tls_dtor_list; --=20 2.31.1