Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170517211018.GN6320@example.net>
Date: Wed, 17 May 2017 23:10:18 +0200
From: u-uy74@...ey.se
To: musl@...ts.openwall.com
Subject: Re: Question about setting argv[0] when manually using
 dynamic linker

On Wed, May 17, 2017 at 02:16:09PM -0500, John Regan wrote:
> On Wed, May 17, 2017 at 2:07 PM, <u-uy74@...ey.se> wrote:
> > We do deploy dynamic linked apps without any dependencies on the libraries
> > on the host. It works just fine with musl-as-it-is, including the
> > questionably designed applications like busybox and gcc who
> > analyze argv[0].

> I wrote and compiled a short program that just dumps the elements in argv,
> then a wrapper program that figures out the needed paths for libc, real
> binary, etc, but it seems like argv[0] gets reset by the dynamic loader.

Oh, here you caught me.

Apologies.

Indeed the program does not see argv[0] because the linker shifts the
arguments.

Please disregard my statement above.

It is "correct" to the point that it works but yes we have
to do unpleasant tricks for the programs analyzing argv[0],
I just happened to have repressed that pain.

(We do also reset argv[0] but for an unrelated purpose, I confused the two
cases and posted without verifying).

Rich is right, there is indeed no good alternative to --argv0=foo.
It would be welcome.

Sorry for the noise!

Rune

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.