From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serge Hallyn Subject: Re: [RFC] fix devpts mount behavior Date: Tue, 24 Jan 2012 17:16:01 -0600 Message-ID: <20120124231601.GA4470@sergelap> References: <20120124000517.GA28878@sergelap> <20120124002555.GA29534@sergelap> <20120124010758.GJ23916@ZenIV.linux.org.uk> <20120124220247.GA26353@hallyn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Kay Sievers Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Dave Hansen , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Al Viro , "Eric W. Biederman" , Andy Whitcroft , sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, Linus Torvalds List-Id: containers.vger.kernel.org Quoting Kay Sievers (kay.sievers-tD+1rO4QERM@public.gmane.org): > On Tue, Jan 24, 2012 at 23:02, Serge E. Hallyn wrote: > > Quoting Eric W. Biederman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org): > = > >> It looks like relatively recent udev still creates /dev/ptmx and does > > > > Boy, it does, and it's stubborn about it. =A0Removing the /lib/udev/rul= es.d > > entry doesn't stop it. =A0(this is after I've had an init job replace t= he > > 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=3D666, > = > > (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=3Dn (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=3D5 > MINOR=3D2 > DEVNAME=3Dptmx > DEVMODE=3D0666 That has nothing to do with /dev/pts/ptmx, whose perms are set based on the '-o ptmxmode=3D" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753178Ab2AXXQc (ORCPT ); Tue, 24 Jan 2012 18:16:32 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:46718 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752706Ab2AXXQb (ORCPT ); Tue, 24 Jan 2012 18:16:31 -0500 Date: Tue, 24 Jan 2012 17:16:01 -0600 From: Serge Hallyn To: Kay Sievers Cc: "Serge E. Hallyn" , containers@lists.linux-foundation.org, Dave Hansen , linux-kernel@vger.kernel.org, "Eric W. Biederman" , Andy Whitcroft , sukadev@linux.vnet.ibm.com, Linus Torvalds , Al Viro Subject: Re: [RFC] fix devpts mount behavior Message-ID: <20120124231601.GA4470@sergelap> References: <20120124000517.GA28878@sergelap> <20120124002555.GA29534@sergelap> <20120124010758.GJ23916@ZenIV.linux.org.uk> <20120124220247.GA26353@hallyn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Kay Sievers (kay.sievers@vrfy.org): > On Tue, Jan 24, 2012 at 23:02, Serge E. Hallyn 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