[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lh4oorsm.fsf@x220.int.ebiederm.org>
Date: Fri, 08 Apr 2016 13:54:01 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Hurley <peter@...leysoftware.com>,
Greg KH <greg@...ah.com>, Jiri Slaby <jslaby@...e.com>,
Aurelien Jarno <aurelien@...el32.net>,
Andy Lutomirski <luto@...capital.net>,
Florian Weimer <fw@...eb.enyo.de>,
Serge Hallyn <serge.hallyn@...ntu.com>,
Jann Horn <jann@...jh.net>,
"security\@kernel.org" <security@...nel.org>, security@...ntu.com,
security@...ian.org, Willy Tarreau <w@....eu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/13] devpts: Teach /dev/ptmx to find the associated devpts via path lookup
Al Viro <viro@...IV.linux.org.uk> writes:
> On Tue, Apr 05, 2016 at 03:54:25AM +0100, Al Viro wrote:
>
>> That, I take it, is a lookup for .. and buggering off if it fails *or* if
>> we had been in caller's root or something that overmount it? Not that the
>> latter had been possible - root is a directory and can be overmounted only
>> by another such, and we are called from ->open() of a device node.
>>
>> > + /* Remember the result of this permission check for later */
>> > + ret = inode_permission(path.dentry->d_inode, MAY_EXEC);
>> > + if (path_pts(&path))
>> > + goto fail;
>>
>> Egads, man - you've just introduced a special function for looking up
>> something named "pts" in a given directory!
>>
>> The reason not to use kern_path() would be what, the fact that it doesn't
>> allow starting at given location? So let's make a variant that would - and
>> rather than bothering with RCU, just go for something like (completely
>> untested)
>
> Ah... Right, that would demand exec permissions on the starting point.
> Still, this is incredibly ugly ;-/ I'll try to come up with something
> more tolerable, but this "path_pts" thing is too ugly to live.
> Seriously.
Given that I can think of no other reason than this special case to ever
want to use this code. I figured having something incredibily special
case and obviously so was the way to go. Then at least no one would
mistake it for a general purpose facility.
Eric
Powered by blists - more mailing lists