From patchwork Thu May 12 10:23:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mark at klomp dot org X-Patchwork-Id: 53835 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48E3B38485BD for ; Thu, 12 May 2022 10:24:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48E3B38485BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652351040; bh=Q1Z2Gaz/gIEYh3Ox/6TpAl68BwygHH3gly5LdBSZtBA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=XkZgaGRcNPvMYIrdTzVMDlQs7HMR8mN6yc6Y3eZvE9cguccIRlUvpss0TksXu+O7W 8kWDcufh+yAJLeRUCVR8NiQ3kvS/FVFUCYAOLwlb8Sd2Q3zQ8P2JxrRg53EZhUKViU gnkcGDAbOCHxyU4huEILtLKrKQQibRKtGzyUS5Ew= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: by sourceware.org (Postfix, from userid 48) id C6F49384F01F; Thu, 12 May 2022 10:23:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6F49384F01F To: elfutils-devel@sourceware.org Subject: [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 Date: Thu, 12 May 2022 10:23:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.36 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at sourceware dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: siddhesh at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: version product assigned_to cf_reconfirmed_on everconfirmed bug_status cc component Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: siddhesh at sourceware dot org via Elfutils-devel From: mark at klomp dot org Reply-To: siddhesh at sourceware dot org Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" https://sourceware.org/bugzilla/show_bug.cgi?id=29141 Siddhesh Poyarekar changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |2.36 Product|elfutils |glibc Assignee|unassigned at sourceware dot org |siddhesh at sourceware dot org Last reconfirmed| |2022-05-12 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED CC| |drepper.fsp at gmail dot com Component|general |libc --- Comment #3 from Siddhesh Poyarekar --- OK my __glibc_fortify macro isn't explicit enough; it must check if __osz is constant while checking for -1 so that the condition collapses correctly. The following single line change in glibc fixes it and I was able to build elfutils to completion on my Fedora rawhide box. However, could you tell me what system you're doing this build on? The glibc should need this fix for it to stumble on this issue. I had backported it to the 2.35 branch a while back, but I haven't tracked which distros synced up with this. Fedora seems to have got it only yesterday. commit c8ee1c85c07b3c9eaef46355cb1095300855e8fa Author: Joan Bruguera Date: Mon Apr 11 19:49:56 2022 +0200 misc: Fix rare fortify crash on wchar funcs. [BZ 29030] (__s), (__osz))) \ diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index f1faf8292c..1c2b044a0d 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -164,7 +164,7 @@ /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is true, or unknown (-1) */ #define __glibc_safe_or_unknown_len(__l, __s, __osz) \ - ((__osz) == (__SIZE_TYPE__) -1 \ + ((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \ || (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \