Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Herbert Riedel <hvr@hvrlab.ml.org>
To: axp-list@redhat.com
Subject: Discussion of DU/shlibs patch (was DU binaries and /sbin/loader (argv[0] problem?))
Date: Thu, 22 Oct 1998 14:15:53 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.04.9810221346530.1100-100000@phoenix.twisted.hvrlab.ml.org> (raw)
In-Reply-To: <Pine.LNX.3.96.981021115021.478B-100000@draal>

hi!

On Wed, 21 Oct 1998, Bob McElrath wrote:

> Some observations...been-a-hacking.
:)

> /sbin/loader gives the message: 
>   513:/sbin/loader: Fatal Error: loader cannot be invoked directly
I get the same message when I invoke /sbin/loader directly on a DU4.0b
host...
I think that's ok.
 
> where 513 is the PID of the process.  ps reveals:
>   (0)<mcelrath@draal:/home/mcelrath> ps aux | grep loader
>   mcelrath   512  4.3  6.1 22120 15728  ?  S    11:48   0:01 /sbin/loader 
>   mcelrath   513  0.0  0.0     0     0  ?  Z    11:48   0:00 (loader <zombie>)
> 
> Thus, the loader error is generated by a *SECOND* invocation of
> /sbin/loader.  The first succeeds, and loads netscape (or other program),
> but for some reason the kernel tries to load it *again*.  The zombie process
Well... (at least with DU4.0 libs) 

without any patch the following happens 

netscape ist started and is given argv0=/sbin/loader
then netscape wants to spawn some dns-helpers thus it does an

execl("/sbin/loader", "(dns-helper)", ...)

but that process doesn't get "(dns-helper)" as - argv0 neither is the
netscape binary loaded (cause netscape thinks it is /sbin/loader which
definitely isn't)

so the following patch-fragment did only solve the first problem
 
>>> -               bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
>>> +               bprm->p = copy_strings(1, dynloader, bprm->page, bprm->p, 2);

now, netscape is able to launch the right binary, cause the filename is
set as argv0... but then netscape checks on its start if its argv0 is
equal to "(dns-helper)", if so it will act as a dns-helper subprocess
otherwise it will try to fork some (actually 1) new subprocesses...

this all relies on the assumption that the second argument to execl() is
set as the argv0 of the new process... which isn't realized with the above
quoted patch... thus the process may loop forever... 

here comes in my patch(-hack)

>> -               bprm->p = copy_strings(1, dynloader, bprm->page, bprm->p, 2);
>> -               bprm->argc++;
>> +               bprm->argc--;

i just leave everything as is, that is I don't dare to set the argv0 of
the new process to anything new... 

this way an execl("/usr/lib/netscape/netscape", "(dns-helper)", ...) does
what it is supposed to do (as mentioned before, atleast with DU4 libs -
I don't know what happens with 3.2 libs... )

new process started from the executable "/usr/lib/netscape/netscape" and
it's argv0 is set to "(dns-helper)"... and everyone seems to be happy...

//EOF

Err...and forgive me if I made grammar/spelling mistakes while trying
to express myself... :)
--
"The idea that Bill Gates has appeared like a knight in shining armour to
lead all customers out of a mire of  technological chaos neatly ignores the
fact that it was he who, by peddling second-rate technology, led them into
it in the first place." - Douglas Adams, on Windows '95.



  reply	other threads:[~1998-10-22 12:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-20 12:32 DU binaries and /sbin/loader (argv[0] problem?) Aideen McConville
1998-10-20 13:47 ` Herbert Riedel
1998-10-21 16:53   ` Bob McElrath
1998-10-22 12:15     ` Herbert Riedel [this message]
1998-10-28 13:05       ` UDB serial port xstal freq? Carles Perello
1998-10-24  4:24 ` DU binaries and /sbin/loader (argv[0] problem?) (FIXED! PATCH!) Bob McElrath
1998-10-24 10:01   ` Herbert Riedel
1998-10-27  0:00     ` Kurt Garloff
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox