Re: Does anyone care about a race free ptsname?

2016-04-19 Thread Serge E. Hallyn
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 > > wrote: > >> > >> I will take a look in a minute. Before I do that I want to mention > >> why I care about /dev/pts/ptmx. > >

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread Linus Torvalds
On Tue, Apr 19, 2016 at 4:39 PM, H. Peter Anvin wrote: > > 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 > use realpath() or a readlink on /proc/self/fd/# to get the pathname if > needed. That sound

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread H. Peter Anvin
On 04/19/2016 04:23 PM, Linus Torvalds wrote: > On Tue, Apr 19, 2016 at 11:44 AM, Eric W. Biederman > 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 >> fu

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread Linus Torvalds
On Tue, Apr 19, 2016 at 11:44 AM, Eric W. Biederman 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 t

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread H. Peter Anvin
On 04/19/2016 01:32 PM, Eric W. Biederman wrote: > > The challenge came in operations such as granpt. Where you are passed > in a ptmx file descriptor from who knows where, and you pass it on > to applications such as pt_chown which run with elevatated privileged. > > As the information is avail

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread Eric W. Biederman
"H. Peter Anvin" writes: > We could add another ioctl for that purpose of we need to. Perhaps an > ioctl which returns a file descriptor to the slave device? > > However, since we are now defining ptmx to explicitly look up pts/ by > name it seems like /dev/ptmx -> /dev/pts/# is true by definiti

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread Serge E. Hallyn
Quoting Eric W. Biederman (ebied...@xmission.com): > Linus Torvalds writes: > > > What this does is get rid of the horrible notion of having that > > > > struct inode *ptmx_inode > > > > be the interface between the pty code and devpts. By de-emphasizing the > > ptmx inode, a lot of things a

Re: Does anyone care about a race free ptsname?

2016-04-19 Thread H. Peter Anvin
On April 19, 2016 11:44:40 AM PDT, ebied...@xmission.com wrote: >Linus Torvalds writes: > >> What this does is get rid of the horrible notion of having that >> >> struct inode *ptmx_inode >> >> be the interface between the pty code and devpts. By de-emphasizing >the >> ptmx inode, a lot of th

Does anyone care about a race free ptsname?

2016-04-19 Thread Eric W. Biederman
Linus Torvalds writes: > What this does is get rid of the horrible notion of having that > > struct inode *ptmx_inode > > be the interface between the pty code and devpts. By de-emphasizing the > ptmx inode, a lot of things actually get cleaner, and we will have a much > saner way forward.