From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 18 18:00:26 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04025106568A for ; Tue, 18 Sep 2012 18:00:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E2CDB8FC14 for ; Tue, 18 Sep 2012 18:00:25 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q8II0PQM058946 for ; Tue, 18 Sep 2012 18:00:25 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q8II0P3P058945; Tue, 18 Sep 2012 18:00:25 GMT (envelope-from gnats) Date: Tue, 18 Sep 2012 18:00:25 GMT Message-Id: <201209181800.q8II0P3P058945@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Mark Johnston Cc: Subject: Re: bin/171604: [patch] LD_PRELOAD set to not absolute path crashes rtld X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mark Johnston List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 18:00:26 -0000 The following reply was made to PR bin/171604; it has been noted by GNATS. From: Mark Johnston To: bug-followup@freebsd.org Cc: Subject: Re: bin/171604: [patch] LD_PRELOAD set to not absolute path crashes rtld Date: Tue, 18 Sep 2012 13:49:57 -0400 --45Z9DzgjV8m4Oswq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > That manual page references to "built-in standard directories", but > does not define what they are. Previously LD_PRELOAD set to not absolute > path worked even for /usr/local/lib (as I understand because of ldconfig > called for that directory). I believe it refers to the 6th item in the search order described in rtld(1). So /lib and /usr/lib. But perhaps it also searched the directories in the hints file - I don't have access to a machine running 9 or older at the moment, so I can't really check. Attached is yet another patch which restores that behaviour. But someone who's actually familiar with recent changes to rtld should probably be taking a look. =) --45Z9DzgjV8m4Oswq Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="rtld_crash.patch" diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 050adbb..8b541fd 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1471,9 +1471,12 @@ find_library(const char *xname, const Obj_Entry *refobj) (pathname = search_library_path(name, ld_library_path)) != NULL || (objgiven && (pathname = search_library_path(name, refobj->runpath)) != NULL) || + (objgiven && (pathname = search_library_path(name, gethints(refobj->z_nodeflib))) - != NULL || - (objgiven && !refobj->z_nodeflib && + != NULL) || + (!objgiven && + (pathname = search_library_path(name, gethints(false))) != NULL) || + (((objgiven && !refobj->z_nodeflib) || !objgiven) && (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)) return (pathname); } --45Z9DzgjV8m4Oswq--