[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160420014840.GA3926@mail.hallyn.com>
Date: Tue, 19 Apr 2016 20:48:41 -0500
From: "Serge E. Hallyn" <serge@...lyn.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andy Lutomirski <luto@...capital.net>, security@...ian.org,
"security@...nel.org" <security@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
"security@...ntu.com >> security" <security@...ntu.com>,
Peter Hurley <peter@...leysoftware.com>,
Serge Hallyn <serge.hallyn@...ntu.com>,
Willy Tarreau <w@....eu>,
Aurelien Jarno <aurelien@...el32.net>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
Jann Horn <jann@...jh.net>, Greg KH <greg@...ah.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jiri Slaby <jslaby@...e.com>, Florian Weimer <fw@...eb.enyo.de>
Subject: Re: Does anyone care about a race free ptsname?
On Tue, Apr 19, 2016 at 04:39:07PM -0700, H. Peter Anvin wrote:
> On 04/19/2016 04:23 PM, Linus Torvalds wrote:
> > On Tue, Apr 19, 2016 at 11:44 AM, Eric W. Biederman
> > <ebiederm@...ssion.com> wrote:
> >>
> >> I will take a look in a minute. Before I do that I want to mention
> >> why I care about /dev/pts/ptmx.
> >>
> >> There is a posix function that is widely used called ptsname. It's
> >> function is to take a master file descriptor and returns the path to the
> >> slave.
> >>
> >> All we have in the kernel to support ptsname is an ioctl TIOCGPTN that
> >> returns the pty number in the appropriate instance of devpts.
> >
> > Don't bother with that completely mis-designed interface.It's crap.
> >
> > So we'll keep it working for legacy models, but the whole "return an
> > integer index" is just pure shit. It's not worth worrying about.
> >
> > We can (and probably should) just introduce a new ioctl or even a
> > system call that just does the sane thing and returns the pathname
> > from the kernel.
> >
>
> What do you think of the idea of TIOCPTSOPEN (or whatever) to get a file
> descriptor for the slave device given the master device? Then we can
That's what i was thinking, since as I said many users just want
blah = ptsname(fd);
slavefd = open(blah, ...);
so they really just want an open fd.
> use realpath() or a readlink on /proc/self/fd/# to get the pathname if
> needed.
>
> (Incidentally, we added getcwd() as a system call. Should we add
> [f]realpath() as a system call too?)
>
> -hpa
Powered by blists - more mailing lists