[Piuparts-devel] Bug#911334: Bug#911334: Create /dev/ptmx like debootstrap does

Mathieu Parent math.parent at gmail.com
Wed Oct 24 07:12:58 BST 2018


Le ven. 19 oct. 2018 à 10:05, Andreas Beckmann <anbe at debian.org> a écrit :
[...]
> >
> > In this case, piuparts does something like this:
> >
> >     touch /dev/ptmx
> >     mount -o bind /dev/pts/ptmx /dev/ptmx
>
> That sounds wrong, since we have
>
> self.mount("devpts", "/dev/pts", fstype="devpts", opts="newinstance,noexec,nosuid,gid=5,mode=0620,ptmxmode=0666")
> self.mount(self.relative("dev/pts/ptmx"), "/dev/ptmx", opts="bind", no_mkdir=True)
>
> and your change would take the /dev/pts/ptmx from the host.

Not from the host, as chroot/dev/ptmx mount is not changed and has "newinstance"
""

To retain backwards compatibility the a ptmx device node (aka any node
created with "mknod name c 5 2") when opened will look for an instance
of devpts under the name "pts" in the same directory as the ptmx device
node.

""


(See https://www.kernel.org/doc/Documentation/filesystems/devpts.txt)

> > The kernel doc [devpts.txt] recommends instead:
> >
> >     mknod /dev/ptmx c 5 2
> >
> > And this is what debootstrap does [debootstrap].
>
> as can be seen in the piuparts chroot tarball:
>
> $ less sid_amd64.tar.gz | grep /dev/
> drwxr-xr-x root/root         0 2018-10-18 20:36 ./dev/
> crw--w---- piupartss/tty 136,8 2018-10-18 20:29 ./dev/console
> lrwxrwxrwx root/root         0 2018-10-18 20:31 ./dev/stderr -> /proc/self/fd/2
> lrwxrwxrwx root/root         0 2018-10-18 20:31 ./dev/stdout -> /proc/self/fd/1
> lrwxrwxrwx root/root         0 2018-10-18 20:31 ./dev/stdin -> /proc/self/fd/0
> lrwxrwxrwx root/root         0 2018-10-18 20:31 ./dev/fd -> /proc/self/fd
> crw-rw-rw- root/root       5,2 2018-10-18 20:36 ./dev/ptmx
> drwxrwxrwt root/root         0 2018-10-18 20:36 ./dev/shm/
> drwxr-xr-x root/root         0 2018-10-18 20:36 ./dev/pts/
> crw-rw-rw- root/root       5,0 2018-10-18 20:31 ./dev/tty
> crw-rw-rw- root/root       1,9 2018-10-18 20:31 ./dev/urandom
> crw-rw-rw- root/root       1,8 2018-10-18 20:31 ./dev/random
> crw-rw-rw- root/root       1,7 2018-10-18 20:31 ./dev/full
> crw-rw-rw- root/root       1,5 2018-10-18 20:31 ./dev/zero
> crw-rw-rw- root/root       1,3 2018-10-18 20:31 ./dev/null
>
> and piuparts mounts the ptmx from $chroot/dev/pts/ptmx
> (newinstance devpts) over $chroot/dev/ptmx

If you want to keep this, I can do this.

> > I propose to map the piuparts behavior with debootstrap's.
> >
> > My proposed change is at
> > https://salsa.debian.org/debian/piuparts/merge_requests/2
>
> NACK until I understand the problem.
>
> Might we actually have two different problems here?
>
> * dev/ptmx not being set up correctly in the chroot

It is not setup at all. Neither is dev/pts.

> * something throwing an insecure permissions error?

I don't think so.

Will propose another change.

-- 
Mathieu Parent



More information about the Piuparts-devel mailing list