public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "siddhesh at sourceware dot org" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-29141-10460-4N8dEqLzno@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29141-10460@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29141

Siddhesh Poyarekar <siddhesh at sourceware dot org> 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 <siddhesh at sourceware dot org> ---
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 <joanbrugueram@gmail.com>
Date:   Mon Apr 11 19:49:56 2022 +0200

    misc: Fix rare fortify crash on wchar funcs. [BZ 29030]



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),
\
                                                       (__s), (__osz)))       \

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-05-12 10:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11  8:12 [Bug general/29141] New: " ptr@void-ptr.info
2022-05-11 11:10 ` [Bug general/29141] " mark at klomp dot org
2022-05-11 16:04 ` siddhesh at sourceware dot org
2022-05-12 10:23 ` siddhesh at sourceware dot org [this message]
2022-05-12 20:03 ` [Bug libc/29141] " ptr@void-ptr.info
2022-05-13  3:44 ` ptr@void-ptr.info
2022-05-13  4:02 ` siddhesh at sourceware dot org
2022-05-16 14:41 ` cvs-commit at gcc dot gnu.org
2022-05-16 16:04 ` siddhesh at sourceware dot org
2022-05-16 16:24 ` cvs-commit at gcc dot gnu.org
2022-05-16 17:01 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29141-10460-4N8dEqLzno@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).