From owner-freebsd-arch@FreeBSD.ORG Mon Sep 9 17:46:05 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 957A03C1 for ; Mon, 9 Sep 2013 17:46:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 70308283C for ; Mon, 9 Sep 2013 17:46:05 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 863DDB99B; Mon, 9 Sep 2013 13:46:04 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Subject: Re: COMPAT_32BIT oddness in rtld-elf (was: Re: /usr/lib/private) Date: Mon, 9 Sep 2013 11:27:16 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <86zjrut4an.fsf@nine.des.no> <8638pgkg3m.fsf@nine.des.no> In-Reply-To: <8638pgkg3m.fsf@nine.des.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201309091127.16643.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Sep 2013 13:46:04 -0400 (EDT) Cc: Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 17:46:05 -0000 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