From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by sourceware.org (Postfix) with ESMTPS id E88803858407 for ; Thu, 20 Jan 2022 21:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E88803858407 Received: by mail-io1-xd34.google.com with SMTP id o9so8674556iob.3 for ; Thu, 20 Jan 2022 13:50:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=5zHrmT4kXVVZOcT1laWlS2wdXTkwlaVtekbZm7+Tq7Y=; b=gbkwqbcjvqQ1nGMjKrzIItVez0KA7uWbfAJIstY8txud/CFGQd3Xc90/ZNzTEZlNV/ FIpukf6tIrrbTKkyfuC7oAQuQ4MBRlAoYZ8WptEw10Xldz/e6lSQ7JNQ9nuFxcNUyyZK fVtZNY3G3pPOyb15qxdzrExtR3TJnU6Gd2ChxyFe0JTPEadbrjiVg33f4JHYPfcEBJA8 3f4prQ9OcPkf8Wo6/1Km0Z8xMTvxhVrhiDKlb7kFfGddLD8EVKz4RhMPnPyCeAG5AZ2j Lh0oXfmoyq01WXUiMC1dqZcpy25EbGTmnS3F1oP/daGzG4XzvYgAeBAk3S/Valx4h2uw Hy7g== X-Gm-Message-State: AOAM533l/PVmVlP+gCnyVG3VKWNCe3vOM+9TTb/vmDG/GO1h+Eszpi+r AtsdAmMCm7Sw6ggrmjK4KS0NcoIPdGs= X-Google-Smtp-Source: ABdhPJw7BpT2fhKW1hcAHUOtr9DAGCd+l30HQsG3RLyheP+szMPXCFZqPSPPccBQw0jaRuhHcMcRtw== X-Received: by 2002:a6b:591a:: with SMTP id n26mr421525iob.101.1642715416344; Thu, 20 Jan 2022 13:50:16 -0800 (PST) Received: from [192.168.0.41] (97-118-100-142.hlrn.qwest.net. [97.118.100.142]) by smtp.gmail.com with ESMTPSA id q16sm186030ion.27.2022.01.20.13.50.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jan 2022 13:50:16 -0800 (PST) Message-ID: Date: Thu, 20 Jan 2022 14:50:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] avoid -Wuse-after-free [BZ #26779] Content-Language: en-US To: Florian Weimer , Martin Sebor via Libc-alpha References: <87sftll6i0.fsf@oldenburg.str.redhat.com> From: Martin Sebor In-Reply-To: <87sftll6i0.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Thu, 20 Jan 2022 21:50:19 -0000 On 1/18/22 02:48, Florian Weimer wrote: > * 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. Sure. Let me fix the issues Paul pointed out and post a diff for each file separately. Martin > > Thanks, > Florian >