From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 16 14:22:38 2010 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 215B7106567A; Mon, 16 Aug 2010 14:22:38 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 652698FC0C; Mon, 16 Aug 2010 14:22:37 +0000 (UTC) Received: by qwg5 with SMTP id 5so5751388qwg.13 for ; Mon, 16 Aug 2010 07:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=1sYEx1iVL32KwZ0SCSz+TFGOsalpqrAlghQoK+e8ebE=; b=JpfI4l+QgGErPXbQWLlXooOQ+lUjbRp37RwkN2iNOTf4s0vp2t0O3wzYsxSqtGakBz 53Y0kAObEFTcR2XfgJJJXhzeTjveh2D68euFxTeFqxMJMI0LD6/xuqjqREfJChZzCVA6 TErAji0sKzxTodQzgmR1klni+eJ5cKiZwQ5kQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=M0go6z0zzoiFRSElccQGJELiYPqHyo0xWsDt0PxVer06AOw4K2KYvbbDHtcsSWLcZN wwLQt+THk+mIZzNa2VJuAAM8C4Y355lEbHnbhoPy4wQ+ZC4TnmCG1VvM1B2ORSbqEDSZ uZ3gVdB5hKYNRIn/GfaEmiFstr0B+Kq37yDi4= Received: by 10.224.73.209 with SMTP id r17mr3377334qaj.2.1281968554606; Mon, 16 Aug 2010 07:22:34 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id q8sm7370073qcs.24.2010.08.16.07.22.31 (version=SSLv3 cipher=RC4-MD5); Mon, 16 Aug 2010 07:22:32 -0700 (PDT) Date: Mon, 16 Aug 2010 10:22:21 -0400 From: Alexander Kabaev To: Kostik Belousov Message-ID: <20100816102221.0f3b48f0@kan.dnsalias.net> In-Reply-To: <20100814143225.GA2396@deviant.kiev.zoral.com.ua> References: <20100806050633.GK14016@felucia.tataz.chchile.org> <20100806090404.GI22295@deviant.kiev.zoral.com.ua> <20100806110807.GA68489@alchemy.franken.de> <20100806111131.GN22295@deviant.kiev.zoral.com.ua> <20100807135939.GA875@alchemy.franken.de> <20100807180904.GZ22295@deviant.kiev.zoral.com.ua> <20100807193722.GB875@alchemy.franken.de> <20100814143225.GA2396@deviant.kiev.zoral.com.ua> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/JyNWM5YA/rxlgfSEl4LreCt"; protocol="application/pgp-signature" Cc: kan@freebsd.org, FreeBSD Hackers , Jeremie, nwhitehorn@freebsd.org, Marius Strobl , Hen Subject: Re: Avoiding sysctl at program startup using ELF aux vector (was: concurrent sysctl implementation) 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: Mon, 16 Aug 2010 14:22:38 -0000 --Sig_/JyNWM5YA/rxlgfSEl4LreCt Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 14 Aug 2010 17:32:25 +0300 Kostik Belousov wrote: > On Sat, Aug 07, 2010 at 09:37:22PM +0200, Marius Strobl wrote: > > On Sat, Aug 07, 2010 at 09:09:04PM +0300, Kostik Belousov wrote: > > > On Sat, Aug 07, 2010 at 03:59:39PM +0200, Marius Strobl wrote: > > > > On Fri, Aug 06, 2010 at 02:11:31PM +0300, Kostik Belousov wrote: > > > > > On Fri, Aug 06, 2010 at 01:08:08PM +0200, Marius Strobl wrote: > > > > > > On Fri, Aug 06, 2010 at 12:04:04PM +0300, Kostik Belousov > > > > > > wrote: > > > > > > > On Fri, Aug 06, 2010 at 07:06:33AM +0200, Jeremie Le Hen > > > > > > > wrote: > > > > > > > > Hi Kib, > > > > > > > >=20 > > > > > > > > In-Reply-To: > > > > > > > > <20100629083901.GG13238@deviant.kiev.zoral.com.ua> On > > > > > > > > Tue, Jun 29, 2010 at 11:39:01AM +0300, Kostik Belousov > > > > > > > > wrote: > > > > > > > > > On Tue, Jun 29, 2010 at 10:26:39AM +0200, Marius > > > > > > > > > Strobl wrote: > > > > > > > > > > On Mon, Jun 28, 2010 at 05:48:59PM +0300, Kostik > > > > > > > > > > Belousov wrote: > > > > > > > > > > > On Wed, Jun 23, 2010 at 11:09:59PM +0200, Jeremie > > > > > > > > > > > Le Hen wrote: > > > > > > > > > > > > Hi Kostik, > > > > > > > > > > > >=20 > > > > > > > > > > > > This patch seems to have faded out from > > > > > > > > > > > > memory. Is it possible to go forward and > > > > > > > > > > > > commit it? > > > > > > > > > > > I refreshed the patch. Hopefully, nobody will > > > > > > > > > > > object, and I commit it shortly. > > > > > > > > > > >=20 > > > > > > > > > > > >=20 > > > > > > > > > > > > Thanks, > > > > > > > > > > > > Regards. > > > > > > > > > > > >=20 > > > > > > > > > > > > On Sat, Jul 25, 2009 at 12:29:16AM +0300, > > > > > > > > > > > > Kostik Belousov wrote: > > > > > > > > > > > > > Below is the prototype that seems to work for > > > > > > > > > > > > > me both with patched and old rtld on i386. > > > > > > > > > > > > > Patch also contains bits for amd64 that I did > > > > > > > > > > > > > not tested yet. All other arches are not > > > > > > > > > > > > > buildable for now. > > > > > > > > > > > > >=20 > > > > > > > > > > > > > Patch completely eliminates sysctl syscalls > > > > > > > > > > > > > from the rtld and libc startup. Without the > > > > > > > > > > > > > patch, a single run of /bin/ls did 6 sysctls, > > > > > > > > > > > > > with the patch, no sysctls is queried at all. > > > > > > > > > > > > >=20 > > > > > > > > > > > Comparing with the originally posted patch, I > > > > > > > > > > > added support for all architectures, tested amd64 > > > > > > > > > > > and ia32 on amd64, and converted getpagesizes(3) > > > > > > > > > > > that added two more startup sysctls. > > > > > > > > > > >=20 > > > > > > > > > > > Would be nice to get a testing for at least > > > > > > > > > > > some !x86 architectures before the commit, I > > > > > > > > > > > added some people who helped me in past, to the > > > > > > > > > > > Cc:. > > > > > > > > > > >=20 > > > > > > > > > >=20 > > > > > > > > > > Doesn't look good on sparc64: > > > > > > > > > > <...> > > > > > > > > > > NFS ROOT: 192.168.1.40:/usr/data/nfsroot/sparc64 > > > > > > > > > > dc1: link state changed to UP > > > > > > > > > > pid 24 (ifconfig), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Interface IP-Address Broadcast > > > > > > > > > > pid 29 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 30 (grep), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > pid 31 (rcorder), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > =20 > > > > > > > > > > pid 32 (date), uid 0: exited on signal 11 > > > > > > > > > > Segmentation fault > > > > > > > > > > Jun 29 12:20:50 getty[36]: open /dev/ttyv3: No such > > > > > > > > > > file or directory <...> > > > > > > > > > >=20 > > > > > > > > > > Unfortunately, I currently lack the time to debug > > > > > > > > > > this. > > > > > > > > >=20 > > > > > > > > > Thank you. > > > > > > > >=20 > > > > > > > > Did yu have time to look at this problem? It would be > > > > > > > > nice to have this in the tree. > > > > > > >=20 > > > > > > > I cannot move forward without the help from somebody > > > > > > > having access to sparc64 system where the problem is > > > > > > > reproducable. > > > > > >=20 > > > > > > Do you have a debug version of the patch which outputs the > > > > > > necessary information? > > > > >=20 > > > > > I would suggest to build rtld and libc with debugging symbols > > > > > and get full backtrace from the faults. > > > >=20 > > > > v100# gdb /sbin/ifconfig ifconfig.core > > > > GNU gdb 6.1.1 [FreeBSD] > > > > Copyright 2004 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 conditions. Type "show copying" to > > > > see the conditions. There is absolutely no warranty for GDB. > > > > Type "show warranty" for details. This GDB was configured as > > > > "sparc64-marcel-freebsd"... Core was generated by `ifconfig'. > > > > Program terminated with signal 11, Segmentation fault. > > > > Reading symbols from /lib/libbsdxml.so.4...done. > > > > Loaded symbols for /lib/libbsdxml.so.4 > > > > Reading symbols from /lib/libjail.so.1...done. > > > > Loaded symbols for /lib/libjail.so.1 > > > > Reading symbols from /lib/libsbuf.so.5...done. > > > > Loaded symbols for /lib/libsbuf.so.5 > > > > Reading symbols from /lib/libipx.so.5...done. > > > > Loaded symbols for /lib/libipx.so.5 > > > > Reading symbols from /lib/libc.so.7...done. > > > > Loaded symbols for /lib/libc.so.7 > > > > Reading symbols from /libexec/ld-elf.so.1...done. > > > > Loaded symbols for /libexec/ld-elf.so.1 > > > > #0 0x000000004089ebdc in getpagesizes (pagesize=3D0x7fdffffe2f8, > > > > nelem=3D1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > 75 while (nops > 0 && ps[nops - 1] =3D=3D 0) > > > > (gdb) bt #0 0x000000004089ebdc in getpagesizes > > > > (pagesize=3D0x7fdffffe2f8, nelem=3D1) > > > > at /usr/home/marius/co/head/src/lib/libc/gen/getpagesizes.c:75 > > > > #1 0x00000000407f4314 in malloc_init () > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5418 > > > > #2 0x00000000407f67d8 in malloc (size=3D32) > > > > at /usr/home/marius/co/head/src/lib/libc/stdlib/malloc.c:5932 > > > > #3 0x00000000001069ac in clone_setdefcallback > > > > (ifprefix=3D0x11b8a8 "wlan", p=3D0x10a1a0 ) > > > > at /usr/home/marius/co/head/src/sbin/ifconfig/ifclone.c:106 #4 > > > > 0x0000000000119864 in __do_global_ctors_aux () #5 > > > > 0x000000000010243c in _init () #6 0x0000000000102508 in _start > > > > () #7 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_s= tart.S:59 > > > > #8 0x000000004022719c in .rtld_start () > > > > at /usr/home/marius/co/head/src/libexec/rtld-elf/sparc64/rtld_s= tart.S:59 > > > > Previous frame identical to this frame (corrupt stack?) > > > >=20 > > > > All faults I've looked at died the same why. > > > Thank you. I think I found the reason, which was an unitialized > > > variable. I also fixed a sillyness with osrelver. > > >=20 > > > In the patched tree, there is tools/test/auxinfo that could be > > > used to quick-check the system. > > >=20 > > > Updated patch is available at > > > http://people.freebsd.org/~kib/misc/rtld_auxinfo.1.patch > >=20 > > I can confirm that this versions works on sparc64. > After the discussion with Alexander, I made the change to allow libc > to access aux vectors, instead of providing rtld interface to fetch > values. >=20 > I decided to keep the single function that fetch the values, because > it is convenient place to do digesting of the vector. >=20 > http://people.freebsd.org/~kib/misc/rtld_auxinfo.2.patch No objections here. --=20 Alexander Kabaev --Sig_/JyNWM5YA/rxlgfSEl4LreCt Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMaUmlQ6z1jMm+XZYRAjNPAJ9nAnXrSOZCNLup/R4ak5yGbnGi8QCgztgI aVibb0fja+mVl/rZULfWCQ4= =eF6S -----END PGP SIGNATURE----- --Sig_/JyNWM5YA/rxlgfSEl4LreCt--