Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1281176ybc; Tue, 12 Nov 2019 18:00:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyciY3zBCB168jJFMwkFFcYxXpanDw3uiqQrQm489+jLVn+I4ZY6yTdkOcWwat9wuCGbk8c X-Received: by 2002:a17:907:447b:: with SMTP id oo19mr420644ejb.81.1573610442519; Tue, 12 Nov 2019 18:00:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573610442; cv=none; d=google.com; s=arc-20160816; b=PuvcF/Bpro2wx9e4UcJrA/fyORlIQ/+LTmevrGnrdOudyvojpvdkugerxwrkkni9H5 W2+6/5zceg/NphOMbcRyCPG3IqhVfo+cgFs3nbXypavIUHGcpDYR4+2viqRBX5GdAvLT iexayCJrj9YsiSYELPc62R7gJ4FU7LkoFWSFQhlY3R4ekgMKYDLoPcQcpMnefKqLex3V ge2g957RDtOT7vHm8wmNb8c8VH3pBZYKNYtpwH5t7T3y7G17ECpwJwO6EiuPJsooOOrP RDGgLZmSnE4jQwy/P0/ZpSdMK/MFKNYgBhgZf262heRKvdOwOBs4OcHQcvqC6ZLuKpUg n5PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UrW0K2fCPvlpP8QB9wC9o5Ldzutmf3G92Kn+p5tnOz0=; b=Nj/VCobf6+Ol2+JWtqsSxXNuS26z4g10GaL9/Z8Xg/CHDhHhvsk/GrAFMSsy8TDQ2Z VkfGmHDqb25fEectue2G640o1K8QUg4SsC/iQZVa7bmCsYjxiUvHdLeMCLS0IUp3zjZE XDRDpfGuyydbjAH/EMpkmhp/q0Q4Z9Ks3iiesCg9AbrXO69Ph9J+gLbeF7WlTPa+Qdd9 FMIdQikT6Yzrb/cuXkxLRt7KNQtAeFSEpU0S4QRgqKTjdWnXDsz8wa7uZHwFeh1rtryV 3w6cSK4Cc+loYf42HEY9GSoSLdIEF10t5yKrWpHjCBjQkwfORRl575pwUVf9OPkgSsMO QDkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 27si244530eji.207.2019.11.12.18.00.16; Tue, 12 Nov 2019 18:00:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729458AbfKMB4W (ORCPT + 99 others); Tue, 12 Nov 2019 20:56:22 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:39164 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbfKMB4H (ORCPT ); Tue, 12 Nov 2019 20:56:07 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUhsc-0007v0-Hn; Wed, 13 Nov 2019 01:55:34 +0000 Date: Wed, 13 Nov 2019 01:55:34 +0000 From: Al Viro To: Aleksa Sarai Cc: Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Christian Brauner , David Drysdale , Andy Lutomirski , Linus Torvalds , Eric Biederman , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Christian Brauner , Aleksa Sarai , containers@lists.linux-foundation.org, linux-alpha@vger.kernel.org, linux-api@vger.kernel.org, libc-alpha@sourceware.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, sparclinux@vger.kernel.org Subject: Re: [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution 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-Disposition: inline In-Reply-To: <20191105090553.6350-5-cyphar@cyphar.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?