[BusyBox] bug report - halt/reboot/poweroff error
Erik Andersen
andersen at lineo.com
Thu Sep 14 20:34:06 UTC 2000
On Thu Sep 14, 2000 at 12:39:18PM -0600, Erik Andersen wrote:
> >
> > I believe that these applets should be searching for linuxrc rather than
> > init. Does the attached patch fix your problems?
> >
> > Matt
>
> I don't think that is it, since in init.c I force argv[0] to be "init"...
> (about line 977):
>
> /* Fix up argv[0] to be certain we claim to be init */
> strncpy(argv[0], "init", strlen(argv[0])+1);
>
> I think this is a bug that is showing up in findPidByName(). I'll start
> digging into this one -- this looks like a release critical bug to me...
Unable to see an reasonable cause in the source, I quickly slapped
together a floppy disk with a busybox based initrd on it...
It turns out that when init runs in an initrd, not only is it not
run as PID 1, it does not end up getting everything properly set
up in /proc as one would expect.
Standard system (not running from initrd):
# cat /proc/1/cmdline
init [3]
# cat /proc/1/status | head -n1
Name: init
System running from initrd:
# cat /proc/1/cmdline
# cat /proc/1/status | head -n1
Name: swapper
Since findPidByName looks in /proc/*/status to match process names --
it walks the list of all PIDs, doesn't find any matching the word
"init", and returns a NULL list of PIDs. reboot dereferences the
NULL and Boom...
-Erik
--
Erik B. Andersen email: andersen at lineo.com
--This message was written using 73% post-consumer electrons--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 350 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20000914/d0807056/attachment.pgp
More information about the busybox
mailing list