Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2012 18:00:25 GMT
From:      Mark Johnston <markjdb@gmail.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/171604: [patch] LD_PRELOAD set to not absolute path crashes rtld
Message-ID:  <201209181800.q8II0P3P058945@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/171604; it has been noted by GNATS.

From: Mark Johnston <markjdb@gmail.com>
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--



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