Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1537263ybc; Tue, 12 Nov 2019 23:49:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxaAEbwxwuQcwqNe8U/cuDHcBzaOAiaTRcCmcMvA7yY4ceDN0mMuF3RgYBzhakXcAieR1XS X-Received: by 2002:a17:906:b6cb:: with SMTP id ec11mr1448181ejb.145.1573631386633; Tue, 12 Nov 2019 23:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573631386; cv=none; d=google.com; s=arc-20160816; b=oKuU+qhaOOT180Gkb3esUEpD0WjoaSfcj1MQ4AMZy4Q8sCrPYJo94SN5CT7HkLbIqG BNG1OEZtdgXXddMuQrJJdD3jZnTRaO7RJofd/AgJWGNz9SIqSUzwV02dOGGt6Qb0+S1n 2i6c6/jgGmYn8RNgvLVrOBJh+AL1X/gZMlhHUFlbDnudMNrJuWbIUNq66prEpcmWcy40 Vw2uW9mvyET/71bIb9gFdpG/mWQn7zQAJwTJXup3pYcIf+V6858mM0SPZKuFNYyyTE5S UDFGYJOriZr65CzFh/seYziPH8P7f9/AqXYW6iR5si3HnlYSjC2HZVrED8cVfMqagGYT cBzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eYrAw+xRll5SPkj1pBn+T9CM3kD7JIfGWItTs0+ZUuU=; b=Ztdjk6xFUyDYyxdHWBWzyDIVn5KrnzaTzt9QeKzbwh3xw/7RpQj/ef9w+EVlq/Rkkz HRBx+D++ganHa1I7Ei1tQDxeGNV/lGE+x3OS52JfGXS4sxakgFm8+MU36Ya/Itl8yqIQ aDQwTTPVE/FSN2eAQdPkZI3rvGlqv4IpwJFMFpv+d8dhNJiWivyG2vXTGD+rDh7io5qf Oux7IXpTm8YNzqdN3vJqcQe8mHvvN0jNfk4w1CSxaZhmL6j8+T7BRy7bscir/7/yodNH mKKVGsOh2AZzXvcEMfhAq3Q9jkofC4ElBmgLm+kbDUdyDJkFSnyzlcVO5cM2+v0hiC3S nTrA== 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 i30si851688edd.124.2019.11.12.23.49.22; Tue, 12 Nov 2019 23:49:46 -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 S1726543AbfKMHsf (ORCPT + 99 others); Wed, 13 Nov 2019 02:48:35 -0500 Received: from mout-p-201.mailbox.org ([80.241.56.171]:42266 "EHLO mout-p-201.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbfKMHsf (ORCPT ); Wed, 13 Nov 2019 02:48:35 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 47CcDY3vdYzQlBb; Wed, 13 Nov 2019 08:48:29 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id 3hMGDl1msr0T; Wed, 13 Nov 2019 08:48:23 +0100 (CET) Date: Wed, 13 Nov 2019 18:47:57 +1100 From: Aleksa Sarai To: Al Viro 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: <20191113074757.5b4u5vlyx2u6pbn6@yavin.dot.cyphar.com> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-5-cyphar@cyphar.com> <20191113015534.GA26530@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="odomi6wtik4yoblv" Content-Disposition: inline In-Reply-To: <20191113015534.GA26530@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --odomi6wtik4yoblv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-11-13, Al Viro 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. Will do. > > + /* Not currently safe for scoped-lookups. */ > > + if (unlikely(nd->flags & LOOKUP_IS_SCOPED)) > > + return ERR_PTR(-EXDEV); >=20 > Also a candidate for doing in nd_jump_link()... >=20 > > @@ -1373,8 +1403,11 @@ static int follow_dotdot_rcu(struct nameidata *n= d) > > struct inode *inode =3D nd->inode; > > =20 > > while (1) { > > - if (path_equal(&nd->path, &nd->root)) > > + if (path_equal(&nd->path, &nd->root)) { > > + if (unlikely(nd->flags & LOOKUP_BENEATH)) > > + return -EXDEV; >=20 > Umm... Are you sure it's not -ECHILD? It wouldn't hurt to be -ECHILD -- though it's not clear to me how likely a success would be in REF-walk if the parent components didn't already trigger an unlazy_walk() in RCU-walk. I guess that also means LOOKUP_NO_XDEV should trigger -ECHILD in follow_dotdot_rcu()? --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --odomi6wtik4yoblv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXcu1KgAKCRCdlLljIbnQ EpYSAQDaNIB4LkhLlbFgkuRPiavU6vZ03HuSIHKseqaD6uMARwD+OcGzTDahyjJ6 YeuKal+s33ETzSjupl7K2mKfYQpA2Q0= =nyQ8 -----END PGP SIGNATURE----- --odomi6wtik4yoblv--