LD_PRELOAD broken?
Kostik Belousov
kostikbel at gmail.com
Sat Mar 28 06:47:47 PDT 2009
On Sat, Mar 28, 2009 at 11:25:52AM +0100, Ed Schouten wrote:
> Hi all,
>
> Is it possible that the changes to rtld-elf the last couple of weeks
> cause LD_PRELOAD to crash applications on startup? Very simple way to
> reproduce:
>
> LD_PRELOAD=/lib/libc.so.7 ls
>
> This causes a segmentation fault on startup, at least on AMD64.
Yes. The following fixes the case for me.
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 823427a..d98ade7 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1125,7 +1125,7 @@ find_library(const char *xname, const Obj_Entry *refobj)
xname);
return NULL;
}
- if (refobj->z_origin)
+ if (refobj != NULL && refobj->z_origin)
return origin_subst(xname, refobj->origin_path);
else
return xstrdup(xname);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20090328/c39d9f8c/attachment.pgp
More information about the freebsd-current
mailing list