public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
@ 2021-10-15  0:45 alex_y_xu at yahoo dot ca
  2021-10-25  1:23 ` [Bug dynamic-link/28453] " sam at gentoo dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-10-15  0:45 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 28453
           Summary: ld.so segfaults when relocating x86 libstdc++.so
                    compiled with -fno-plt
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: alex_y_xu at yahoo dot ca
  Target Milestone: ---

Created attachment 13721
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13721&action=edit
x86 libstdc++.so.6.0.29 -fno-plt

after compiling gcc with -fno-plt, all c++ programs on x86 crash while
starting. I found that this is caused by SIGSEGV due to null dereference around
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/i386/dl-machine.h;hb=9d3c9a046a2d7cfc9cad18675612e5916c65d7d7#l78.
I can't recall 100% but I believe l->l_info[DT_PLTGOT] is NULL.

this can be reproduced by invoking ld-linux.so.2 on the attached file. invoking
it with LD_DEBUG=all results in printing "relocation processing:
./libstdc++.so.6.0.29 (lazy)", then segfaulting when accessing 0x4, whereas the
expected behavior would be printing "calling init: [library]" then segfaulting.

programs run successfully if LD_BIND_NOW=1 is set. normally, this issue should
not occur, since -fno-plt is usually paired with -Wl,-z,now. however, gcc
ignores LDFLAGS for this library, causing ld to default to lazy.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
@ 2021-10-25  1:23 ` sam at gentoo dot org
  2021-11-17  8:43 ` fweimer at redhat dot com
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: sam at gentoo dot org @ 2021-10-25  1:23 UTC (permalink / raw)
  To: glibc-bugs

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

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] 17+ messages in thread

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
  2021-10-25  1:23 ` [Bug dynamic-link/28453] " sam at gentoo dot org
@ 2021-11-17  8:43 ` fweimer at redhat dot com
  2021-11-17 13:09 ` hjl.tools at gmail dot com
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: fweimer at redhat dot com @ 2021-11-17  8:43 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com,
                   |                            |hjl.tools at gmail dot com
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Apparently we can have PT_JUMPREL without a GOT, solely consisting of TLSDESC
relocations. The binary looks valid to me. Which means that glibc indeed needs
fixing. H.J.?

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
  2021-10-25  1:23 ` [Bug dynamic-link/28453] " sam at gentoo dot org
  2021-11-17  8:43 ` fweimer at redhat dot com
@ 2021-11-17 13:09 ` hjl.tools at gmail dot com
  2021-11-17 13:31 ` alex_y_xu at yahoo dot ca
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-17 13:09 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Which linker is used to generate such library?

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (2 preceding siblings ...)
  2021-11-17 13:09 ` hjl.tools at gmail dot com
@ 2021-11-17 13:31 ` alex_y_xu at yahoo dot ca
  2021-11-17 14:10 ` hjl.tools at gmail dot com
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-11-17 13:31 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from alex_y_xu at yahoo dot ca ---
(In reply to H.J. Lu from comment #2)
> Which linker is used to generate such library?

I used binutils 2.37 bfd provided by Gentoo and compiled without vanilla USE
flag (i.e. compiled *with* Gentoo patches) when building gcc. gold is not
installed.

My system-wide LDFLAGS are
-Wl,--as-needed,-O1,--hash-style=gnu,-z,relro,-z,now, but as explained in the
description, I believe they are ignored when linking this library.
Additionally, gcc is built with lto using --with-build-config=bootstrap-lto.

Let me know if you need some other information.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (3 preceding siblings ...)
  2021-11-17 13:31 ` alex_y_xu at yahoo dot ca
@ 2021-11-17 14:10 ` hjl.tools at gmail dot com
  2021-11-17 14:17 ` fweimer at redhat dot com
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-17 14:10 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
I built libstdc++ with -fno-plt and

-Wl,--as-needed,-O1,--hash-style=gnu,-z,relro,-z,now

using bfd linker.  I got

Dynamic section at offset 0x203c40 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x000000000000000e (SONAME)             Library soname: [libstdc++.so.6]
 0x000000000000000c (INIT)               0x99000
 0x000000000000000d (FINI)               0x18de44
 0x0000000000000019 (INIT_ARRAY)         0x1fb898
 0x000000000000001b (INIT_ARRAYSZ)       96 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x1fb8f8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x2a8
 0x0000000000000005 (STRTAB)             0x2d120
 0x0000000000000006 (SYMTAB)             0x9000
 0x000000000000000a (STRSZ)              301565 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x204e50
 0x0000000000000007 (RELA)               0x7a340
 0x0000000000000008 (RELASZ)             124464 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffc (VERDEF)             0x79b38
 0x000000006ffffffd (VERDEFNUM)          48
 0x0000000000000018 (BIND_NOW)           
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x000000006ffffffe (VERNEED)            0x7a1d0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x76b1e
 0x000000006ffffff9 (RELACOUNT)          892
 0x0000000000000000 (NULL)               0x0

Please pass "-Wl,--verbose" to GCC to identify the linker used.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (4 preceding siblings ...)
  2021-11-17 14:10 ` hjl.tools at gmail dot com
@ 2021-11-17 14:17 ` fweimer at redhat dot com
  2021-11-17 14:39 ` alex_y_xu at yahoo dot ca
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: fweimer at redhat dot com @ 2021-11-17 14:17 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
I suspect this needs -mtls-dialect=gnu2 to materialize.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (5 preceding siblings ...)
  2021-11-17 14:17 ` fweimer at redhat dot com
@ 2021-11-17 14:39 ` alex_y_xu at yahoo dot ca
  2021-11-17 14:58 ` hjl.tools at gmail dot com
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-11-17 14:39 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #6 from alex_y_xu at yahoo dot ca ---
Created attachment 13792
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13792&action=edit
gcc-11.2.0:20210904-232553.log.xz

I am not sure how to build only libstdc++. I have attached my gcc build log,
including GNU ld version printed by portage and the full link command, as
excerpted below.

libtool: link:  /tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/xgcc
-shared-libgcc -B/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc -nostdinc++
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem
/usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include 
 -fno-checking  -fPIC -DPIC -D_GLIBCXX_SHARED -shared -nostdlib
/usr/lib/../lib64/crti.o
/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/crtbeginS.o 
.libs/compatibility.o .libs/compatibility-debug_list.o
.libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
.libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
.libs/compatibility-chrono.o .libs/compatibility-condvar.o  -Wl,--whole-archive
../libsupc++/.libs/libsupc++convenience.a
../src/c++98/.libs/libc++98convenience.a
../src/c++11/.libs/libc++11convenience.a
../src/c++17/.libs/libc++17convenience.a
../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole-archive 
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src
-L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-lm -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc
-L/usr/x86_64-pc-linux-gnu/bin -L/usr/x86_64-pc-linux-gnu/lib -L/lib/../lib64
-L/usr/lib/../lib64 -lc -lgcc_s
/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/crtendS.o
/usr/lib/../lib64/crtn.o  -Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections
-Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname -Wl,libstdc++.so.6 -o
.libs/libstdc++.so.6.0.29

Note that -Wl,-O1 -Wl,-z,relro are specified but -Wl,-z,now is not, even though
it is used for other libraries (e.g. libgomp, liblto_plugin, libgcc_s).

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (6 preceding siblings ...)
  2021-11-17 14:39 ` alex_y_xu at yahoo dot ca
@ 2021-11-17 14:58 ` hjl.tools at gmail dot com
  2021-11-17 14:59 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-17 14:58 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Florian Weimer from comment #5)
> I suspect this needs -mtls-dialect=gnu2 to materialize.

I got

Dynamic section at offset 0x2015c0 contains 31 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x0000000e (SONAME)                     Library soname: [libstdc++.so.6]
 0x0000000c (INIT)                       0x78000
 0x0000000d (FINI)                       0x17c9cc
 0x00000019 (INIT_ARRAY)                 0x1fd96c
 0x0000001b (INIT_ARRAYSZ)               48 (bytes)
 0x0000001a (FINI_ARRAY)                 0x1fd99c
 0x0000001c (FINI_ARRAYSZ)               4 (bytes)
 0x6ffffef5 (GNU_HASH)                   0x194
 0x00000005 (STRTAB)                     0x20b30
 0x00000006 (SYMTAB)                     0x8e00
 0x0000000a (STRSZ)                      299702 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0x2026d8
 0x00000002 (PLTRELSZ)                   24 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x77794
 0x00000011 (REL)                        0x6d5c4
 0x00000012 (RELSZ)                      41424 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffc (VERDEF)                     0x6cd8c
 0x6ffffffd (VERDEFNUM)                  48
 0x00000018 (BIND_NOW)                   
 0x6ffffffb (FLAGS_1)                    Flags: NOW
 0x6ffffffe (VERNEED)                    0x6d424
 0x6fffffff (VERNEEDNUM)                 3
 0x6ffffff0 (VERSYM)                     0x69de6
 0x6ffffffa (RELCOUNT)                   904
 0x00000000 (NULL)                       0x0

I couldn't reproduce the issue on Fedora 35.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (7 preceding siblings ...)
  2021-11-17 14:58 ` hjl.tools at gmail dot com
@ 2021-11-17 14:59 ` hjl.tools at gmail dot com
  2021-11-17 16:05 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-17 14:59 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to alex_y_xu from comment #6)
> Created attachment 13792 [details]
> gcc-11.2.0:20210904-232553.log.xz
> 
> I am not sure how to build only libstdc++. I have attached my gcc build log,
> including GNU ld version printed by portage and the full link command, as
> excerpted below.
> 
> libtool: link:  /tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/xgcc
> -shared-libgcc -B/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc
> -nostdinc++
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/src
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/src/.libs
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/libsupc++/.libs -B/usr/x86_64-pc-linux-gnu/bin/
> -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include
> -isystem /usr/x86_64-pc-linux-gnu/sys-include   -fno-checking  -fPIC -DPIC
> -D_GLIBCXX_SHARED -shared -nostdlib /usr/lib/../lib64/crti.o
> /tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/crtbeginS.o 
> .libs/compatibility.o .libs/compatibility-debug_list.o
> .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> .libs/compatibility-chrono.o .libs/compatibility-condvar.o 
> -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a
> ../src/c++98/.libs/libc++98convenience.a
> ../src/c++11/.libs/libc++11convenience.a
> ../src/c++17/.libs/libc++17convenience.a
> ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole-archive 
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/libsupc++/.libs
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/src
> -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/x86_64-pc-linux-gnu/libstdc++-
> v3/src/.libs -lm -L/tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc
> -L/usr/x86_64-pc-linux-gnu/bin -L/usr/x86_64-pc-linux-gnu/lib
> -L/lib/../lib64 -L/usr/lib/../lib64 -lc -lgcc_s
> /tmp/portage/sys-devel/gcc-11.2.0/work/build/./gcc/crtendS.o
> /usr/lib/../lib64/crtn.o  -Wl,-O1 -Wl,-z -Wl,relro -Wl,--gc-sections
> -Wl,--version-script=libstdc++-symbols.ver   -Wl,-soname -Wl,libstdc++.so.6
> -o .libs/libstdc++.so.6.0.29
> 
> Note that -Wl,-O1 -Wl,-z,relro are specified but -Wl,-z,now is not, even
> though it is used for other libraries (e.g. libgomp, liblto_plugin,
> libgcc_s).

Please provide ALL linker inputs so that I can reproduce libstdc++.so on
Fedora 35.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (8 preceding siblings ...)
  2021-11-17 14:59 ` hjl.tools at gmail dot com
@ 2021-11-17 16:05 ` hjl.tools at gmail dot com
  2021-12-09 17:47 ` alex_y_xu at yahoo dot ca
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-11-17 16:05 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
You can pass "--dependency-file FILE" to linker to collect ALL linker
input files.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (9 preceding siblings ...)
  2021-11-17 16:05 ` hjl.tools at gmail dot com
@ 2021-12-09 17:47 ` alex_y_xu at yahoo dot ca
  2021-12-09 17:51 ` alex_y_xu at yahoo dot ca
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-12-09 17:47 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #10 from alex_y_xu at yahoo dot ca ---
Reproduction instructions from scratch:

0. Install gcc 11.2.0 (unsure if Gentoo patches have an effect) on x86_64.
1. Download and extract gcc 11.2.0 (without any patches).
2. export CFLAGS='-O2 -fno-align-jumps -fno-align-functions -fno-align-loops
-fno-align-labels -fgcse-after-reload -floop-interchange -fpeel-loops
-fpredictive-commoning -ftree-loop-vectorize -ftree-partial-pre
-ftree-slp-vectorize -fgraphite-identity -floop-nest-optimize
-fdevirtualize-at-ltrans -fno-semantic-interposition -march=native -fno-plt
-mtls-dialect=gnu2 -pipe'; export CXXFLAGS="$CFLAGS" LDFLAGS='-Wl,--sort-common
-Wl,-O1 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now'; ./configure
--disable-bootstrap --enable-lto && make all-target-libstdc++-v3
3. Examine file
./x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6.0.29.

I cannot attach the dependencies as it exceeds the file size limit, even after
excluding libc and compressing with xz -9e.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (10 preceding siblings ...)
  2021-12-09 17:47 ` alex_y_xu at yahoo dot ca
@ 2021-12-09 17:51 ` alex_y_xu at yahoo dot ca
  2021-12-10  2:32 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-12-09 17:51 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #11 from alex_y_xu at yahoo dot ca ---
Created attachment 13839
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13839&action=edit
libstdc++.so deps excluding libc, crtbegin/end, libgcc

Attached is a subset of the dependencies that will fit within the size limit.

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (11 preceding siblings ...)
  2021-12-09 17:51 ` alex_y_xu at yahoo dot ca
@ 2021-12-10  2:32 ` hjl.tools at gmail dot com
  2021-12-10 16:02 ` alex_y_xu at yahoo dot ca
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-12-10  2:32 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Version|unspecified                 |2.34

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
A patch is posted at

https://sourceware.org/pipermail/libc-alpha/2021-December/133943.html

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (12 preceding siblings ...)
  2021-12-10  2:32 ` hjl.tools at gmail dot com
@ 2021-12-10 16:02 ` alex_y_xu at yahoo dot ca
  2021-12-10 19:55 ` hjl.tools at gmail dot com
  2021-12-28 17:32 ` alex_y_xu at yahoo dot ca
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-12-10 16:02 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #13 from alex_y_xu at yahoo dot ca ---
Although I have not tested it, the linked patch does not appear to resolve this
issue. While I think the patch is a good idea, this issue is not actually about
invoking ld.so directly on the library. All programs linked against this
library also segfault on execution.

$ docker run -it --rm fedora
[ ... ]
# dnf install g++ glibc-devel.i686 libstdc++-devel.i686
[ ... ]
# curl -o libstdc++.so.6
https://sourceware.org/bugzilla/attachment.cgi?id=13721
[ ... ]
# echo 'int main() {}' | g++ -m32 -x c++ -
# ./a.out; echo $?
0
# LD_LIBRARY_PATH=. ./a.out; echo $?
Segmentation fault (core dumped)
139

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (13 preceding siblings ...)
  2021-12-10 16:02 ` alex_y_xu at yahoo dot ca
@ 2021-12-10 19:55 ` hjl.tools at gmail dot com
  2021-12-28 17:32 ` alex_y_xu at yahoo dot ca
  15 siblings, 0 replies; 17+ messages in thread
From: hjl.tools at gmail dot com @ 2021-12-10 19:55 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to alex_y_xu from comment #13)
> Although I have not tested it, the linked patch does not appear to resolve
> this issue. While I think the patch is a good idea, this issue is not
> actually about invoking ld.so directly on the library. All programs linked
> against this library also segfault on execution.
> 
> $ docker run -it --rm fedora
> [ ... ]
> # dnf install g++ glibc-devel.i686 libstdc++-devel.i686
> [ ... ]
> # curl -o libstdc++.so.6
> https://sourceware.org/bugzilla/attachment.cgi?id=13721
> [ ... ]
> # echo 'int main() {}' | g++ -m32 -x c++ -
> # ./a.out; echo $?
> 0
> # LD_LIBRARY_PATH=. ./a.out; echo $?
> Segmentation fault (core dumped)
> 139

Try:

https://sourceware.org/pipermail/libc-alpha/2021-December/134004.html

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

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

* [Bug dynamic-link/28453] ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
  2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
                   ` (14 preceding siblings ...)
  2021-12-10 19:55 ` hjl.tools at gmail dot com
@ 2021-12-28 17:32 ` alex_y_xu at yahoo dot ca
  15 siblings, 0 replies; 17+ messages in thread
From: alex_y_xu at yahoo dot ca @ 2021-12-28 17:32 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #15 from alex_y_xu at yahoo dot ca ---
(In reply to H.J. Lu from comment #14)
> (In reply to alex_y_xu from comment #13)
> > Although I have not tested it, the linked patch does not appear to resolve
> > this issue. While I think the patch is a good idea, this issue is not
> > actually about invoking ld.so directly on the library. All programs linked
> > against this library also segfault on execution.
> > 
> > $ docker run -it --rm fedora
> > [ ... ]
> > # dnf install g++ glibc-devel.i686 libstdc++-devel.i686
> > [ ... ]
> > # curl -o libstdc++.so.6
> > https://sourceware.org/bugzilla/attachment.cgi?id=13721
> > [ ... ]
> > # echo 'int main() {}' | g++ -m32 -x c++ -
> > # ./a.out; echo $?
> > 0
> > # LD_LIBRARY_PATH=. ./a.out; echo $?
> > Segmentation fault (core dumped)
> > 139
> 
> Try:
> 
> https://sourceware.org/pipermail/libc-alpha/2021-December/134004.html

I wasn't able to apply this to glibc 2.34 or glibc master. Are you sure it will
fix the issue of a.out crashing in the above example?

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

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

end of thread, other threads:[~2021-12-28 17:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15  0:45 [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt alex_y_xu at yahoo dot ca
2021-10-25  1:23 ` [Bug dynamic-link/28453] " sam at gentoo dot org
2021-11-17  8:43 ` fweimer at redhat dot com
2021-11-17 13:09 ` hjl.tools at gmail dot com
2021-11-17 13:31 ` alex_y_xu at yahoo dot ca
2021-11-17 14:10 ` hjl.tools at gmail dot com
2021-11-17 14:17 ` fweimer at redhat dot com
2021-11-17 14:39 ` alex_y_xu at yahoo dot ca
2021-11-17 14:58 ` hjl.tools at gmail dot com
2021-11-17 14:59 ` hjl.tools at gmail dot com
2021-11-17 16:05 ` hjl.tools at gmail dot com
2021-12-09 17:47 ` alex_y_xu at yahoo dot ca
2021-12-09 17:51 ` alex_y_xu at yahoo dot ca
2021-12-10  2:32 ` hjl.tools at gmail dot com
2021-12-10 16:02 ` alex_y_xu at yahoo dot ca
2021-12-10 19:55 ` hjl.tools at gmail dot com
2021-12-28 17:32 ` alex_y_xu at yahoo dot ca

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