lkml.org 
[lkml]   [2000]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Booting into /bin/bash
On Tue, 12 Sep 2000, Ion Badulescu wrote:

> On Tue, 12 Sep 2000, Ion Badulescu wrote:
>
> > Maybe I'll play with main.c and see what happens if I force /dev/console
> > to become the controlling tty for init. Hmm... That could be dangerous for
> > init. Maybe a better idea would be to hack init so that it gives any
> > program started from inittab /dev/console as the controlling tty.
> >
> > You're the sysvinit maintainer, right? :) What do you think of this idea?
>
> ... and init already does the above. :-) Except for one case: the
> emergency shell doesn't get a controlling tty. The first mini-patch below
> takes care of that problem.
>
> This still doesn't solve the original problem, i.e. init (or whatever you
> pass as init) still doesn't get a controlling tty from the kernel.
> However, since init appears to be safe from these issues, it it fairly
> trivial to fix this in the kernel; the second patch below takes care of
> it. The patch is against 2.2.17 but will apply against pretty much any 2.2
> and 2.4 kernel. It's is for i386 only, but the fixup for other
> architectures is extremely obvious.
>

Without patching the kernel, I think I can show that there is something
basically wrong. The patch may just hide the problem.

Something seems to be wrong, even with using the first virtual
terminal, which is a 'tty' and should (must) be able to become a
a controlling terminal.

Here is a trace:


getpid() = 6
open("/dev/tty1", O_RDWR|O_NONBLOCK) = 3
fcntl(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(3, F_SETFL, O_RDWR) = 0
dup2(3, 0) = 0
dup2(3, 1) = 1
dup2(3, 2) = 2
ioctl(3, TIOCSCTTY) = -1 EPERM (Operation not permitted)
close(3) = 0


This is a stock kernel version 2.2.15. The stuff necessary to make
'strace' run ends up with the 'init' PID of 6. FYI, it is a real
bear to 'strace' init's startup.

I haven't a clue why a UID/GID=0 process can't acquire a controlling
TTY.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.098 / U:7.372 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site