public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "alex_y_xu at yahoo dot ca" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/28453] New: ld.so segfaults when relocating x86 libstdc++.so compiled with -fno-plt
Date: Fri, 15 Oct 2021 00:45:47 +0000	[thread overview]
Message-ID: <bug-28453-131@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2021-10-15  0:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  0:45 alex_y_xu at yahoo dot ca [this message]
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

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-28453-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).