The following reply was made to PR bin/171604; it has been noted by GNATS.

From: Mark Johnston <mark...@gmail.com>
To: bug-follo...@freebsd.org
Cc:  
Subject: Re: bin/171604: [patch] LD_PRELOAD set to not absolute path crashes
 rtld
Date: Sat, 15 Sep 2012 03:39:39 -0400

 --45Z9DzgjV8m4Oswq
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Ok, so that fixed the segfault at least. I think the LD_PRELOAD handling
 is still incorrect. According to rtld(1), if LD_PRELOAD isn't an
 absolute path, then LD_LIBRARY_PATH and the standard library path
 (/lib:/usr/lib) should be searched. However, we're only searching
 LD_LIBRARY_PATH in this case at the moment:
 
 $ LD_PRELOAD=libc.so.7 ls
 Shared object "libc.so.7" not found
 $ LD_LIBRARY_PATH=/lib LD_PRELOAD=libc.so.7 ls
 <no errors>
 
 The attached patch addresses this problem as well.
 
 Thanks,
 -Mark
 
 --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..bd6d33a 100644
 --- a/libexec/rtld-elf/rtld.c
 +++ b/libexec/rtld-elf/rtld.c
 @@ -1471,9 +1471,10 @@ 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 && !refobj->z_nodeflib) || !objgiven) &&
          (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != 
NULL))
            return (pathname);
      }
 
 --45Z9DzgjV8m4Oswq--
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to