public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
@ 2022-05-12 10:23 ` siddhesh at sourceware dot org
  2022-05-12 20:03 ` ptr@void-ptr.info
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-05-12 10:23 UTC (permalink / raw)
  To: glibc-bugs

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
  2022-05-12 10:23 ` [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 siddhesh at sourceware dot org
@ 2022-05-12 20:03 ` ptr@void-ptr.info
  2022-05-13  3:44 ` ptr@void-ptr.info
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ptr@void-ptr.info @ 2022-05-12 20:03 UTC (permalink / raw)
  To: glibc-bugs

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

Petr Ovtchenkov <ptr@void-ptr.info> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.36                        |2.35

--- Comment #4 from Petr Ovtchenkov <ptr@void-ptr.info> ---
The glibc in this issue is ec5b79aac768, so c8ee1c85c07b already here.

Don't worry about distros, VCS is primary source.

glibc is on release/2.35/master, so reference to 2.36 is not correct, IMO.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
  2022-05-12 10:23 ` [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 siddhesh at sourceware dot org
  2022-05-12 20:03 ` ptr@void-ptr.info
@ 2022-05-13  3:44 ` ptr@void-ptr.info
  2022-05-13  4:02 ` siddhesh at sourceware dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ptr@void-ptr.info @ 2022-05-13  3:44 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from Petr Ovtchenkov <ptr@void-ptr.info> ---
Hmm. c8ee1c8 not correspond to diff you show above.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-05-13  4:02 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
(In reply to Petr Ovtchenkov from comment #5)
> Hmm. c8ee1c8 not correspond to diff you show above.

Ah, sorry no, they're two different things that I formatted very badly making
it seem like it's one thing.  The commit that introduced the regression:

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]

and then the one line fix for it that I'm about to post:

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-16 14:41 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=61a87530108ec9181e1b18a9b727ec3cc3ba7532

commit 61a87530108ec9181e1b18a9b727ec3cc3ba7532
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri May 13 10:01:47 2022 +0530

    fortify: Ensure that __glibc_fortify condition is a constant [BZ #29141]

    The fix c8ee1c85 introduced a -1 check for object size without also
    checking that object size is a constant.  Because of this, the tree
    optimizer passes in gcc fail to fold away one of the branches in
    __glibc_fortify and trips on a spurious Wstringop-overflow.  The warning
    itself is incorrect and the branch does go away eventually in DCE in the
    rtl passes in gcc, but the constant check is a helpful hint to simplify
    code early, so add it in.

    Resolves: BZ #29141
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-05-16 16:04 UTC (permalink / raw)
  To: glibc-bugs

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

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |2.36
         Resolution|---                         |FIXED

--- Comment #8 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-16 16:24 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.35/master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=58947e1fa593cff7b5513d5e8e0c81b0131984b4

commit 58947e1fa593cff7b5513d5e8e0c81b0131984b4
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri May 13 10:01:47 2022 +0530

    fortify: Ensure that __glibc_fortify condition is a constant [BZ #29141]

    The fix c8ee1c85 introduced a -1 check for object size without also
    checking that object size is a constant.  Because of this, the tree
    optimizer passes in gcc fail to fold away one of the branches in
    __glibc_fortify and trips on a spurious Wstringop-overflow.  The warning
    itself is incorrect and the branch does go away eventually in DCE in the
    rtl passes in gcc, but the constant check is a helpful hint to simplify
    code early, so add it in.

    Resolves: BZ #29141
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-05-16 16:24 ` cvs-commit at gcc dot gnu.org
@ 2022-05-16 17:01 ` cvs-commit at gcc dot gnu.org
  2022-05-17  4:39 ` sam at gentoo dot org
  2022-05-17  4:39 ` sam at gentoo dot org
  9 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-16 17:01 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #10 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.34/master branch has been updated by Siddhesh Poyarekar
<siddhesh@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b72bbba23687ed67887d1d18c51cce5cc9c575ca

commit b72bbba23687ed67887d1d18c51cce5cc9c575ca
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri May 13 10:01:47 2022 +0530

    fortify: Ensure that __glibc_fortify condition is a constant [BZ #29141]

    The fix c8ee1c85 introduced a -1 check for object size without also
    checking that object size is a constant.  Because of this, the tree
    optimizer passes in gcc fail to fold away one of the branches in
    __glibc_fortify and trips on a spurious Wstringop-overflow.  The warning
    itself is incorrect and the branch does go away eventually in DCE in the
    rtl passes in gcc, but the constant check is a helpful hint to simplify
    code early, so add it in.

    Resolves: BZ #29141
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
    (cherry picked from commit 61a87530108ec9181e1b18a9b727ec3cc3ba7532)

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-05-16 17:01 ` cvs-commit at gcc dot gnu.org
@ 2022-05-17  4:39 ` sam at gentoo dot org
  2022-05-17  4:39 ` sam at gentoo dot org
  9 siblings, 0 replies; 10+ messages in thread
From: sam at gentoo dot org @ 2022-05-17  4:39 UTC (permalink / raw)
  To: glibc-bugs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35
       [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-05-17  4:39 ` sam at gentoo dot org
@ 2022-05-17  4:39 ` sam at gentoo dot org
  9 siblings, 0 replies; 10+ messages in thread
From: sam at gentoo dot org @ 2022-05-17  4:39 UTC (permalink / raw)
  To: glibc-bugs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |toolchain at gentoo dot org

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-05-17  4:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-29141-131@http.sourceware.org/bugzilla/>
2022-05-12 10:23 ` [Bug libc/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 siddhesh at sourceware dot org
2022-05-12 20:03 ` 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
2022-05-17  4:39 ` sam at gentoo dot org
2022-05-17  4:39 ` sam at gentoo dot org

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).