Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Mar 2009 15:47:40 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Ed Schouten <ed@80386.nl>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: LD_PRELOAD broken?
Message-ID:  <20090328134740.GI31897@deviant.kiev.zoral.com.ua>
In-Reply-To: <20090328102552.GR73108@hoeg.nl>
References:  <20090328102552.GR73108@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

--OkEUgNLVrkMgtt3o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Mar 28, 2009 at 11:25:52AM +0100, Ed Schouten wrote:
> Hi all,
>=20
> 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:
>=20
> 	LD_PRELOAD=3D/lib/libc.so.7 ls
>=20
> 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 *refo=
bj)
 	      xname);
 	    return NULL;
 	}
-	if (refobj->z_origin)
+	if (refobj !=3D NULL && refobj->z_origin)
 	    return origin_subst(xname, refobj->origin_path);
 	else
 	    return xstrdup(xname);

--OkEUgNLVrkMgtt3o
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAknOKnwACgkQC3+MBN1Mb4j8JQCg2jXJ6FVuBM/YnVBg3ghKdEbB
aoAAoJiA1wJgIfXunExSEXi1UVA0kW5U
=DqFT
-----END PGP SIGNATURE-----

--OkEUgNLVrkMgtt3o--



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