From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 39E3E3857C4C for ; Tue, 25 Jan 2022 00:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39E3E3857C4C Received: by mail-il1-x12b.google.com with SMTP id i14so15460447ila.11 for ; Mon, 24 Jan 2022 16:58:02 -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:from:to:references:in-reply-to; bh=qQWVhREFhanTEBJoeTIaSLi50ZqZ+PysrXoOg2STI9s=; b=1u9dwZNRFQtqEcOHrNLg2minSCJcnSysmDNM9xx62lkX9JBhmtrHVpNRLFW/N49U6y PCadYUR3UvSavrdMtzQuYQweWV+OxcozVe+p96oR3KPWEFY4YVUQtjQZ+MRrVeDGXlxK NK5IiWUndLQk2/17HbpVFpEZ2zLoUzEtVJ0JnT1FEFVmXQ1xMnvvjDvDVZQNU09qaDL+ fle3teyeXU92D0KIxSB9Kq43063aWHXs0T3rt15CuTP/eeKZcPbl7qSOrGp/ld8BTPxu IX2yNWKGux2kjAryIOFLidN7FeF4AF4YPXCKI8+JbBKuYzQGsZ7jWRb4LmDZaOGMrGfc zYbw== X-Gm-Message-State: AOAM533LIN5zMZ0OSNiqSwFw4EdpEn1hUk0nvql/+iXWNI5/BrPf8K5D q6B7KkrkZcmi52N/mCYWAyatqdAjlvI= X-Google-Smtp-Source: ABdhPJxGyL9FMHCMfvSpvyvN4JpeuL5nB6f9Q++l/Ll3c6MIKGse13rsZuWyGqQTESICWzqjGH5C6A== X-Received: by 2002:a05:6e02:148d:: with SMTP id n13mr10275085ilk.16.1643072281610; Mon, 24 Jan 2022 16:58:01 -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 h3sm6925858ioe.19.2022.01.24.16.58.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jan 2022 16:58:01 -0800 (PST) Content-Type: multipart/mixed; boundary="------------5PLsFbB2M4n0kSE7qANjzGRv" Message-ID: Date: Mon, 24 Jan 2022 17:58:00 -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 v2 2/5] avoid -Wuse-after-free [BZ #26779] Content-Language: en-US From: Martin Sebor To: libc-alpha@sourceware.org References: <53f20975-a2c9-674d-2a43-b1b323ee545c@gmail.com> In-Reply-To: <53f20975-a2c9-674d-2a43-b1b323ee545c@gmail.com> X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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: Tue, 25 Jan 2022 00:58:03 -0000 This is a multi-part message in MIME format. --------------5PLsFbB2M4n0kSE7qANjzGRv Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/24/22 17:52, Martin Sebor wrote: > This is a repost of the original patch but broken down by source > file and with some suppression done by #pragma GCC diagnostic > instead of conversion to intptr_t.  It also adds fixes for > the same problem in the test suite that I overlooked before. The attached patch suppresses the -Wuse-after-free instance in intl/localealias.c. > > On 1/15/22 17:21, Martin Sebor wrote: >> 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. >> >> Martin > --------------5PLsFbB2M4n0kSE7qANjzGRv Content-Type: text/x-patch; charset=UTF-8; name="glibc-26779-2.diff" Content-Disposition: attachment; filename="glibc-26779-2.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2ludGwvbG9jYWxlYWxpYXMuYyBiL2ludGwvbG9jYWxlYWxpYXMuYwpp bmRleCAzYWUzNjBmNDBkLi5iMzYwOTIzNjNhIDEwMDY0NAotLS0gYS9pbnRsL2xvY2FsZWFs aWFzLmMKKysrIGIvaW50bC9sb2NhbGVhbGlhcy5jCkBAIC0zMTgsNyArMzE4LDE1IEBAIHJl YWRfYWxpYXNfZmlsZSAoY29uc3QgY2hhciAqZm5hbWUsIGludCBmbmFtZV9sZW4pCiAKIAkJ ICBpZiAoc3RyaW5nX3NwYWNlX2FjdCArIGFsaWFzX2xlbiArIHZhbHVlX2xlbiA+IHN0cmlu Z19zcGFjZV9tYXgpCiAJCSAgICB7Ci0JCSAgICAgIC8qIEluY3JlYXNlIHNpemUgb2YgbWVt b3J5IHBvb2wuICAqLworI3ByYWdtYSBHQ0MgZGlhZ25vc3RpYyBwdXNoCisKKyNpZiBkZWZp bmVkIF9fR05VQ19fICYmIF9fR05VQ19fID49IDEyCisgIC8qIFN1cHByZXNzIHRoZSB2YWxp ZCBHQ0MgMTIgd2FybmluZyB1bnRpbCB0aGUgY29kZSBiZWxvdyBpcyBjaGFuZ2VkCisgICAg IHRvIGF2b2lkIHVzaW5nIH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