From owner-freebsd-hackers@FreeBSD.ORG Sat May 17 17:46:47 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13AC6106564A for ; Sat, 17 May 2008 17:46:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay03.kiev.sovam.com (relay03.kiev.sovam.com [62.64.120.201]) by mx1.freebsd.org (Postfix) with ESMTP id 98F548FC1B for ; Sat, 17 May 2008 17:46:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=skuns.kiev.zoral.com.ua) by relay03.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JxQUW-0002qg-TF for freebsd-hackers@freebsd.org; Sat, 17 May 2008 20:46:45 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m4HHkdZD083207 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 May 2008 20:46:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m4HHkbSM088931; Sat, 17 May 2008 20:46:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m4HHkbaV088930; Sat, 17 May 2008 20:46:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 17 May 2008 20:46:37 +0300 From: Kostik Belousov To: Jeremie Le Hen Message-ID: <20080517174637.GL18958@deviant.kiev.zoral.com.ua> References: <20080517091740.GI70896@obiwan.tataz.chchile.org> <20080517102653.GI18958@deviant.kiev.zoral.com.ua> <20080517173525.GJ70896@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hYef4tn27tWYDrFX" Content-Disposition: inline In-Reply-To: <20080517173525.GJ70896@obiwan.tataz.chchile.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 6b869f9e50b0a12d7314c849f37d9376 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2835 [May 13 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release Cc: freebsd-hackers@freebsd.org Subject: Re: Debugging rtld X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 May 2008 17:46:47 -0000 --hYef4tn27tWYDrFX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 17, 2008 at 07:35:25PM +0200, Jeremie Le Hen wrote: > Hi, >=20 > On Sat, May 17, 2008 at 01:26:53PM +0300, Kostik Belousov wrote: > > On Sat, May 17, 2008 at 11:17:40AM +0200, Jeremie Le Hen wrote: > > > 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 ev= ery > > > single problem coredumps. I tried to compile rtld-elf without SSP, b= ut > > > 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/ro= ot/ls.core > > > host> jarjarbinks:149# gdb -c /space/chroot/root/ls.core -e /space/ch= root/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. > >=20 > > I usually add the CFLAGS+=3D-g to the rtld-elf/Makefile. Also, you do n= ot > > 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 swi= tch, > > see into ld. Hmm, ^^^^ info >=20 > Thank you for this tip. However the backtrace is still unusable. > I've recompiled libc_pic.a with -g, then rtld-elf with -g and finally > /bin/ls with you tip and -g. >=20 > I'm really brought to a standstill here. Looks like you have a stack corruption, that is reasonable given the matters you touching. The easiest, althought somewhat time-consuming way of searching the point where the things break is to insert some break into the code of the rtld, "int3" may be good, and moving it forward until you start hitting the breakage instead of the breakpoint. --hYef4tn27tWYDrFX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkgvGfwACgkQC3+MBN1Mb4hcnwCaAu3itaIGZJtLSR0HmmfZIfy6 TVYAn1+rlIS+nJ4ivHjN8rameBJNiMbj =72Jk -----END PGP SIGNATURE----- --hYef4tn27tWYDrFX--