From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aleksa Sarai Date: Thu, 14 Nov 2019 04:57:44 +0000 Subject: Re: [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution Message-Id: <20191114045744.d3e7mp3zrupfe2wr@yavin.dot.cyphar.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="6gz2i7fpwlz4mefu" List-Id: 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> In-Reply-To: <20191113074757.5b4u5vlyx2u6pbn6@yavin.dot.cyphar.com> 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 --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--