Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2003 09:30:32 -0500
From:      "Jacques A. Vidrine" <nectar@FreeBSD.org>
To:        Paul Richards <paul@freebsd-services.com>
Cc:        freebsd-arch@FreeBSD.org
Subject:    Re: `Hiding' libc symbols (was Re: cvs commit: src/lib/libc/gen ...)
Message-ID:  <20030501143032.GA34163@madman.celabo.org>
In-Reply-To: <20030501140255.GB1869@survey.codeburst.net>
References:  <20030430144149.GA7786@dragon.nuxi.com> <20030430002014.GA1190@dragon.nuxi.com> <Pine.GSO.4.10.10304300024280.1846-100000@pcnet1.pcnet.com> <20030430043303.GA46365@mero.morphisms.net> <20030430062647.GA82023@rot13.obsecurity.org> <20030430143121.GK39658@survey.codeburst.net> <20030430152708.GA26216@madman.celabo.org> <20030430153645.GL39658@survey.codeburst.net> <20030430164135.GB26508@madman.celabo.org> <20030501140255.GB1869@survey.codeburst.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 01, 2003 at 03:02:55PM +0100, Paul Richards wrote:
> On Wed, Apr 30, 2003 at 11:41:35AM -0500, Jacques A. Vidrine wrote:
> > [Trimmed cc:list;  moving to freebsd-arch]
> > 
> > 
> > First, has something been broken by making strlcpy/strlcat into a weak
> > reference?
> 
> Yes, deliberately overloading it from an application now no longer
> works.

Give me a break.  Good, it should not work by accident.  An
application might define strlcpy for its own use, but we should NEVER
use the application's strlcpy. [1]

> What really concerns me though, is that behaviour is only defined
> for 2 functions.

No, it is done for some 150+ functions.  If the technique didn't have
a certain distasteful side-effect when used en masse, I would push
for covering almost all of the other symbols libc exports.  (If an
application defines `strcpy', should we use that from within libc?)
But until a better technique arrives, I am happy to apply it a little
less liberally.

There are some specialized instances where it _does_ make sense to
override a function that libc utilizes.  malloc and free are one
example.  The socket-related functions might be another (for SOCKS
implementations).    The fact that we've `hidden' connect(2) et al
using this same technique for over two years without much impact on
the functioning of such applications is a pretty good indicator to
me that concerns in this area are unfounded.

> I think this should be backed out, as most people in this thread
> have pointed out, you've added a quirk to our C library to fix a
> poorly coded application and whichever way you look at it, that's
> not the right solution.
>
> The implementation of FreeBSD should be what's correct, we shouldn't
> fudge things to accomodate bad packages, fix the problem where the
> problem really exists.

Obviously, I don't see it the same way you do.  Calling the
application's strlcpy in order to implement some internal libc
function is not ``what's correct'', regardless of whether the
application is buggy or perfect.

Cheers,
-- 
Jacques Vidrine   . NTT/Verio SME      . FreeBSD UNIX       . Heimdal
nectar@celabo.org . jvidrine@verio.net . nectar@freebsd.org . nectar@kth.se

[1] I know.  Never say never.



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