[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ldd misreports some apps as not dynamic
From: |
Jeff Bailey |
Subject: |
Re: ldd misreports some apps as not dynamic |
Date: |
Wed, 17 Oct 2001 08:17:52 -0700 |
User-agent: |
Mutt/1.2.5i |
On Wed, Oct 17, 2001 at 04:11:00AM -0400, Roland McGrath wrote:
As before "./mutt" (the working one) is the one on top, and "./main"
(the not working one) is the one of bottom.
> See if you can get anything telling out of LD_DEBUG before you look too
> hard with gdb. LD_DEBUG=help .../ld.so --verify should show you the options.
With the ./main, I set LD_DEBUG to bindings, files, libs, reloc,
statistics, symbols and versions. They all fail with:
./main: error while loading shared libraries: ./main: failed to map segment
from shared object: Error 1073741869
> Also, show us objdump --private-headers of both executables.
> This is a good thing to always include when the dynamic linker is involved.
mutt: file format elf32-i386
Program Header:
PHDR off 0x00000034 vaddr 0x08048034 paddr 0x08048034 align 2**2
filesz 0x000000c0 memsz 0x000000c0 flags r-x
INTERP off 0x000000f4 vaddr 0x080480f4 paddr 0x080480f4 align 2**0
filesz 0x0000000b memsz 0x0000000b flags r--
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
filesz 0x00071100 memsz 0x00071100 flags r-x
LOAD off 0x00071100 vaddr 0x080ba100 paddr 0x080ba100 align 2**12
filesz 0x00004874 memsz 0x00005580 flags rw-
DYNAMIC off 0x000758c4 vaddr 0x080be8c4 paddr 0x080be8c4 align 2**2
filesz 0x000000b0 memsz 0x000000b0 flags rw-
NOTE off 0x00000100 vaddr 0x08048100 paddr 0x08048100 align 2**2
filesz 0x00000020 memsz 0x00000020 flags r--
Dynamic Section:
NEEDED libncurses.so.5
NEEDED libsasl.so.7
NEEDED libc.so.0.2
INIT 0x804a744
FINI 0x80a7860
HASH 0x8048120
STRTAB 0x804960c
SYMTAB 0x80487cc
STRSZ 0x842
SYMENT 0x10
DEBUG 0x0
PLTGOT 0x80be594
PLTRELSZ 0x630
PLTREL 0x11
JMPREL 0x804a114
REL 0x804a05c
RELSZ 0xb8
RELENT 0x8
VERNEED 0x804a02c
VERNEEDNUM 0x1
VERSYM 0x8049e62
Version References:
required from libc.so.0.2:
0x0d696911 0x00 03 GLIBC_2.1
0x0d696910 0x00 02 GLIBC_2.0
main: file format elf32-i386
Program Header:
PHDR off 0x00000034 vaddr 0x08048034 paddr 0x08048034 align 2**2
filesz 0x000000c0 memsz 0x000000c0 flags r-x
INTERP off 0x000000f4 vaddr 0x080480f4 paddr 0x080480f4 align 2**0
filesz 0x0000000b memsz 0x0000000b flags r--
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
filesz 0x000005b4 memsz 0x000005b4 flags r-x
LOAD off 0x000005b4 vaddr 0x080495b4 paddr 0x080495b4 align 2**12
filesz 0x000000ec memsz 0x00000104 flags rw-
DYNAMIC off 0x000005c8 vaddr 0x080495c8 paddr 0x080495c8 align 2**2
filesz 0x000000a0 memsz 0x000000a0 flags rw-
NOTE off 0x00000100 vaddr 0x08048100 paddr 0x08048100 align 2**2
filesz 0x00000020 memsz 0x00000020 flags r--
Dynamic Section:
NEEDED libc.so.0.2
INIT 0x8048388
FINI 0x8048590
HASH 0x8048120
STRTAB 0x8048238
SYMTAB 0x8048168
STRSZ 0xa7
SYMENT 0x10
DEBUG 0x0
PLTGOT 0x8049678
PLTRELSZ 0x20
PLTREL 0x11
JMPREL 0x8048368
REL 0x8048350
RELSZ 0x18
RELENT 0x8
VERNEED 0x8048320
VERNEEDNUM 0x1
VERSYM 0x8048304
Version References:
required from libc.so.0.2:
0x09691f73 0x00 03 GLIBC_2.1.3
0x0d696910 0x00 02 GLIBC_2.0
> Try some other ld.so mode than --verify and the error messages should not
> be suppressed so much. e.g. try --list and see if it crashes in a more
> informative fashion.
jbailey@hurd:/bin$ /lib/debug/ld-2.2.4.so --list ./mutt
libncurses.so.5 => /lib/libncurses.so.5 (0x0102c000)
libsasl.so.7 => /lib/libsasl.so.7 (0x0106c000)
libc.so.0.2 => /lib/libc.so.0.2 (0x01077000)
libdb2.so.2 => /lib/libdb2.so.2 (0x011da000)
libdl.so.2 => /lib/libdl.so.2 (0x0121d000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x01221000)
libpam.so.0 => /lib/libpam.so.0 (0x0124e000)
/lib/ld.so => /lib/debug/ld-2.2.4.so (0x00001000)
libmachuser.so.1 => /lib/libmachuser.so.1 (0x01256000)
libhurduser.so.0.0 => /lib/libhurduser.so.0.0 (0x01267000)
jbailey@hurd:~/test$ /lib/debug/ld-2.2.4.so --list ./main
./main: error while loading shared libraries: ./main: failed to map segment
from shared object: Error 1073741869
> You stopped when mmap failed, but you didn't show us how it failed!
> What was the errno value? Step into mmap and see what part of the
> function fails.
Oops! I started using ``next'', when I realized that I had almost
memorized how most of the str* functions worked. =)
I hope I've captured the right things here. I don't really understand
too much of what I'm looking at. When I'm stepping through with gdb,
it appears to skip some lines, so I had to refer back to the source to
figure out where OutP was defined.
(./mutt)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:130
130 if (OutP->Head.msgh_id != 21118) {
(gdb)
140 msgh_size = OutP->Head.msgh_size;
(gdb)
141 msgh_simple = !(OutP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX);
(gdb)
143 if (((msgh_size != 48) || msgh_simple) &&
(gdb)
151 if (* (int *) &OutP->RetCodeType != * (int *) &RetCodeCheck)
(gdb)
155 if (OutP->RetCode != KERN_SUCCESS)
(gdb)
159 if (* (int *) &OutP->memobjrdType != * (int *) &memobjrdCheck)
(./main)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:130
130 if (OutP->Head.msgh_id != 21118) {
(gdb)
140 msgh_size = OutP->Head.msgh_size;
(gdb)
141 msgh_simple = !(OutP->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX);
(gdb)
143 if (((msgh_size != 48) || msgh_simple) &&
(gdb)
151 if (* (int *) &OutP->RetCodeType != * (int *) &RetCodeCheck)
(gdb)
155 if (OutP->RetCode != KERN_SUCCESS)
(gdb)
0x0001585a 167 return MIG_TYPE_ERROR;
Here's some detail I think you'll want:
(./mutt)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:120
120 InP->Head.msgh_seqno = 0;
(gdb)
121 InP->Head.msgh_id = 21018;
(gdb)
123 msg_result = __mach_msg(&InP->Head,
MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, 24, sizeof(Reply),
InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
(gdb) next
124 if (msg_result != MACH_MSG_SUCCESS) {
(gdb) print OutP
$11 = (Reply *) 0x10253a4
(gdb) print *OutP
$12 = {Head = {msgh_bits = 2147488256, msgh_size = 48, msgh_remote_port = 0,
msgh_local_port = 92, msgh_seqno = 7, msgh_id = 21118}, RetCodeType = {
msgt_name = 2, msgt_size = 32, msgt_number = 1, msgt_inline = 1,
msgt_longform = 0, msgt_deallocate = 0, msgt_unused = 0}, RetCode = 0,
memobjrdType = {msgt_name = 17, msgt_size = 32, msgt_number = 1,
msgt_inline = 1, msgt_longform = 0, msgt_deallocate = 0, msgt_unused = 0},
memobjrd = 94, memobjwtType = {msgt_name = 17, msgt_size = 32,
msgt_number = 1, msgt_inline = 1, msgt_longform = 0, msgt_deallocate = 0,
msgt_unused = 0}, memobjwt = 0}
(gdb)
(./main)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:120
120 InP->Head.msgh_seqno = 0;
(gdb)
121 InP->Head.msgh_id = 21018;
(gdb)
123 msg_result = __mach_msg(&InP->Head,
MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, 24, sizeof(Reply),
InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
(gdb) next
124 if (msg_result != MACH_MSG_SUCCESS) {
(gdb) print *OutP
$11 = {Head = {msgh_bits = 4608, msgh_size = 32, msgh_remote_port = 0,
msgh_local_port = 85, msgh_seqno = 7, msgh_id = 21118}, RetCodeType = {
msgt_name = 2, msgt_size = 32, msgt_number = 1, msgt_inline = 1,
msgt_longform = 0, msgt_deallocate = 0, msgt_unused = 0},
RetCode = 1073741869, memobjrdType = {msgt_name = 104, msgt_size = 194,
msgt_number = 282, msgt_inline = 0, msgt_longform = 0,
msgt_deallocate = 0, msgt_unused = 0}, memobjrd = 134631232,
memobjwtType = {msgt_name = 1, msgt_size = 0, msgt_number = 0,
msgt_inline = 0, msgt_longform = 0, msgt_deallocate = 0, msgt_unused = 0},
memobjwt = 75}
(gdb)
And inside the __mach_msg command:
(./mutt)
123 msg_result = __mach_msg(&InP->Head,
MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, 24, sizeof(Reply),
InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
(gdb)
_hurd_intr_rpc_mach_msg (msg=0x10253a4, option=3, send_size=24, rcv_size=48,
rcv_name=98, timeout=0, notify=0) at ../sysdeps/mach/hurd/dl-sysdep.c:594
594 return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
(gdb)
__mach_msg (msg=0x10253a4, option=3, send_size=24, rcv_size=48, rcv_name=98,
timeout=0, notify=0) at msg.c:37
37 {
(gdb)
47 ret = __mach_msg_trap (msg, option, send_size,
(gdb)
49 if (ret == MACH_MSG_SUCCESS)
(gdb)
50 return MACH_MSG_SUCCESS;
(gdb)
62 return ret;
(gdb)
0x0000f80c in _hurd_intr_rpc_mach_msg (msg=0x10253a4, option=3, send_size=24,
rcv_size=48, rcv_name=98, timeout=0, notify=0)
at ../sysdeps/mach/hurd/dl-sysdep.c:594
594 return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
(gdb)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:124
124 if (msg_result != MACH_MSG_SUCCESS) {
(gdb)
(./mail)
123 msg_result = __mach_msg(&InP->Head,
MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, 24, sizeof(Reply),
InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
(gdb)
_hurd_intr_rpc_mach_msg (msg=0x10253a4, option=3, send_size=24, rcv_size=48,
rcv_name=91, timeout=0, notify=0) at ../sysdeps/mach/hurd/dl-sysdep.c:594
594 return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
(gdb)
__mach_msg (msg=0x10253a4, option=3, send_size=24, rcv_size=48, rcv_name=91,
timeout=0, notify=0) at msg.c:37
37 {
(gdb)
47 ret = __mach_msg_trap (msg, option, send_size,
(gdb)
49 if (ret == MACH_MSG_SUCCESS)
(gdb)
50 return MACH_MSG_SUCCESS;
(gdb)
62 return ret;
(gdb)
0x0000f80c in _hurd_intr_rpc_mach_msg (msg=0x10253a4, option=3, send_size=24,
rcv_size=48, rcv_name=91, timeout=0, notify=0)
at ../sysdeps/mach/hurd/dl-sysdep.c:594
594 return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
(gdb)
__io_map (io_object=42, memobjrd=0x102541c, memobjwt=0x1025420)
at /home/jbailey/debian/glibc-2.2.4/i386-gnu/obj/hurd/RPC_io_map.c:124
124 if (msg_result != MACH_MSG_SUCCESS) {
(gdb)
--
Abandon the search for truth; settle for a good fantasy.