From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 23196 invoked from network); 22 Oct 1998 12:25:26 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 22 Oct 1998 12:25:26 -0000 Received: from phobos.hvrlab.ml.org (root@cable-modem113.m2.kabelnet.net [195.202.132.113]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id IAA13619 for ; Thu, 22 Oct 1998 08:16:20 -0400 Received: from phoenix.twisted.hvrlab.ml.org (phoenix.twisted.hvrlab.ml.org [10.51.1.3]) by phobos.hvrlab.ml.org (8.8.7/8.8.7) with ESMTP id OAA08850 for ; Thu, 22 Oct 1998 14:15:31 +0200 Date: Thu, 22 Oct 1998 14:15:53 +0200 (CEST) From: Herbert Riedel X-Sender: hvr@phoenix.twisted.hvrlab.ml.org To: axp-list@redhat.com Subject: Discussion of DU/shlibs patch (was DU binaries and /sbin/loader (argv[0] problem?)) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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) 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 ) > > 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.