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

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