Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 9 Jul 2017 08:23:25 -0400
From: Rich Felker <>
Subject: Re: Question about setting argv[0] when manually using
 dynamic linker

On Sun, Jul 09, 2017 at 11:23:23AM +0200, wrote:
> On Tue, Jul 04, 2017 at 04:58:11PM -0400, Rich Felker wrote:
> > On Sun, Jul 02, 2017 at 07:36:19PM +0200, wrote:
> > > On Wed, May 17, 2017 at 12:24:28PM -0400, Rich Felker wrote:
> > > > Perhaps adding an option like --argv0=foo would be
> > > > appropriate.
> > > 
> > > Is this option being considered to introduce?
> > Yes, adding it.
> Thanks again, it makes some "unsolvable" cases work as needed.
> OTOH when applying this in practice, I noticed that a slightly
> different behaviour would be very handy: if the linker could
> supply its own argv[0] as the one for the program to run.
> This would fit nicely into the framework where we already set argv[0]
> anyway, in the same way for both statically and dynamically linked
> programs. (The only exception so far would be a hypothetical need to
> pass on the value "ldd" as argv[0], then --argv0=ldd would save the day)
> Otherwise we have to set the dynloader --argv0 argument per binary
> which is of course possible but remarkably less convenient,
> among others because this setting is dynloader-specific, while
> otherwise our tools are libc- and dynamic vs static agnostic.
> IOW as long as the loader itself does not rely on its argv[0]
> too much, plainly passing on argv[0] is a very practical means to
> handle the programs like busybox and gcc transparently.
> What about always passing on the loader argv[0] unless --argv0 is present?
> This will not matter for programs which do not analyze argv[0]
> and will not make it worse for programs which do.

This would be a regression in existing behavior and basically breaks
any scripts where the program run wants argv[0] to be its own name.
Otherwise I agree it would be a nicer interface. But I don't see any
reason your invoking program can't just pass the same string it passes
as argv[0] at exec time also as the argument to --argv0.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.