[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877fftiblc.fsf@x220.int.ebiederm.org>
Date: Tue, 19 Apr 2016 15:32:15 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>, security@...ian.org,
"security\@kernel.org" <security@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
"security\@ubuntu.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?
"H. Peter Anvin" <hpa@...or.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
Powered by blists - more mailing lists