public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Serge Hallyn <serge.hallyn@canonical.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
	containers@lists.linux-foundation.org,
	Dave Hansen <haveblue@us.ibm.com>,
	linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andy Whitcroft <apw@canonical.com>,
	sukadev@linux.vnet.ibm.com,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [RFC] fix devpts mount behavior
Date: Tue, 24 Jan 2012 17:16:01 -0600	[thread overview]
Message-ID: <20120124231601.GA4470@sergelap> (raw)
In-Reply-To: <CAPXgP13_gczQmG_USAp0p2AuTfxkzAvzHvjbZY_rbbLH-4rDyg@mail.gmail.com>

Quoting Kay Sievers (kay.sievers@vrfy.org):
> On Tue, Jan 24, 2012 at 23:02, Serge E. Hallyn <serge@hallyn.com> wrote:
> > Quoting Eric W. Biederman (ebiederm@xmission.com):
> 
> >> 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)
> 
> Udev has nothing to do with that. The kernel creates that device node.
> Udev does not carry any rules you could remove, to name device nodes,
> it only set permissions and creates symlinks to device nodes.

That's odd, because I was sure I deleted the node after the kernel created
it.

But it sounds like I must have done it wrong.

> It will never replace a kernel-created device node with a symlink,
> there is no way to express that. If you don't want a device node
> there, you need to change the kernel, to not export
> /sys/class/tty/ptmx/ the way it is today.
> 
> > So current distros (well, Ubuntu and Fedora at least) would need to at least
> > (a) fix udev,
> 
> To do what?

Nothing, as I'm sure you're right above  :)

> > (b) change the default devpts mount (done from initramfs) to
> > add ptmxmode=666,
> 
> > (c) (if not done in udev) create the /dev/ptmx symlink.
> 
> Udev can only create symlinks to devices the driver-core creates, not
> to devices inside a custom filesystem.

I see.

> > 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.
> 
> The mode for ptmx is set by the kernel itself, and does not even need
> udev to do that:
>   $ cat /sys/class/tty/ptmx/uevent
>   MAJOR=5
>   MINOR=2
>   DEVNAME=ptmx
>   DEVMODE=0666

That has nothing to do with /dev/pts/ptmx, whose perms are set based on
the '-o ptmxmode=" argument, and default to 000 if not specified.  If
/dev/ptmx is going to be a symlink to /dev/pts/ptmx, then we have to set
the /dev/pts/ptmx perms to not be 000, or users won't be able to create
ptys.

-serge

  reply	other threads:[~2012-01-24 23:16 UTC|newest]

Thread overview: 36+ 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:13 ` Linus Torvalds
2012-01-24  0:25   ` Serge Hallyn
2012-01-24  0:41     ` Linus Torvalds
2012-01-24  1:07       ` Al Viro
2012-01-24 18:21         ` Serge E. Hallyn
2012-01-24 20:16           ` Sukadev Bhattiprolu
2012-01-24 20:53             ` Serge E. Hallyn
2012-01-24 20:24         ` Eric W. Biederman
2012-01-24 22:02           ` Serge E. Hallyn
2012-01-24 22:54             ` Kay Sievers
2012-01-24 23:16               ` Serge Hallyn [this message]
2012-01-24 23:25                 ` Sukadev Bhattiprolu
2012-01-24 23:29                   ` Serge E. Hallyn
2012-01-24 23:27                 ` Kay Sievers
2012-01-28 19:51                   ` Serge Hallyn
2012-01-28 20:52                     ` Eric W. Biederman
2012-01-28 21:32                       ` Kay Sievers
2012-09-23  3:47                     ` [PATCH 0/4] devpts: " Eric W. Biederman
2012-09-23  3:48                       ` [PATCH 1/4] devpts: Remove CONFIG_DEVPTS_MULTIPLE_INSTANCES 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:50                       ` [PATCH 3/4] devpts: Make the newinstance option historical Eric W. Biederman
2012-09-23  4:19                         ` Al Viro
2012-09-23  4:46                           ` Al Viro
2012-09-23  5:59                           ` Eric W. Biederman
2012-09-23  6:30                             ` Al Viro
2012-09-23  6:34                               ` Al Viro
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 16:48                       ` [PATCH 0/4] devpts: fix devpts mount behavior H. Peter Anvin
2012-09-23 17:42                         ` Eric W. Biederman
2012-09-23 17:44                           ` H. Peter Anvin
2012-01-24 23:35             ` [RFC] " Eric W. Biederman
2012-01-24 20:55       ` Sukadev Bhattiprolu
2012-01-24 21:19         ` Nick Bowler
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=20120124231601.GA4470@sergelap \
    --to=serge.hallyn@canonical.com \
    --cc=apw@canonical.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=haveblue@us.ibm.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=sukadev@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox