Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 May 2008 13:26:53 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Jeremie Le Hen <jeremie@le-hen.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Debugging rtld
Message-ID:  <20080517102653.GI18958@deviant.kiev.zoral.com.ua>
In-Reply-To: <20080517091740.GI70896@obiwan.tataz.chchile.org>
References:  <20080517091740.GI70896@obiwan.tataz.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--1Gc66+8b3xhjZJxW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, May 17, 2008 at 11:17:40AM +0200, Jeremie Le Hen wrote:
> Hi there,
>=20
> I tried to compile my source tree with -fstack-protector-all, and it
> happens that rtld breaks with this: once the new rtld is installed every
> single problem coredumps.  I tried to compile rtld-elf without SSP, but
> it didn't solve the problem.  Then I had to compile libc_pic.a without
> SSP and it worked, but I don't understand the root of the problem.
> So I want to use the generated coredump for post-mortem analysis with
> gdb.
>=20
> I compiled world with DEBUG_FLAGS=3D-g.  But GDB gives me a backtrace so
> long that it can't be real.  Moreoever it doesn't seem to bring in the
> required symbols.  I'm a GDB novice, so I'd like some help.
>=20
> chroot> =3D=3D=3D> libexec/rtld-elf (install)
> chroot> chflags noschg /usr/libexec/ld-elf.so.1
> chroot> install -s -o root -g wheel -m 555  -C -b -fschg -S ld-elf.so.1 /=
libexec
> chroot> install -o root -g wheel -m 444 rtld.1.gz  /usr/share/man/man1
> chroot> *** Signal 11
> chroot>
> chroot> jarjarbinks# cd /root; ls
> chroot> Segmentation fault
>=20
> host> jarjarbinks:145# ls -l /space/chroot/root/ls.core=20
> host> -rw-------  1 root  wheel  184320 May 17 10:19 /space/chroot/root/l=
s.core
> host> jarjarbinks:149# gdb -c /space/chroot/root/ls.core -e /space/chroot=
/bin/ls
> host> GNU gdb 6.1.1 [FreeBSD]
> host> [...]
> host> This GDB was configured as "i386-marcel-freebsd".
> host> Core was generated by `ls'.
> host> Program terminated with signal 11, Segmentation fault.
> host> #0  0x280583e4 in ?? ()
> host> (gdb) bt
> host> #0  0x280583e4 in ?? ()
> host> #1  0x00000000 in ?? ()
> host> #2  0x00000000 in ?? ()
> host> #3  0x00000000 in ?? ()
> host> #4  0x00000000 in ?? ()
> host> #5  0x00000000 in ?? ()
> host> #6  0x00000000 in ?? ()
> host> #7  0x00000000 in ?? ()
> host> #8  0x00000000 in ?? ()
> host> #9  0x00000000 in ?? ()
> host> #10 0x00000000 in ?? ()
> host> #11 0xffffffff in ?? ()
> host> #12 0x00001000 in ?? ()
> host> [...]
> host> #359 0x73763a68 in ?? ()
> host> #360 0x5b455c3d in ?? ()
> host> [...]
> host> #855 0x00000000 in ?? ()
> host> [...]
>=20
> Any hint on how to proceed would be welcome.

I usually add the CFLAGS+=3D-g to the rtld-elf/Makefile. Also, you do not
need to bring down the whole host by the broken ld.so.1. Do not install
it at all, and specify the path to the rtld by the --dynamic-linker switch,
see into ld.

BTW, Solaris seems to support $ORIGIN in the interpreter path, but I feel
that this is an overkill.

--1Gc66+8b3xhjZJxW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkgusu0ACgkQC3+MBN1Mb4jaqACgz6k2u1rOr9x6q16hFZ5DqH0h
CDUAn1xbcoskey+CApBlFCS93/T95NiM
=7+4r
-----END PGP SIGNATURE-----

--1Gc66+8b3xhjZJxW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080517102653.GI18958>