From: "Serge E. Hallyn" <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Dave Hansen <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
Andy Whitcroft <apw-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
Linus Torvalds
<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [RFC] fix devpts mount behavior
Date: Tue, 24 Jan 2012 22:02:47 +0000 [thread overview]
Message-ID: <20120124220247.GA26353@hallyn.com> (raw)
In-Reply-To: <m1k44gj1cu.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
Quoting Eric W. Biederman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org):
> Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> writes:
>
> > On Mon, Jan 23, 2012 at 04:41:25PM -0800, Linus Torvalds wrote:
> >
> >> Right. I think the opportunity for problems should be pretty small.
> >>
> >> And it's not like the pty itself wouldn't continue to work - it's just
> >> that programs like /usr/bin/tty wouldn't be able to *find* it.
> >>
> >> Although who knows - maybe there is some other subtle interaction.
> >
> > FWIW, the subtle and nasty part in all that is that you can mknod /dev/ptmx
> > and it *will* work, refering to the "initial" instance. That's what
> > concerns me about the chroot scenarios -
> > mknod /jail/dev/ptmx c 5 2
> > mkdir /jail/dev/pts
> > mount -t devpts /jail/dev/pts
> > chroot /jail
> > works fine right now, but with that change behaviour will be all wrong -
> > opening /dev/ptmx inside of jail will grab you a pts, all right, but
> > it will *not* show up in (jail) /dev/pts/* as it does with the current
> > kernel.
> >
> > Note that if you replace that mknod with symlink pts/ptmx /jail/dev/ptmx
> > the things will keep working. However, that will _only_ work for kernels
> > with DEVPTS_MULTIPLE_INSTANCES - without it you won't get ptmx inside
> > devpts (which is arguably wrong, BTW)
>
> For testing I would recommend looking at the distro chroot build cases.
Do you have a specific example in mind? I would expect build chroots
generally don't mount a devpts.
> It looks like relatively recent udev still creates /dev/ptmx and does
Boy, it does, and it's stubborn about it. Removing the /lib/udev/rules.d
entry doesn't stop it. (this is after I've had an init job replace the
devtmpfs-created ptmx entry with a symlink)
So current distros (well, Ubuntu and Fedora at least) would need to at least
(a) fix udev, (b) change the default devpts mount (done from initramfs) to
add ptmxmode=666, (c) (if not done in udev) create the /dev/ptmx symlink.
For safety I'd recommend creating /dev/pts/ptmx with
DEVPTS_MULTIPLE_INSTANCES=n (or dropping that support), and by default
setting ptmxmode to 666 as that's what udev does.
> not create the symlink. So we might get into the awkward situation of
> /dev/ptmx not matching /dev/pts/ptmx with something as simple as
> initramfs mounting /dev/pts and then initscripts mounting /dev/pts.
That shouldn't matter with a symlink, though it is sloppy.
-serge
WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serge@hallyn.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
containers@lists.linux-foundation.org,
Dave Hansen <haveblue@us.ibm.com>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>,
sukadev@linux.vnet.ibm.com,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC] fix devpts mount behavior
Date: Tue, 24 Jan 2012 22:02:47 +0000 [thread overview]
Message-ID: <20120124220247.GA26353@hallyn.com> (raw)
In-Reply-To: <m1k44gj1cu.fsf@fess.ebiederm.org>
Quoting Eric W. Biederman (ebiederm@xmission.com):
> Al Viro <viro@ZenIV.linux.org.uk> writes:
>
> > On Mon, Jan 23, 2012 at 04:41:25PM -0800, Linus Torvalds wrote:
> >
> >> Right. I think the opportunity for problems should be pretty small.
> >>
> >> And it's not like the pty itself wouldn't continue to work - it's just
> >> that programs like /usr/bin/tty wouldn't be able to *find* it.
> >>
> >> Although who knows - maybe there is some other subtle interaction.
> >
> > FWIW, the subtle and nasty part in all that is that you can mknod /dev/ptmx
> > and it *will* work, refering to the "initial" instance. That's what
> > concerns me about the chroot scenarios -
> > mknod /jail/dev/ptmx c 5 2
> > mkdir /jail/dev/pts
> > mount -t devpts /jail/dev/pts
> > chroot /jail
> > works fine right now, but with that change behaviour will be all wrong -
> > opening /dev/ptmx inside of jail will grab you a pts, all right, but
> > it will *not* show up in (jail) /dev/pts/* as it does with the current
> > kernel.
> >
> > Note that if you replace that mknod with symlink pts/ptmx /jail/dev/ptmx
> > the things will keep working. However, that will _only_ work for kernels
> > with DEVPTS_MULTIPLE_INSTANCES - without it you won't get ptmx inside
> > devpts (which is arguably wrong, BTW)
>
> For testing I would recommend looking at the distro chroot build cases.
Do you have a specific example in mind? I would expect build chroots
generally don't mount a devpts.
> It looks like relatively recent udev still creates /dev/ptmx and does
Boy, it does, and it's stubborn about it. Removing the /lib/udev/rules.d
entry doesn't stop it. (this is after I've had an init job replace the
devtmpfs-created ptmx entry with a symlink)
So current distros (well, Ubuntu and Fedora at least) would need to at least
(a) fix udev, (b) change the default devpts mount (done from initramfs) to
add ptmxmode=666, (c) (if not done in udev) create the /dev/ptmx symlink.
For safety I'd recommend creating /dev/pts/ptmx with
DEVPTS_MULTIPLE_INSTANCES=n (or dropping that support), and by default
setting ptmxmode to 666 as that's what udev does.
> not create the symlink. So we might get into the awkward situation of
> /dev/ptmx not matching /dev/pts/ptmx with something as simple as
> initramfs mounting /dev/pts and then initscripts mounting /dev/pts.
That shouldn't matter with a symlink, though it is sloppy.
-serge
next prev parent reply other threads:[~2012-01-24 22:02 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 0:05 [RFC] fix devpts mount behavior Serge Hallyn
2012-01-24 0:05 ` Serge Hallyn
2012-01-24 0:13 ` Linus Torvalds
2012-01-24 0:13 ` Linus Torvalds
[not found] ` <CA+55aFz9ofF+Ey8VCDS8UEf2XSw36kj2RhkHfFScuzLXMeNrkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-24 0:25 ` Serge Hallyn
2012-01-24 0:25 ` Serge Hallyn
2012-01-24 0:41 ` Linus Torvalds
2012-01-24 0:41 ` Linus Torvalds
[not found] ` <CA+55aFzwOU137V6wtyBjessx05NJo2G4KV0rvTKWvC79A+o9iQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-24 1:07 ` Al Viro
2012-01-24 1:07 ` Al Viro
[not found] ` <20120124010758.GJ23916-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2012-01-24 18:21 ` Serge E. Hallyn
2012-01-24 18:21 ` Serge E. Hallyn
2012-01-24 20:16 ` Sukadev Bhattiprolu
[not found] ` <20120124201600.GB20039-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2012-01-24 20:53 ` Serge E. Hallyn
2012-01-24 20:53 ` Serge E. Hallyn
[not found] ` <20120124182116.GA11715-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2012-01-24 20:16 ` Sukadev Bhattiprolu
2012-01-24 20:24 ` Eric W. Biederman
2012-01-24 20:24 ` Eric W. Biederman
[not found] ` <m1k44gj1cu.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2012-01-24 22:02 ` Serge E. Hallyn [this message]
2012-01-24 22:02 ` Serge E. Hallyn
[not found] ` <20120124220247.GA26353-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
2012-01-24 22:54 ` Kay Sievers
2012-01-24 22:54 ` Kay Sievers
[not found] ` <CAPXgP13_gczQmG_USAp0p2AuTfxkzAvzHvjbZY_rbbLH-4rDyg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-24 23:16 ` Serge Hallyn
2012-01-24 23:16 ` Serge Hallyn
2012-01-24 23:25 ` Sukadev Bhattiprolu
2012-01-24 23:25 ` Sukadev Bhattiprolu
[not found] ` <20120124232502.GA22218-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2012-01-24 23:29 ` Serge E. Hallyn
2012-01-24 23:29 ` Serge E. Hallyn
2012-01-24 23:27 ` Kay Sievers
2012-01-24 23:27 ` Kay Sievers
[not found] ` <CAPXgP12REAwmDORzdGJhsxZKU8nhiauCxoVdKa8Eifw4MWWtgA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-28 19:51 ` Serge Hallyn
2012-01-28 19:51 ` Serge Hallyn
2012-01-28 20:52 ` Eric W. Biederman
2012-01-28 20:52 ` Eric W. Biederman
[not found] ` <m139azpn2n.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2012-01-28 21:32 ` Kay Sievers
2012-01-28 21:32 ` Kay Sievers
2012-09-23 3:47 ` [PATCH 0/4] devpts: " Eric W. Biederman
2012-09-23 3:47 ` Eric W. Biederman
[not found] ` <87txup763i.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-23 3:48 ` [PATCH 1/4] devpts: Remove CONFIG_DEVPTS_MULTIPLE_INSTANCES Eric W. Biederman
2012-09-23 3:48 ` Eric W. Biederman
2012-09-23 3:49 ` [PATCH 2/4] devpts: Set the default permissions of /dev/pts/ptmx and /dev/ptmx to 0666 Eric W. Biederman
2012-09-23 3:49 ` Eric W. Biederman
2012-09-23 3:50 ` [PATCH 3/4] devpts: Make the newinstance option historical Eric W. Biederman
2012-09-23 3:50 ` Eric W. Biederman
[not found] ` <87d31d75yj.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-23 4:19 ` Al Viro
2012-09-23 4:19 ` Al Viro
[not found] ` <20120923041906.GM13973-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2012-09-23 4:46 ` Al Viro
2012-09-23 4:46 ` Al Viro
2012-09-23 5:59 ` Eric W. Biederman
2012-09-23 5:59 ` Eric W. Biederman
[not found] ` <87bogx5lg7.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-23 6:30 ` Al Viro
2012-09-23 6:30 ` Al Viro
[not found] ` <20120923063038.GO13973-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2012-09-23 6:34 ` Al Viro
2012-09-23 6:34 ` Al Viro
[not found] ` <20120923063445.GA26640-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2012-09-23 7:00 ` Eric W. Biederman
2012-09-23 7:00 ` Eric W. Biederman
2012-09-23 3:51 ` [PATCH 4/4] devpts: Update the documentation Eric W. Biederman
2012-09-23 3:51 ` Eric W. Biederman
2012-09-23 16:48 ` [PATCH 0/4] devpts: fix devpts mount behavior H. Peter Anvin
2012-09-23 16:48 ` H. Peter Anvin
[not found] ` <505F3D48.7080103-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2012-09-23 17:42 ` Eric W. Biederman
2012-09-23 17:42 ` Eric W. Biederman
[not found] ` <87txuo3abb.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2012-09-23 17:44 ` H. Peter Anvin
2012-09-23 17:44 ` H. Peter Anvin
2012-01-24 23:35 ` [RFC] " Eric W. Biederman
2012-01-24 23:35 ` Eric W. Biederman
2012-01-24 20:55 ` Sukadev Bhattiprolu
2012-01-24 20:55 ` Sukadev Bhattiprolu
[not found] ` <20120124205502.GC20039-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2012-01-24 21:19 ` Nick Bowler
2012-01-24 21:19 ` Nick Bowler
2012-01-24 0:26 ` Al Viro
2012-01-24 0:26 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120124220247.GA26353@hallyn.com \
--to=serge-a9i7lubdfnhqt0dzr+alfa@public.gmane.org \
--cc=apw-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.