lucid gold makes nearly all C++ applications segfault before main()

Bug #582754 reported by Stewart Smith
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
binutils (Debian)
Fix Released
Unknown
binutils (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: binutils

Trying to build MySQL 5.1.46 with binutils-gold installed leads to 'gen_lex_hash' (in the mysql tree, that is run during build) to segfault.

Logs below for building Drizzle (and trying to use the resulting executable). It also segfaults.

Both of these worked fine in karmic.

removing binutils-gold at least fixes a MySQL build.

stewart@willster:~/drizzle/embedded-innodb$ LD_LIBRARY_PATH=./drizzled/message/.libs/ ./drizzled/.libs/drizzled
Segmentation fault
stewart@willster:~/drizzle/embedded-innodb$ libtool --mode=execute gdb ./drizzled/drizzled
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/stewart/drizzle/embedded-innodb/drizzled/.libs/lt-drizzled...done.
(gdb) r
Starting program: /home/stewart/drizzle/embedded-innodb/drizzled/.libs/lt-drizzled
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000a6ef40 in strlen ()
(gdb) bt
#0 0x0000000000a6ef40 in strlen ()
#1 0x00007ffff7deb89f in _dl_fixup (l=0x52feb7,
    reloc_arg=<value optimised out>) at ../elf/dl-runtime.c:148
#2 0x00007ffff7df2445 in _dl_runtime_resolve ()
    at ../sysdeps/x86_64/dl-trampoline.S:41
#3 0x00007ffff711ba40 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) ()
   from /usr/lib/libstdc++.so.6
#4 0x00007ffff7fc4d6b in MakeTypeNameTable ()
    at google/protobuf/compiler/parser.cc:64
#5 __static_initialization_and_destruction_0 ()
    at google/protobuf/compiler/parser.cc:85
#6 global constructors keyed to parser.cc ()
    at google/protobuf/compiler/parser.cc:1131
#7 0x00007ffff7fca546 in __do_global_ctors_aux ()
   from /usr/local/lib/libprotobuf.so.6
#8 0x00007ffff7fca56b in _init () from /usr/local/lib/libprotobuf.so.6
#9 0x00007ffff7e05000 in ?? ()
#10 0x00007ffff7debd35 in call_init (main_map=0x7ffff7ffe128, argc=-134262712,
    argv=0x7fffffffe218, env=0x7fffffffe228) at dl-init.c:70
#11 _dl_init (main_map=0x7ffff7ffe128, argc=-134262712, argv=0x7fffffffe218,
    env=0x7fffffffe228) at dl-init.c:134
#12 0x00007ffff7dddb2a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
warning: (Internal error: pc 0x1 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

#13 0x0000000000000001 in ?? (warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

) at ./drizzled/item/subselect.h:576
warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

#14 0x00007fffffffe50f in ?? ()
warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

#15 0x0000000000000000 in ?? ()
(gdb) q
A debugging session is active.

 Inferior 1 [process 31410] will be killed.

Quit anyway? (y or n) y
stewart@willster:~/drizzle/embedded-innodb$ LD_LIBRARY_PATH=./drizzled/message/.libs/ ldd ./drizzled/.libs/drizzled
 linux-vdso.so.1 => (0x00007fff281a9000)
 libprotobuf.so.6 => /usr/local/lib/libprotobuf.so.6 (0x00007f3a46d74000)
 libdrizzledmessage.so.0 => ./drizzled/message/.libs/libdrizzledmessage.so.0 (0x00007f3a46c98000)
 libuuid.so.1 => /lib/libuuid.so.1 (0x00007f3a46a6a000)
 libdl.so.2 => /lib/libdl.so.2 (0x00007f3a46866000)
 libz.so.1 => /lib/libz.so.1 (0x00007f3a4664f000)
 libpcre.so.3 => /lib/libpcre.so.3 (0x00007f3a46420000)
 librt.so.1 => /lib/librt.so.1 (0x00007f3a46218000)
 libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3a45f04000)
 libm.so.6 => /lib/libm.so.6 (0x00007f3a45c80000)
 libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f3a45a69000)
 libpthread.so.0 => /lib/libpthread.so.0 (0x00007f3a4584c000)
 libc.so.6 => /lib/libc.so.6 (0x00007f3a454c9000)
 /lib64/ld-linux-x86-64.so.2 (0x00007f3a46e62000)
stewart@willster:~/drizzle/embedded-innodb$

Revision history for this message
Guillaume Melquiond (guillaume-melquiond) wrote :

It is worse for me. Absolutely no applications, be they C++ or C, are linked properly. Consider this small example:

#include <stdio.h>
#include <string.h>

__attribute__((noinline))
int f(const char *a, const char *b) { return strcmp(a, b); }

int main() { printf("%x\n", f("foo", "bar")); }

If you compile it dynamically, you get a segfault due to strcmp being placed in a non-executable page.
If you compile it statically, you get the address of function _libc_start instead of executing strcmp.

Same thing happens with strlen et al, which explains that all applications a bit complicated will segfault before even reaching main (due to dynamic loading relying on strlen).

This is on Lucid Lynx with binutils 2.20.1-3ubuntu5 on amd64. It was working fine on Karmic.

Revision history for this message
George (gnwiii) wrote :

For me, many C programs compiled on lucid amd64 with binutils-gold, (starting with a pre-release and continuing thru updates) gave SIGSEGV on one of the str functions. There is no problem on a fresh install of lucid (amd64) with the normal binutils. From 'ld --version' on the two installs:

Works: GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303

Fails: GNU gold (GNU Binutils for Ubuntu 2.20.1-system.20100303) 1.9

Revision history for this message
Matthias Klose (doko) wrote :

fixed in maverick

Changed in binutils (Ubuntu):
status: New → Fix Released
Changed in binutils (Ubuntu Lucid):
status: New → In Progress
Changed in binutils (Debian):
status: Unknown → Confirmed
Changed in binutils (Debian):
status: Confirmed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted binutils into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in binutils (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Justin Lebar (jlebar) wrote :

The proposed package works for me. Note to others: you need to install the proposed version of both binutils and binutils-gold. I ran

    apt-get install binutils/lucid-proposed binutils-gold/lucid-proposed

Martin Pitt (pitti)
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils - 2.20.1-3ubuntu6

---------------
binutils (2.20.1-3ubuntu6) lucid-proposed; urgency=low

  * Apply proposed patch for ARM: Add option to disable merging of adjacent
    exidx unwinder entries. Addresses PR libgcj/40860. LP: #593564.
  * Fix PR gold/10893, IFUNC support for gold backported from the trunk.
    LP: #582754.
 -- Matthias Klose <email address hidden> Mon, 14 Jun 2010 10:18:35 +0200

Changed in binutils (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.