Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758814AbcDHTEl (ORCPT ); Fri, 8 Apr 2016 15:04:41 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:49383 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752365AbcDHTEk (ORCPT ); Fri, 8 Apr 2016 15:04:40 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Al Viro Cc: Linus Torvalds , "H. Peter Anvin" , Peter Hurley , Greg KH , Jiri Slaby , Aurelien Jarno , Andy Lutomirski , Florian Weimer , Serge Hallyn , Jann Horn , "security\@kernel.org" , security@ubuntu.com, security@debian.org, Willy Tarreau , Linux Kernel Mailing List References: <878u0s3orx.fsf_-_@x220.int.ebiederm.org> <1459819769-30387-1-git-send-email-ebiederm@xmission.com> <20160405025425.GK17997@ZenIV.linux.org.uk> <20160405030333.GL17997@ZenIV.linux.org.uk> Date: Fri, 08 Apr 2016 13:54:01 -0500 In-Reply-To: <20160405030333.GL17997@ZenIV.linux.org.uk> (Al Viro's message of "Tue, 5 Apr 2016 04:03:33 +0100") Message-ID: <87lh4oorsm.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1+ctaVnE5zTrWJwHecwDcitv4ikQ1o1dmI= X-SA-Exim-Connect-IP: 67.3.249.252 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Al Viro X-Spam-Relay-Country: X-Spam-Timing: total 5842 ms - load_scoreonly_sql: 0.09 (0.0%), signal_user_changed: 5 (0.1%), b_tie_ro: 3.6 (0.1%), parse: 1.56 (0.0%), extract_message_metadata: 14 (0.2%), get_uri_detail_list: 1.25 (0.0%), tests_pri_-1000: 4.9 (0.1%), tests_pri_-950: 1.02 (0.0%), tests_pri_-900: 0.89 (0.0%), tests_pri_-400: 23 (0.4%), check_bayes: 22 (0.4%), b_tokenize: 6 (0.1%), b_tok_get_all: 8 (0.1%), b_comp_prob: 2.3 (0.0%), b_tok_touch_all: 3.2 (0.1%), b_finish: 0.68 (0.0%), tests_pri_0: 832 (14.2%), check_dkim_signature: 0.47 (0.0%), check_dkim_adsp: 6 (0.1%), tests_pri_500: 4955 (84.8%), poll_dns_idle: 4948 (84.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH 01/13] devpts: Teach /dev/ptmx to find the associated devpts via path lookup X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 33 Al Viro 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