Messages in this thread | | | From | (Eric W. Biederman) | Date | Tue, 19 Apr 2016 15:32:15 -0500 | Subject | Re: Does anyone care about a race free ptsname? |
| |
"H. Peter Anvin" <hpa@zytor.com> 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 definition. If > what you worry about is namespace reshuffling then ptsname() is the > wrong interface in the first place since it returns a pathname.
Good point. Yes if we are not using devpts_mnt (hooray!) there should be no complications, and the largest check we would need is to verify that /dev/ptmx is in the current namespace.
> Fwiw, in klibc ptsname() is basically just an sprintf().
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 available of where devpts is mounted in relationship to /dev/ptmx I have no more concerns about implementing ptsname. Path pased is also sufficiently backwards compatible it would not usually be wrong even on existing kernels.
Good enough.
Eric
| |