Re: UNIX98 Ptys and chroot bug/question

Valentin Podlovchenko (valya@comstar.ru)
Thu, 25 Nov 1999 08:43:33 +0300


On Wed, Nov 24, 1999 at 09:40:55PM +0000, H. Peter Anvin wrote:
> > in basic root:
> > >ls -l /dev/pts/
> > total 0
> > crw--w---- 1 valya tty 136, 0 Nov 24 13:25 0
> > crw--w--w- 1 root root 136, 1 Nov 24 13:25 1
> >
> > in chroot:
> > >chroot /web/ !!
> > chroot /web/ ls -l /dev/pts/
> > total 0
> > crw--w--w- 1 root root 136, 0 Nov 24 12:16 0
> > crw--w---- 1 valya tty 136, 1 Nov 24 13:25 1
> >
> > --------------------------------------------------------------
> > - pty 0 was logged in basic root and pty 1 in chrooted partition.
> >
> >
> > so any user from basic root system can write to chrooted pty and
> > any user from chroot can write to basic root ptys.
> >
> > It seems to me slightly wrong ;)
>
> Yes, this is a problem. There aren't that many people using chroot in
> such a way as that they need pty's, so this hasn't been extensively
> tested. What are your mount options for /dev/pts and /web/dev/pts?

Here are my /etc/fstab files:

In basic root:
>cat /etc/fstab
/dev/sda1 / ext2 defaults 1 1
/dev/sda6 /home ext2 defaults,nosuid 1 2
/dev/sda5 /usr ext2 defaults 1 2
/dev/sda3 /var ext2 defaults,nosuid 1 2
/dev/sda7 /web ext2 defaults,nosuid 1 2
/dev/md0 /web/pages ext2 defaults,nosuid,usrquota 1 2
/dev/sda2 swap swap defaults 0 0
/dev/fd0 /mnt/floppy ext2 noauto 0 0
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0

In chroot:
>cat /web/etc/fstab
/dev/sda7 / ext2 defaults 1 2
/dev/md0 /pages ext2 defaults,usrquota 1 2
/dev/sda2 swap swap defaults 0 0
/dev/fd0 /mnt/floppy ext2 noauto 0 0
none /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0

I need fstab in chroot for some reasons:
1. Users must think that they are in hole system ;)
2. Many programs (such ps, kill, top, etc.) need /proc to be mounted in
chroot.
3. Procceses that allocates ptys (telnet) need /dev/pts/ to be mounted
in chroot too.

-- 
 Podlovchenko Valentin,                        E-mail: <valya@comstar.ru>
 Comstar Telecommunications                    Tel.: +7 (095) 232-1180
                                               Fax: +7 (095) 956-2205 

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