From owner-freebsd-current@FreeBSD.ORG Tue Nov 23 21:53:19 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0930716A4CF for ; Tue, 23 Nov 2004 21:53:19 +0000 (GMT) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id C622C43D1D for ; Tue, 23 Nov 2004 21:53:16 +0000 (GMT) (envelope-from keramida@linux.gr) Received: from gothmog.gr (patr530-a055.otenet.gr [212.205.215.55]) iANLrDg4018524; Tue, 23 Nov 2004 23:53:14 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.1/8.13.1) with ESMTP id iANKmxxu002054; Tue, 23 Nov 2004 22:48:59 +0200 (EET) (envelope-from keramida@linux.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.1/8.13.1/Submit) id iANKmx8M002053; Tue, 23 Nov 2004 22:48:59 +0200 (EET) (envelope-from keramida@linux.gr) Date: Tue, 23 Nov 2004 22:48:59 +0200 From: Giorgos Keramidas To: Wiktor Niesiobedzki Message-ID: <20041123204859.GA2002@gothmog.gr> References: <20041123171951.GG3584@mail.evip.pl> <20041123183930.GA56352@orion.daedalusnetworks.priv> <20041123185923.GH3584@mail.evip.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041123185923.GH3584@mail.evip.pl> cc: current@freebsd.org Subject: Re: Putty or libcrypto bug? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Nov 2004 21:53:19 -0000 On 2004-11-23 19:59, Wiktor Niesiobedzki wrote: >On Tue, Nov 23, 2004 at 08:39:30PM +0200, Giorgos Keramidas wrote: >> This is a Bad Idea(TM) most of the time though. The library >> implements a function that other programs or libraries may depend upon >> to work in certain ways. Replacing the library function with a >> hand-rolled version may or may not work -- the latter in this case :-/ > > Should'nt libc load nss_ldap with kind of RTLD_LOCAL, so the libc will load > libldap in another symbol-space so symbol lookups will not end in main > program (if it is at all possible... I'm not familiar with dynamic linking)? What happens if parts of the program want to access symbols from many disjoint namespaces? If a program links to two shared objects: libfoo.so.1 and libmore.2, which in turn depend on other shared objects, for example: program libfoo.so.1 libtest.so.3 libmore.so.2 libtmp.so.4 libthread.so.5 and libmore _does_ want to override thread_create() from libthread.so.5 but libtmp.so.4 wants only the original thread_create() function from libthread.so.5, which function will the runtime linker call when `program' calls thread_create()? > If not, then it is the fact, that programmer of any program should > aviod duplicating function names across every library that may > eventually be installed and somehow linked to this programm, what > sounds rather ridiculous to me. I don't think there is support for multiple symbol namespaces in C. This is probably why most of the utilities in the src/ tree export as few symbols as possible; many times just a main() function. Judicious use of static scope and unique name prefixes like putty_ may avoid such problems without the need for `RTLD_LOCAL'. - Giorgos