From: Al Viro Subject: Re: [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution Date: Wed, 13 Nov 2019 01:55:34 +0000 Message-ID: <20191113015534.GA26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-5-cyphar@cyphar.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lM3XkMKKdJ3Gup3VIapUeiMQf24CwH73FmNXuEI9IkY=; b=R7R5uKvcZFPJFu d0TG2xAynnGsU6nA6BbykSkEjYWioCfse3J7xaPIFEhg99TwJpbTVhhyAn8A+e4RyaVgRmD2p3r1J JrQlSqMYb9PfPlSr+ARJG55W3brgwo8SSTO7A5ZGlRdIYuKQc0Umv/aPQ2Jo89sdJta5l2vxS9rHM fJmf4lEQINMICy8CKu6wBV+ozhlCjE24qQVjMVDDGwV4VkpTuquoTraN0SS+u332vmlDhHFCQI4zY YCchK6GgNN7pw0uaoPppKPBvL6AaFtzUlsS/jWXSXkroJwZa8BlVTMoVCEt3stxp/h6JgAOda9CaO /++svhn3Xyta416ly9/Q==; Content-Disposition: inline In-Reply-To: <20191105090553.6350-5-cyphar@cyphar.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Aleksa Sarai Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , linux-kernel@vger.kernel.org, David Howells , linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Christian Brauner , Shuah Khan , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , Jiri Olsa , Alexander Shishkin , Ingo Molnar , linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, Kees Cook , Arnd Bergmann , Jann Horn , linuxppc-dev@lists.ozlabs.org, linux-m68k@lists.linux-m68k.org, An On Tue, Nov 05, 2019 at 08:05:48PM +1100, Aleksa Sarai wrote: Minor nit here - I'd split "move the conditional call of set_root() into nd_jump_root()" into a separate patch before that one. Makes for fewer distractions in this one. I'd probably fold "and be ready for errors other than -ECHILD" into the same preliminary patch. > + /* Not currently safe for scoped-lookups. */ > + if (unlikely(nd->flags & LOOKUP_IS_SCOPED)) > + return ERR_PTR(-EXDEV); Also a candidate for doing in nd_jump_link()... > @@ -1373,8 +1403,11 @@ static int follow_dotdot_rcu(struct nameidata *nd) > struct inode *inode = nd->inode; > > while (1) { > - if (path_equal(&nd->path, &nd->root)) > + if (path_equal(&nd->path, &nd->root)) { > + if (unlikely(nd->flags & LOOKUP_BENEATH)) > + return -EXDEV; Umm... Are you sure it's not -ECHILD?