Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2736887ybc; Wed, 13 Nov 2019 20:59:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzDs04ipNbEM/jSLvqwkStFRg1G+c7X06N/l3wVIqafJbR3oAdB2b4IijUtnEG4auwVXX5P X-Received: by 2002:aa7:dbd4:: with SMTP id v20mr8039953edt.58.1573707553870; Wed, 13 Nov 2019 20:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573707553; cv=none; d=google.com; s=arc-20160816; b=NVdMHiFb9FPSDSelUmOd5Ux3eSwJ6FVjmszn532wNSPhMzGn2W88icy7axjf+juZUs btvc8lrYQSrvDCc7951x/F5YwhFJ9fqKNNaytwVQ+CWy9IjUWbqvDNUFX9J1x6QqTAzC Spu4BcebH0SjWAXHfxPQPcFCnuxBcmlyMuABGmn6F0kx8kWcWR77e8orqbuseacWTF0a Ybt2rYHRigmZbxbbH6yDshbo2wELKQrO19TQF/4CfdEedbuTsDSqGPYceYnF5Dhbbk5c a6GXXMUUtzZspEl6PLVD8BvQKSMmns4oHfp8wJDlGdhNvOnVg8AH9T3HWas6sqYohCue d8lQ== 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=dFm4AG/HkwDTPVEgi22Z+JfAQqKJYEMKoyi7vw/XXDs=; b=V9H04xHZkYS5FenHAF3TWOfMvzUb4ChXPLPI112l9z2L4Yi6M2MAoEEvX0gyqWc27P FD3SvdmaX6rQfYwyM2/ciAlDjSYq3J8kLy8VbhEV69HdHZXUJ7oTRu0GWTRRQpZtZ7kb iEzpleZifMmzzuNZACvjgohnKoM8k7zDsoJLFA3DP6zMhMmnnoypJfeH6Y+5Wq4ZteCb m1MbvTzR13Qte8zyq6nkWgxNIpGg4uKjT+bF5RUnl1/5VJl/raX5ZbEonq4U7DjZJ3qa 9UdEXjg7N5084MjK7FaOoTvq+nUOESf3XiQDXvAyAExqdmheZRY0DHsg6GUABBVDPqD8 iO1g== 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 v9si3327422edl.90.2019.11.13.20.58.49; Wed, 13 Nov 2019 20:59:13 -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 S1727080AbfKNE6T (ORCPT + 99 others); Wed, 13 Nov 2019 23:58:19 -0500 Received: from mout-p-102.mailbox.org ([80.241.56.152]:21844 "EHLO mout-p-102.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbfKNE6S (ORCPT ); Wed, 13 Nov 2019 23:58:18 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 47D8Pf2Sf9zKmdL; Thu, 14 Nov 2019 05:58:14 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id QpQxpch70Axr; Thu, 14 Nov 2019 05:58:06 +0100 (CET) Date: Thu, 14 Nov 2019 15:57:44 +1100 From: Aleksa Sarai To: Al Viro Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, 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, 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, Andy Lutomirski , Shuah Khan , Namhyung Kim , David Drysdale , "J. Bruce Fields" , libc-alpha@sourceware.org, linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, Chanho Min , Jeff Layton , Oleg Nesterov , Eric Biederman , linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton , Linus Torvalds , containers@lists.linux-foundation.org Subject: Re: [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution Message-ID: <20191114045744.d3e7mp3zrupfe2wr@yavin.dot.cyphar.com> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-5-cyphar@cyphar.com> <20191113015534.GA26530@ZenIV.linux.org.uk> <20191113074757.5b4u5vlyx2u6pbn6@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6gz2i7fpwlz4mefu" Content-Disposition: inline In-Reply-To: <20191113074757.5b4u5vlyx2u6pbn6@yavin.dot.cyphar.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --6gz2i7fpwlz4mefu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-11-13, Aleksa Sarai wrote: > 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. >=20 > Will do. >=20 > > > + /* 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 = *nd) > > > 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? >=20 > 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. >=20 > I guess that also means LOOKUP_NO_XDEV should trigger -ECHILD in > follow_dotdot_rcu()? Scratch the last question -- AFAICS we don't need to do that for LOOKUP_NO_XDEV because we check against mount_lock so it's very unlikely that -ECHILD will have any benefit. --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --6gz2i7fpwlz4mefu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXczexQAKCRCdlLljIbnQ Em3mAQDOIg6+v9zFmJZ9+uYnLQ8tGd3ay8OeAsu6/xVlfCimMwD/cMP8o+o1KTbo +rDSfA6D7b6Zhy7K3Vlf0k0OTebeSwI= =kHIA -----END PGP SIGNATURE----- --6gz2i7fpwlz4mefu--