Bug 11577 - LD_DEBUG=versions causes segfault on binaries with unsatisfied version dependencies
Summary: LD_DEBUG=versions causes segfault on binaries with unsatisfied version depend...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 11:47 UTC by ygrek
Modified: 2014-06-30 18:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
proposed patch (244 bytes, patch)
2010-05-07 11:48 UTC, ygrek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ygrek 2010-05-07 11:47:05 UTC
$ ./app
./app: /usr/lib/libcurl-gnutls.so.4: no version information available (required by ./app)
$ LD_DEBUG=versions ./app
      4646:	checking for version `GLIBC_2.2' in file /lib/librt.so.1 [0] required by file ./app [0]
      4646:	checking for version `GLIBC_2.0' in file /lib/libdl.so.2 [0] required by file ./app [0]
      4646:	checking for version `GLIBC_2.1' in file /lib/libdl.so.2 [0] required by file ./app [0]
      4646:	checking for version `GLIBC_2.1' in file /lib/libm.so.6 [0] required by file ./app [0]
      4646:	checking for version `GLIBC_2.0' in file /lib/libm.so.6 [0] required by file ./app [0]
      4646:	checking for version `libmysqlclient_15' in file /usr/lib/mysql/libmysqlclient.so.15 [0] required 
by file ./app [0]
      4646:	checking for version `CURL_GNUTLS_3' in file /usr/lib/libcurl-gnutls.so.4 [0] required by file ./
app [0]
Segmentation fault

gdb shows:

Program received signal SIGSEGV, Segmentation fault.
0x002a89a3 in strlen () from /lib/ld-linux.so.2
(gdb) bt
#0  0x002a89a3 in strlen () from /lib/ld-linux.so.2
#1  0x002a1e16 in _dl_debug_vdprintf () from /lib/ld-linux.so.2
#2  0x002a1efe in _dl_debug_printf () from /lib/ld-linux.so.2
#3  0x002a118f in _dl_signal_cerror () from /lib/ld-linux.so.2
#4  0x002a2162 in match_symbol () from /lib/ld-linux.so.2
#5  0x002a2522 in _dl_check_map_versions () from /lib/ld-linux.so.2
#6  0x002a284d in _dl_check_all_versions () from /lib/ld-linux.so.2
#7  0x0029559d in version_check_doit () from /lib/ld-linux.so.2
#8  0x002a0dce in _dl_receive_error () from /lib/ld-linux.so.2
#9  0x0029658f in dl_main () from /lib/ld-linux.so.2
#10 0x002a6ffb in _dl_sysdep_start () from /lib/ld-linux.so.2
#11 0x002942b8 in _dl_start () from /lib/ld-linux.so.2
#12 0x00293817 in _start () from /lib/ld-linux.so.2

This is on CentOS 5.4 i686 with glibc 2.5, but judging from the code bug is still present in git trunk.
Patch:

diff --git elf/dl-version.c elf/dl-version.c
index c59a6c3..3df8ebe 100644
--- elf/dl-version.c
+++ elf/dl-version.c
@@ -169,7 +169,7 @@ no version information available (required by ", name, ")");
   result = 1;
  call_cerror:
   _dl_signal_cerror (0, map->l_name[0] ? map->l_name : rtld_progname,
-                    NULL, errstring);
+                    N_("version error"), errstring);
   return result;
 }
 
PS: And it would have been really helpful if patch from bug #794 was committed thus preventing 
crash..
Comment 1 ygrek 2010-05-07 11:48:49 UTC
Created attachment 4772 [details]
proposed patch

sorry, attaching patch as file
Comment 2 Ulrich Drepper 2011-05-30 01:34:11 UTC
This bug has been fixed a while ago.