program startup fails with "Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!"

Bug #721469 reported by Roland Dreier
90
This bug affects 17 people
Affects Status Importance Assigned to Milestone
eglibc
Fix Released
Medium
eglibc (Ubuntu)
Fix Released
Critical
Canonical Foundations Team
Natty
Fix Released
Critical
Canonical Foundations Team

Bug Description

After updating libc6, starting some programs fails ... eg for me ogg123 fails as:

$ ogg123
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

This appears to be due to http://sourceware.org/bugzilla/show_bug.cgi?id=12454

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: libc6 2.13~pre1-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-4.31-generic 2.6.38-rc5
Uname: Linux 2.6.38-4-generic x86_64
Architecture: amd64
Date: Fri Feb 18 11:12:10 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20101206)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 LC_MESSAGES=en_US.utf8
 SHELL=/bin/bash
SourcePackage: eglibc

Revision history for this message
In , octoploid (cryptooctoploid) wrote :

I've hit the following assert running glibc 2.13 on Linux x86_64:

Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

This is caused by the following commit:
http://sourceware.org/git/?p=glibc.git;a=commit;h=968dad0ab1f367a087ff4ad503b511dd0c565adc

Reverting the commit "solves" the problem.

There are two ways to reproduce the problem on my machine.

1) Trying to start sage ( http://www.sagemath.org/ )
2) Changing outputs in mpd ( http://mpd.wikia.com )

Revision history for this message
In , octoploid (cryptooctoploid) wrote :

Created attachment 5220
replace assert by if

Here's an ugly patch that fixes the issue for me.
Instead of "assert (nlist > 1);" wrap the whole while loop
with "if (nlist > 1)".

Revision history for this message
In , octoploid (cryptooctoploid) wrote :

Created attachment 5229
Don't call _dl_sort_fini if there is only one object. (part 2)

Only call _dl_sort_fini in dl-close.c if there is more than one object.

This patch fixes:

gcc -nostdlib -nostartfiles -static -o /var/tmp/glibc-build/elf/tst-tls9-static -Wl,-O1,--hash-style=gnu,--as-needed /var/tmp/glibc-build/csu/crt1.
o /var/tmp/glibc-build/csu/crti.o `gcc --print-file-name=crtbegin.o` /var/tmp/glibc-build/elf/tst-tls9-static.o /var/tmp/glibc-build/dlfcn/libdl.a
/var/tmp/glibc-build/libc.a -lgcc -lgcc_eh /var/tmp/glibc-build/libc.a `gcc --print-file-name=crtend.o` /var/tmp/glibc-build/csu/crtn.o
/var/tmp/glibc-build/elf/tst-tls9-static.o: In function `do_test':
/var/tmp/glibc/elf/tst-tls9.c:16: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc v
ersion used for linking
GCONV_PATH=/var/tmp/glibc-build/iconvdata LC_ALL=C LD_LIBRARY_PATH=/var/tmp/glibc-build/elf/:/var/tmp/glibc-build/:/var/tmp/glibc-build/dlfcn /var/t
mp/glibc-build/elf/tst-tls9-static > /var/tmp/glibc-build/elf/tst-tls9-static.out
tst-tls9-static: dl-fini.c:38: _dl_sort_fini: Assertion `nmaps > 1' failed.
Didn't expect signal from child: got `Aborted'
make[2]: *** [/var/tmp/glibc-build/elf/tst-tls9-static.out] Error 1
make[2]: Leaving directory `/var/tmp/glibc/elf'

Revision history for this message
Roland Dreier (roland.dreier) wrote :
Changed in eglibc (Ubuntu):
status: New → Confirmed
Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

I've also seen this on x86 with glibc 2.13 git trunk, where it effects the testsuite causing tst-cancel24, tst-chk4, tst-chk5, tst-chk6, tst-lfschk4, tst-lfschk5, and tst-lfschk6 to fail with "Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!".

Revision history for this message
Jeremy Foshee (jeremyfoshee) wrote :

Adjusted status and importance to Triaged and Critical.

~JFo

Changed in eglibc (Ubuntu):
importance: Undecided → Critical
status: Confirmed → Triaged
Revision history for this message
Robert Collins (lifeless) wrote :

We're stopping syncs of the affected packages.

Changed in eglibc (Ubuntu Natty):
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Revision history for this message
Colin Watson (cjwatson) wrote :

Please test 2.13-0ubuntu1~ppa2 in https://launchpad.net/~ubuntu-toolchain-r/+archive/test. This has a variation of the patches proposed in the upstream bug report.

Revision history for this message
Doug McMahon (mc3man) wrote :

The ppa packages DO work on a 64 bit install (testing by opening evolution). but don't on a 32 bit install, still get same error message there..
evolution
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

Revision history for this message
Roland Dreier (roland.dreier) wrote :

Yes, I'm able to start ogg123 with ppa packages (on 64-bit natty).

Revision history for this message
Kees Cook (kees) wrote :

@Doug: are you sure you've installed the 2.13-0ubuntu1~ppa2 version? That version does not have the assert you're reporting. Line 622 of elf/dl-deps.c reads "assert (nlist > 0);"

Revision history for this message
In , Kees Cook (kees) wrote :

Created attachment 5253
combined fixes

Here's a combined version of the fixes that doesn't mess with indenting and has the same effect.

Revision history for this message
Doug McMahon (mc3man) wrote :

> @Doug: are you sure you've installed the 2.13-0ubuntu1~ppa2 version?
you're right, for some reason I'm only getting 2.13-0ubuntu1~ppa1 on the 32 bit install, can try dl'ing the set manually, if they're actually there

Revision history for this message
Doug McMahon (mc3man) wrote :

After manually grabbing and installing evolution opens again, not sure why the ppa was giving me the ppa1 packages??
Installed these 4 manually
libc6_2.13-0ubuntu1~ppa2_i386.deb libc-bin_2.13-0ubuntu1~ppa2_i386.deb
libc6-dev_2.13-0ubuntu1~ppa2_i386.deb libc-dev-bin_2.13-0ubuntu1~ppa2_i386.deb

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package eglibc - 2.13-0ubuntu1

---------------
eglibc (2.13-0ubuntu1) natty; urgency=low

  * Upload to natty, fixing ld.so assertion on many programs (LP: #721469).
  * Replace ppc64/local-loader-no-vsx.diff with submitted version from Ryan
    S. Arnold.
 -- Colin Watson <email address hidden> Fri, 18 Feb 2011 23:43:05 +0000

Changed in eglibc (Ubuntu Natty):
status: Triaged → Fix Released
Revision history for this message
bazzdee (bazz-dee) wrote :

just updated everything. still got this error when starting chromium.browser for example

Revision history for this message
Kees Cook (kees) wrote :

@bazzdee the update has not finished building in the archive yet. You can check it here (see the "Builds" section):
https://launchpad.net/ubuntu/+source/eglibc/2.13-0ubuntu1

Changed in eglibc (Ubuntu Natty):
milestone: none → natty-alpha-3
Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

The patches attached to this issue still do not address why they are required, and what's actually wrong with the code, or why the original commit is not correct. Until those questions are addressed it is unlikely that this patch will make it into glibc.

Can anyone answer "Why?"

Revision history for this message
Fabio Marconi (fabiomarconi) wrote :

Today's updates fix for me
Thanks
Fabio

Revision history for this message
Bernhard Schmidt (berni) wrote :

This is still hitting me hard. I already updated to 2.13-0ubuntu1 and I have the same issue that most programs won't start anymore. I'm back up running using an older btrfs snapshot, but when I mount the updated volume I can't even chroot into it and start bash.

root@schleppi:/# mount -t btrfs -o subvolid=0 /dev/mapper/ssd-btrfsroot /mnt
root@schleppi:/mnt# chroot /mnt /bin/bash
Segmentation fault (core dumped)

[ 721.524347] bash[3115]: segfault at 37c9e20c58 ip 00000037c9c034ed sp 00007fff4298b9f0 error 7 in ld-2.13.so[37c9c00000+21000]

/mnt/var/lib/dpkg/status says:

Package: libc6
Status: install ok installed
Priority: required
Section: libs
Installed-Size: 10416
Maintainer: Ubuntu Core developers <email address hidden>
Architecture: amd64
Source: eglibc
Version: 2.13-0ubuntu1

Revision history for this message
David Pyke (loftwyr) wrote :

I'm not sure if this should be part of this bug or not but the new libc won't accept prelink. When the prelink runs, suddenly everything segfaults. I ran it manually to test and now I'll have to dpkg -x libc6 again.

Revision history for this message
Jörn-Ingo Weigert (joern-ingo-weigert) wrote : Re: [Bug 721469] Re: program startup fails with "Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!"

This bug was fixed since the last updates regarding ld.so

Greets,

Joern-Ingo Weigert

Am Sonntag, den 20.02.2011, 20:04 +0000 schrieb David Pyke:
> I'm not sure if this should be part of this bug or not but the new libc
> won't accept prelink. When the prelink runs, suddenly everything
> segfaults. I ran it manually to test and now I'll have to dpkg -x libc6
> again.
>

Revision history for this message
In , Andreas Schwab (schwab-linux-m68k) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

The prelinking bug is http://sourceware.org/bugzilla/show_bug.cgi?id=12489. I've uploaded a test package to the toolchain PPA, and will post here when there are binaries available to test.

Revision history for this message
Colin Watson (cjwatson) wrote :

Could people with prelinking problems please try libc6 2.13-0ubuntu2~ppa1 from https://launchpad.net/~ubuntu-toolchain-r/+archive/test? Thanks in advance.

Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

(In reply to comment #6)
> http://sourceware.org/ml/libc-hacker/2011-02/msg00002.html

Andreas,

Thanks, this helped pinpoint the defect in the sysroot I was using. Rather than getting an assert I get something useful now.

Revision history for this message
In , Others-fredlwm (others-fredlwm) wrote :

I patched glibc 2.13 git and recompiled it. I then compiled elfutils 0.152 and recompiled prelink 20101123.

Running the prelink testsuite, one test failed:

../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=./ld-linux.so.2 -vm ./reloc11
../src/prelink: ./reloc11lib1.so: Could not parse `Inconsistency detected by ld.so: dl-deps.c: 626: _dl_map_object_deps: Assertion `nlist > 1' failed!

After that, running prelink, the usual "Could not find one of the dependencies" for missing dependencies.

I have no idea why the test failed.

Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

If the prelink testsuite is failing then I recommend contacting the prelink developers and asking for their help in putting together a test case that reproduces the problem.

Until this issue has a reduced test case it's going to be difficult to determine what's wrong.

A reduced test case contains the *exact* steps to reproduce the problem, along with source, and pre-processed source.

It is not acceptable to post-process a binary and say that the post-processed binary fails. It could be a problem with the post-processing tool.

Could you please provide a reduced test case?

Thanks!

Revision history for this message
In , Others-fredlwm (others-fredlwm) wrote :

I don't know how to reproduce it without running prelink. Here, it can be reproduced with the following, extracted from the testsuite.

A file named reloc10lib4.c with just

int dummy = 24;

$ gcc -shared -O2 -nostdlib -fpic -o reloc11lib1.so reloc10lib4.c

$ prelink reloc11lib1.so
prelink: reloc11lib1.so: Could not parse `Inconsistency detected by ld.so: dl-deps.c: 626: _dl_map_object_deps: Assertion `nlist > 1' failed!'

Revision history for this message
In , Mike Frysinger (vapier) wrote :

if you `ldd` that file, do you get the same error ?

Revision history for this message
In , Others-fredlwm (others-fredlwm) wrote :

(In reply to comment #11)
> if you `ldd` that file, do you get the same error ?

Yes, so no need to have prelink.

Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

Ulrich,

Could you please verify?

This reproduces for me on trunk and 2.13 on x86.

Steps to reproduce:

cat > test.c <<EOF
int dummy=64;
EOF
gcc -shared -fpic -o libtest.so test.c

Observed output:
~~~
LD_TRACE_LOADED_OBJECTS=1 /home/carlos/build/glibc/elf/ld.so ./libtest.so
Inconsistency detected by ld.so: dl-deps.c: 626: _dl_map_object_deps: Assertion `nlist > 1' failed!
~~~

Expected output (created using system ld.so based on 2.12):
~~~
LD_TRACE_LOADED_OBJECTS=1 /lib/ld-2.12.1.so ./libtest.so
        linux-gate.so.1 => (0x00961000)
        libc.so.6 => /lib/libc.so.6 (0x0026f000)
        /lib/ld-2.12.1.so (0x00cdf000)
~~~

I have not done any analysis other than reproducing the problem.

Revision history for this message
Colin Watson (cjwatson) wrote :

I've uploaded eglibc 2.13-0ubuntu2 to natty containing the prelinking fix; binaries should be available in a few hours. Confirmation that this fixes the prelinking bug would still be appreciated.

eglibc (2.13-0ubuntu2) natty; urgency=low

  * Apply upstream patch to fix prelinking.

 -- Colin Watson <email address hidden> Wed, 23 Feb 2011 03:36:25 +0000

Revision history for this message
In , Drepper-fsp (drepper-fsp) wrote :

I used Andreas's patch which in any case is OK. If this isn't the entire fix, reopen.

Revision history for this message
In , octoploid (cryptooctoploid) wrote :

Ulrich,
did you ever run Carlos testcase before closing this bug?
Apparently not, because the bug is still present even with Andreas'
patch applied.

Without Kees' patch (testcase from comment 10):
/libx32/ld-linux-x32.so.2 --list ./reloc11lib1.so
Inconsistency detected by ld.so: dl-deps.c: 626: _dl_map_object_deps: Assertion `nlist > 1' failed!

With Kees' patch:
/libx32/ld-linux-x32.so.2 --list ./reloc11lib1.so
        statically linked

It's your code that is calling these (bogus) assertions.
Could you at least think about it for a few minutes before closing this
bug again without a real fix in six weeks (which seems to be your average
latency lately)?.

Revision history for this message
In , Jeff Chua (jeffchua) wrote :

> It's your code that is calling these (bogus) assertions.
> Could you at least think about it for a few minutes before closing this
> bug again without a real fix in six weeks (which seems to be your average
> latency lately)?.

Latest git pull (commit c6e13027abd4b9c2d694fb4d8b28ab8290ea5971) still not fixed. Applying both Octoploid's part 1 and 2 fixed Vmware 7.1.3 below:

Inconsistency detected by ld.so: dl-deps.c: 626: _dl_map_object_deps: Assertion `nlist > 1' failed!

Thanks,
Jeff

Revision history for this message
In , JVD (jason-vas-dias) wrote :

still happening with 2.13 ( GIT checkout of @2011-04-04,
'git checkout -f glibc-2.13' ) , for any shared object
for 32-bit sub-arch on x86_64, that is linked with '-nostdlib' :

1. 32-bit fails:
$ echo 'int r = 42;' > rc.c
$ gcc -m32 -shared -fPIC -o rc.so rc.c
$ /lib32/ld-2.13.so --list ./rc.so
        linux-gate.so.1 => (0xf7757000)
        libc.so.6 => /lib32/libc.so.6 (0xf75d6000)
        /lib32/ld-2.13.so (0xf7758000)
$ gcc -m32 -shared -fPIC -nostdlib -o rc.so rc.c
$ /lib32/ld-2.13.so --list ./rc.so
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

2. 64-bit (native arch) works:
$ gcc -shared -o rc.so -fPIC -nostdlib rc.c
$ ldd ./rc.so
        statically linked
$ gcc -shared -fPIC -o rc.so rc.c
$ /lib/ld-2.13.so --list ./rc.so
        linux-vdso.so.1 => (0x00007fff3a3ff000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fad662f9000)
        /lib/ld-2.13.so (0x00007fad668b5000)

Revision history for this message
In , JVD (jason-vas-dias) wrote :

Not sure if this is pertinent here, but I suspect so -
what I'm seeing is :
  o no problem if ld.so has no 'DT_RPATH' / 'DT_RPATH_LINK'
  o problem if using ld.so with non-empty DT_RPATH / DT_RPATH_LINK

$ objdump -x /lib64/ld-2.13.so | grep RPATH

^- this bug does NOT happen when using this loader:

$ echo 'int i = 42; ' > rc.c
$ gcc -o rc.so -shared -nostlib -fPIC rc.c
$ /lib64/ld-2.13.so --list ./rc.so
        statically linked

$ objdump -x /lib32/ld-2.13.so | grep RPATH
  RPATH /mnt/sda3/gcc/./gcc/32/:/mnt/sda3/gcc/./gcc/:/mnt/sda3/gcc/x86_64-pc-linux-gnu/libgcc/32:/mnt/sda3/gcc/x86_64-pc-linux-gnu/libgcc:/usr/lib32:/lib32

^- bug only happens using this loader :

$ gcc -m32 -o rc.so -shared -nostdlib -fPIC rc.c
$ /lib32/ld-2.13.so --list ./rc.so
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

Now, in order to build any ld.so at all with an RPATH, you must be
somehow disabling this bit of code :
$ diff -U0 elf/dynamic-link.h~ elf/dynamic-link.h
--- elf/dynamic-link.h~ 2011-04-08 02:03:09.000000000 +0100
+++ elf/dynamic-link.h 2011-04-07 02:59:09.000000000 +0100
@@ -208,2 +208,3 @@
- assert (info[DT_RUNPATH] == NULL);
- assert (info[DT_RPATH] == NULL);
+ /* assert (info[DT_RUNPATH] == NULL);
+ assert (info[DT_RPATH] == NULL);
+ */

Now, I remember being roundly upbraded by Uli for attempting something so
crazy, with something along the lines of "an RPATH setting for ld.so
causes so many problems for the loader it never will be supported" - but
I've been building the 32-bit sub-architecture glibc (ONLY!) for x86_64
for years with these lines commented out, hoping to find (and maybe fix?)
any problems caused, and running 32-bit freeware such as mozilla plugins
against this 32-bit loader, with no problems (except this one!) found so
far. Yes, I can see how commenting out these lines would be crazy for
a NATIVE loader, but not for a sub-architecture loader such as 32-bit
on native 64-bit or vice versa.

Changed in eglibc:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Drepper-fsp (drepper-fsp) wrote :

There is nothing to do here. If you apply patches which you've told are not acceptable and those are creating problems, then it is up to you to fix the patches you apply.

Revision history for this message
In , Mike Frysinger (vapier) wrote :

that isnt what is happening here. people are running unmodified git trees and hitting this nlist error. some people might be testing patches in an attempt to address the original problem, but those patches arent the cause.

Revision history for this message
In , JVD (jason-vas-dias) wrote :

Sorry if my previous Comment #18 in any way deterred Ulrich from applying
something like Kee's patch of Comment #4, which makes perfect sense to
me and which is really needed to fix this bug - please, Ulrich, if
you haven't already done so, apply something like attachment #5253
of Comment #4.

What happened in my case was that I first compiled the unmodified glibc-2.13
in 32-bit mode, and noticed this problem, and others caused by the sub-arch
loader not having an RPATH . So I applied my usual "allow RPATH on ld.so"
patch and rebuilt, fixing some problems, but leaving this one, which occurs when
using any non-native-system ld.so (NOT /lib/ld-linux.so.1) with '-nostdlibs' .

Revision history for this message
In , JVD (jason-vas-dias) wrote :

typo in previous Comment #21: non-native-system ld.so (NOT /lib/ld-linux.so.1) with '-nostdlibs'
                 should be : non-native-system ld.so (NOT /lib/ld-linux.so.2) with '-nostdlib'

Anyway, I'm going to be compiling the latest glibc from GIT soon , after I
build the latest stable Linux kernel, and will test with / without patch
of attachment #5253 and post results . But Ulrich, please try :
  o build an installation from unmodified source in 32-bit mode
    with LIBDIR=/lib32
Then :
  $ echo 'int an_int = 1;' > t.c; gcc -m32 -o t.so -shared -nostdlib -fPIC t.c; ldd t.so
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps: Assertion `nlist > 1' failed!

Revision history for this message
In , Drepper-fsp (drepper-fsp) wrote :

I've added a patch.

Changed in eglibc:
status: Confirmed → Fix Released
Revision history for this message
In , Carlos-systemhalted (carlos-systemhalted) wrote :

Backported this to 2.13 stable branch.

Revision history for this message
In , Jackie-rosen (jackie-rosen) wrote :

*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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