zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: [Bug] modules zsh/tcp, zsh/zftp unloadable, probably affecting most modern Linuxes
Date: Tue, 6 Jun 2023 10:05:32 +0100 (BST)	[thread overview]
Message-ID: <1604572963.1688389.1686042332603@mail.virginmedia.com> (raw)
In-Reply-To: <FF8D1182-CFF2-4831-BFF0-5232258508CC@kba.biglobe.ne.jp>

> On 06/06/2023 07:42 Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
> I think the problem is '-Wl,-z,now'. man ld(1) says:
> 
>    now When generating an executable or shared library, mark it to
>        tell the dynamic linker to resolve all symbols when the program
>        is started, or when the shared library is loaded by dlopen,
>        instead of deferring function call resolution to the point when
>        the function is first called.
> 
> It seems this option has the higher precedence than the option
> '-z lazy' in the same command line, or the RTLD_LAZY for dlopen().
> 
> On Fedora-38:
> % readelf --dynamic /usr/lib64/zsh/5.9/zsh/zftp.so | grep FLAG
>  0x000000000000001e (FLAGS)              BIND_NOW
>  0x000000006ffffffb (FLAGS_1)            Flags: NOW
> 
> I think this flag in zftp.so is the result of '-z now'
> 
> On Debian-11, /usr/lib/x86_64-linux-gnu/zsh/5.8/zsh/zftp.so has the
> same flag. I guess Debian binary package is also built with '-z now'.
> 
> The zftp.so built by myself does not have this flag.
> 
> Why '-z now' is used when building binary packages? For security?

I think this is just so that failure to find symbols at all will
show up quickly in the build rather than at run time, which would
be a real pain.

One solution might be to build first with -z now to confirm that it
does link, and then -z lazy to make it more useful when installed.

pws


  reply	other threads:[~2023-06-06  9:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-04 13:51 Marcus Müller
2023-06-04 20:37 ` Marcus Müller
2023-06-04 21:17   ` Philippe Troin
2023-06-05 19:35     ` Marcus Müller
2023-06-05 20:07       ` Bart Schaefer
2023-06-06  6:42         ` Jun T
2023-06-06  9:05           ` Peter Stephenson [this message]
2023-06-06 14:38             ` Jun. T
2023-06-06 15:01               ` Peter Stephenson
2023-06-06 16:37                 ` Philippe Troin
2023-06-06 17:54                   ` Mikael Magnusson
2023-06-07  2:05                     ` Jun T
2023-06-07  2:35                       ` Jun T
2023-06-07 14:40                         ` Jun. T
2023-06-23 13:41                           ` Jun. T
2023-06-07  9:25         ` Marcus Müller
2023-06-04 22:41   ` Axel Beckert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1604572963.1688389.1686042332603@mail.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).