From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15007 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: RTLD_LAZY deferred symbol binding Date: Wed, 11 Dec 2019 08:19:50 -0500 Message-ID: <20191211131950.GM1666@brightrain.aerifal.cx> References: <3521821576058976@vla1-2bebf6b1c06e.qloud-c.yandex.net> <20191211103528.GL23985@port70.net> <4346191576065348@iva8-3634a30a817d.qloud-c.yandex.net> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="193276"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-15023-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 11 14:20:07 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1if1uP-000o50-Qd for gllmg-musl@m.gmane.org; Wed, 11 Dec 2019 14:20:05 +0100 Original-Received: (qmail 28004 invoked by uid 550); 11 Dec 2019 13:20:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 27973 invoked from network); 11 Dec 2019 13:20:02 -0000 Content-Disposition: inline In-Reply-To: <4346191576065348@iva8-3634a30a817d.qloud-c.yandex.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:15007 Archived-At: On Wed, Dec 11, 2019 at 02:55:48PM +0300, Scherbatiy Alexander wrote: > Thank you. It works. > > I looked at the ld help on linux Alpine and it shows > > ld --help > > -z lazy Mark object lazy runtime binding (default) > > Should the lazy option be used by default No, it's really a bug to be relying on this behavior, as it precludes much-wanted hardening and is not well-defined per the supported standards. Deferred binding was added for the sake of a very small but important and stubborn set of software (i.e. Xorg) that was depending on lazy binding and where musl-based dists were needing messy hacks to make it work without (explicit load order of modules in xorg.conf). The software that needs this behavior can be built with -z lazy as needed. This is not unique to musl; it applies to hardened glibc toolchains/distros where bindnow is default, too. > or the documentation needs to be updated? That's the documentation for ld, which applies if you invoke ld as a command. That's not how you link hosted software. It's linked by invoking $(CC) (e.g. gcc) which may be the part passing -z now; I forget. If the default is actually changed in ld, then yes ld should be patched to print the default it was configured with accurately (and I would think such a patch would be acceptable for upstream). Rich