public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/26579] New: Cross-compiled glibc 2.32 results in segfault in some userspace programs
@ 2020-09-07 14:03 bneumeier at gmail dot com
  2020-09-07 14:17 ` [Bug libc/26579] " schwab@linux-m68k.org
  2020-09-08 15:44 ` bneumeier at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: bneumeier at gmail dot com @ 2020-09-07 14:03 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 26579
           Summary: Cross-compiled glibc 2.32 results in segfault in some
                    userspace programs
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: bneumeier at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 12818
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12818&action=edit
Revert init-first.c change from 783e641fbae0cd1ab32d278216247a6f793dd722

I have built a cross-toolchain with:

HOST aarch64-unknown-linux-gnu
TARGET x86_64-unknown-linux-gnu

Both build and target are running linux 5.8.0.

GCC is "gcc version 10.2.1 20200809"
ld is "GNU ld (GNU Binutils) 2.35.0.20200809"

What I find is that some programs compiled with this toolchain crash with a
segmentation fault immediately upon execution. I have observed this with the
mount and umount programs from util-linux (2.36), and with ruby (2.7.1). When I
compile mount and umount as static programs, they work fine.

I observed this issue with glibc 2.32, but not with glibc 2.31. By running a
git bisect, I traced the issue to 783e641fbae0cd1ab32d278216247a6f793dd722,
which modifies __libc_init_first to use an ELF constructor rather than _init.

I experimentally reverted the change to csu/init-first.c, and found that the
issue goes away when I do that. I'm attaching the patch I apply to do this.

My suspicion is that this issue only appears in a few cross-compilation
scenarios, but I haven't performed a huge number of experiments to see where I
can reproduce it. As mentioned earlier, I see this with HOST aarch64 and TARGET
x86_64; I do *not* see the same problem when I reverse the situation (HOST
x86_64, target aarch64).

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

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

* [Bug libc/26579] Cross-compiled glibc 2.32 results in segfault in some userspace programs
  2020-09-07 14:03 [Bug libc/26579] New: Cross-compiled glibc 2.32 results in segfault in some userspace programs bneumeier at gmail dot com
@ 2020-09-07 14:17 ` schwab@linux-m68k.org
  2020-09-08 15:44 ` bneumeier at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: schwab@linux-m68k.org @ 2020-09-07 14:17 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
Most likely your cross compiler is misconfigured, probably missing .init_array
support.

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

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

* [Bug libc/26579] Cross-compiled glibc 2.32 results in segfault in some userspace programs
  2020-09-07 14:03 [Bug libc/26579] New: Cross-compiled glibc 2.32 results in segfault in some userspace programs bneumeier at gmail dot com
  2020-09-07 14:17 ` [Bug libc/26579] " schwab@linux-m68k.org
@ 2020-09-08 15:44 ` bneumeier at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: bneumeier at gmail dot com @ 2020-09-08 15:44 UTC (permalink / raw)
  To: glibc-bugs

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

Brett Neumeier <bneumeier at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Brett Neumeier <bneumeier at gmail dot com> ---
Andreas,

Thank you for the suggestion. That is indeed the case, and removing
"--disable-initfini" from the binutils configure arguments resolves the issue.

Looking at my change history, I added --disable-initfini in Feb 2017 because ld
with .init_array support caused a similar segfault issue on MIPS targets with
some programs. I'll check to see whether I can reproduce that issue with
current versions of the toolchain components, and file a new bug if I am able
to.

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

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

end of thread, other threads:[~2020-09-08 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 14:03 [Bug libc/26579] New: Cross-compiled glibc 2.32 results in segfault in some userspace programs bneumeier at gmail dot com
2020-09-07 14:17 ` [Bug libc/26579] " schwab@linux-m68k.org
2020-09-08 15:44 ` bneumeier at gmail dot com

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