Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2013 11:27:16 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= <des@des.no>
Subject:   Re: COMPAT_32BIT oddness in rtld-elf (was: Re: /usr/lib/private)
Message-ID:  <201309091127.16643.jhb@freebsd.org>
In-Reply-To: <8638pgkg3m.fsf@nine.des.no>
References:  <86zjrut4an.fsf@nine.des.no> <8638pgkg3m.fsf@nine.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday, September 07, 2013 7:48:13 am Dag-Erling Sm=C3=B8rgrav wrote:
> I'm having trouble understanding this code in libexec/rtld-elf/rtld.c:
>=20
> static void *
> path_enumerate(const char *path, path_enum_proc callback, void *arg)
> {
> #ifdef COMPAT_32BIT
>     const char *trans;
> #endif
>     if (path =3D=3D NULL)
> 	return (NULL);
>=20
>     path +=3D strspn(path, ":;");
>     while (*path !=3D '\0') {
> 	size_t len;
> 	char  *res;
>=20
> 	len =3D strcspn(path, ":;");
> #ifdef COMPAT_32BIT
> 	trans =3D lm_findn(NULL, path, len);
> 	if (trans)
> 	    res =3D callback(trans, strlen(trans), arg);
> 	else
> #endif
> 	res =3D callback(path, len, arg);
>=20
> 	if (res !=3D NULL)
> 	    return (res);
>=20
> 	path +=3D len;
> 	path +=3D strspn(path, ":;");
>     }
>=20
>     return (NULL);
> }
>=20
> This function is used to traverse paths, such as rtld's built-in search
> path, LD_LIBRARY_PATH, an Elf object's rpath, etc.  As far as I can
> tell, the result of this is that *in the COMPAT_32BIT case only* it is
> possible to list one directory as replacing another in libmap.conf.  In
> other words, we could have this in libmap32.conf:
>=20
> /lib                    /lib32
> /usr/lib                /usr/lib32
> /usr/lib/private        /usr/lib32/private
>=20
> instead of hardcoding a different standard search path in rtld.h.
>=20
> What I don't understand is why this functionality is only available in
> the COMPAT_32BIT case.  It seems universally useful to me.

I think it would be fine to make it universally available.  You should talk=
 to=20
Doug Ambrisko.  He has patches to extend libmap support to key off OS-versi=
on,=20
etc. and might already make the directory case universal.

=2D-=20
John Baldwin



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