From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 72E7D3858D39 for ; Tue, 18 Jan 2022 09:48:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72E7D3858D39 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-XSua3-r_Ne6o9UbEhA1YXA-1; Tue, 18 Jan 2022 04:48:10 -0500 X-MC-Unique: XSua3-r_Ne6o9UbEhA1YXA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE25818A0F26; Tue, 18 Jan 2022 09:48:09 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.198]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BE8570D26; Tue, 18 Jan 2022 09:48:08 +0000 (UTC) From: Florian Weimer To: Martin Sebor via Libc-alpha Subject: Re: [PATCH] avoid -Wuse-after-free [BZ #26779] References: Date: Tue, 18 Jan 2022 10:48:07 +0100 In-Reply-To: (Martin Sebor via Libc-alpha's message of "Sat, 15 Jan 2022 17:21:19 -0700") Message-ID: <87sftll6i0.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 18 Jan 2022 09:48:13 -0000 * Martin Sebor via Libc-alpha: > GCC 12 features a couple of new warnings designed to detect uses > of pointers made invalid by the pointees lifetimes having ended. > Building Glibc with the enhanced GCC exposes a few such uses, > mostly after successful calls to realloc. The attached patch > avoids the new warnings by converting the pointers to uintptr_t > first and using the converted integers instead. > > The patch suppresses all instances of the warning at the strictest > setting (-Wuse-after-free=3), which includes even uses in equality > expressions. The default setting approved for GCC 12 is > -Wuse-after-free=2, which doesn't warn on such uses to accommodate > the pointer-adjustment-after-realloc idiom. At the default setting, > the changes to ldconfig.c and setenv are not necessary. Would you be able to split up this patch further? It will help with eventually backporting parts of it. Thanks, Florian