Date: 02 Feb 2002 11:57:20 +0100 From: Dag-Erling Smorgrav <des@ofug.org> To: John Hay <jhay@icomtek.csir.co.za> Cc: obrien@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/contrib/binutils Message-ID: <xzpu1t0ywvj.fsf@flood.ping.uio.no> In-Reply-To: <200202020459.g124xdL87420@zibbi.icomtek.csir.co.za> References: <200202020459.g124xdL87420@zibbi.icomtek.csir.co.za>
next in thread | previous in thread | raw e-mail | index | archive | help
John Hay <jhay@icomtek.csir.co.za> writes: > (gdb) p where > $9 =3D (Elf_Addr *) 0x2808815d > (gdb) p *obj > Cannot access memory at address 0x0. Umm, that's funny... that's not at all what I get. > > where is probably way off in never-never land, which is possibly the > > result of a bug in binutils, and possibly the result of a bug in > > rtld-elf. JDP should be able to help, given a proper backtrace. I'll > > try to reproduce the problem and produce one. > What is a proper backtrace? One with sufficient information to deduce the nature of the problem :) I know, it's not much of an answer, but there's no cut-and-dried answer. des@des /usr/ports/graphics/png/work/libpng-1.2.1% gdb pngtest pngtest.core GNU gdb 4.18 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read cal= led a t /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb.291/gdb/dbxread= .c li ne 2629 in elfstab_build_psymtabs Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../..= /cont rib/gdb.291/gdb/dbxread.c line 935 in fill_symbuf Core was generated by `pngtest'. Program terminated with signal 10, Bus error. Reading symbols from /usr/ports/graphics/png/work/libpng-1.2.1/./libpng.so.= 5... done. Reading symbols from /usr/lib/libm.so.2...done. Reading symbols from /usr/lib/libz.so.2...done. Reading symbols from /usr/lib/libc.so.5...done. Reading symbols from /usr/libexec/ld-elf.so.1...done. #0 0x2805346a in reloc_non_plt (obj=3D0x28065100, obj_rtld=3D0x28061a60) at /usr/src/libexec/rtld-elf/i386/reloc.c:196 196 *where +=3D (Elf_Addr) obj->relocbase; (gdb) bt #0 0x2805346a in reloc_non_plt (obj=3D0x28065100, obj_rtld=3D0x28061a60) at /usr/src/libexec/rtld-elf/i386/reloc.c:196 #1 0x28050ebc in relocate_objects (first=3D0x28065000, bind_now=3D0 '\000') at /usr/src/libexec/rtld-elf/rtld.c:1397 #2 0x2804f93a in _rtld (sp=3D0xbfbff540, exit_proc=3D0xbfbff538, objp=3D0x= bfbff53c) at /usr/src/libexec/rtld-elf/rtld.c:379 (gdb) p where $1 =3D (Elf_Addr *) 0x28087025 (gdb) p *obj $2 =3D {magic =3D 0, version =3D 0, next =3D 0x28065200, path =3D 0x28064020 "./libpng.so.5", refcount =3D 1, dl_refcount =3D 0, mapbase =3D 0x2806b000 <Address 0x2806b000 out of bounds>, mapsize =3D 13= 9264, textsize =3D 135168, vaddrbase =3D 0, relocbase =3D 0x2806b000 <Address 0x2806b000 out of bounds>, dynamic =3D 0x2808c788, entry =3D 0x28070674 "\213\034$=C3U\211=E5\203=EC\024S=E8=F0=FF=FF=FF\201= =C3=CC=C1\001", phdr =3D 0x0, phsize =3D 0, interp =3D 0x0, pltgot =3D 0x2808c850, rel =3D 0x2806ef40, relsize =3D 320, rela =3D 0x0, relasize =3D 0, pltrel =3D 0x2806f080, pltrelsize =3D 1864, pltrela =3D 0x0, pltrelasize =3D 0, symtab =3D 0x280= 6bb34, strtab =3D 0x2806d524 "", strsize =3D 6682, buckets =3D 0x2806b09c, nbuckets =3D 263, chains =3D 0x2806b4b8, nchains =3D 415, rpath =3D 0x0, needed =3D 0x28066050, init =3D 671545288, fini =3D 671647256, mainprog =3D 0 '\000', rtld =3D 0 '\000', textrel =3D 0 '\000', symbolic =3D 0 '\000', traced =3D 0 '\000', jmpslots_done =3D 0 '\000', init_done =3D 0 '\000', linkmap =3D { l_addr =3D 0x2806b000 <Address 0x2806b000 out of bounds>, l_name =3D 0x28064020 "./libpng.so.5", l_ld =3D 0x2808c788, l_next =3D 0x28065298, l_prev =3D 0x28065098}, dldags =3D {stqh_first = =3D 0x0, stqh_last =3D 0x280651ac}, dagmembers =3D {stqh_first =3D 0x0, stqh_last =3D 0x280651b4}, dev =3D 29700, ino =3D 367941, priv =3D 0x0} (gdb) p *rel $3 =3D {r_offset =3D 114725, r_info =3D 8} (gdb) p/x *rel $4 =3D {r_offset =3D 0x1c025, r_info =3D 0x8} (gdb) p rel $5 =3D (Elf_Rel *) 0x2806ef40 (gdb) p rellim $6 =3D (Elf_Rel *) 0x2806f080 (gdb) p obj->rel $7 =3D (Elf_Rel *) 0x2806ef40 Not being jdp, all I get from this is that 1) it's crashing at the very first relocation entry (rel =3D=3D obj->rel) and 2) I don't know what to make of those "<Address 0x2806b000 out of bounds>" thingies. They seem to be just beyond the loader itself (imgact_elf loads the loader at MAXDSIZ + (address of data section)), which puts them in the loader's private heap, which apparently isn't included in the core dump, so we need a *live* backtrace, which is tricky (but probably simpler than fixing the kernel to include the loader's heap in a core dump). % objdump -h pngtest | grep Name Idx Name Size VMA LMA File off Algn % objdump -h pngtest | fgrep ' .data' 12 .data 00000060 0804c6e0 0804c6e0 000036e0 2**2 % objdump -h /usr/libexec/ld-elf.so.1 | fgrep ' .text' 5 .text 0000e660 00003238 00003238 00003238 2**2 % gdb pngtest [...] (gdb) run Starting program: /usr/ports/graphics/png/work/libpng-1.2.1/pngtest Program received signal SIGBUS, Bus error. 0x28053212 in ?? () (gdb) add-symbol-file /usr/libexec/ld-elf.so.1 (512*1024*1024 + 0x0804c6e0 = + 0x00003238) add symbol table from file "/usr/libexec/ld-elf.so.1" at text_addr =3D 0x28= 04f918? (y or n) y Reading symbols from /usr/libexec/ld-elf.so.1...done. (gdb) bt #0 0x28053212 in morecore (bucket=3D671502592) at /usr/src/libexec/rtld-elf/malloc.c:269 #1 0x0 in ?? () ...which is obviously wrong. It seems the load address I computed for ld-elf.so.1 (MAXDSIZ + pngtest data offset + ld-elf text offset) is off by about 1500 bytes, though I have no idea why. I'll investigate further. DES --=20 Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpu1t0ywvj.fsf>