Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1319009ybc; Tue, 12 Nov 2019 18:46:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyX3IOPSSS+nfKg0toG1r7ZyaX7v7OmwIzZTE85WSBL1ng6CeamDbnRXdg2FO4vJW59mJvd X-Received: by 2002:a05:6402:28d:: with SMTP id l13mr1162221edv.286.1573613212299; Tue, 12 Nov 2019 18:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573613212; cv=none; d=google.com; s=arc-20160816; b=KE/C+VpGEV4hxFRezHf/BH1FH16Ae/SB55YhPaRPYQQJ8Gbw0b91WYEo2NTyFPz1AM QJtf4kBXcis5mWOAmuDav1GzuF+EUgtAdMRYhVQFgSAZaWCf+/g4RpcvjYmWWyJdtR50 dcvyB0G+EN2IOUw6vziGqvIeODlX3DSIsCQracX2/3QPxk1p3LOtJL0JlyTyTLSyEyyC j3JZjqgHXGYdsyTJTgEVuPW5rPn1eDFyljdMwFdBOvEChzDxqlPAyJ4dK/FyLGlxJO/l Nx+kAKleYw3LE7RGtKljmidggEGx4wT2A+VEBKKXow8eCFMLVNt6YbVgWgx3Er4ydYjA KRVw== 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=ux9dL+dvGgm5nTywAnXKU9a4ewVky4AF+loBFfo+O8I=; b=Rr2lwqzFyFZRICeegH1mGQ+gJM0CWZM82QQofFQxd399iS3SRjCCe2qzcVcxUAyIkp XH4d4G5l4grpluM06czg0seQd+2nSpmw9SMfPToH/xmvAObQNnrQAYTYkE3A0XfyeHQc zGsSoDQeaHYN5scc35+DQJfHGHRvHC7EXpc8t1nh76CNRNrjyfbE738NQt7nOFrrC0a5 zncrNU9dZsl+alkfh6WVH5qkCmrqKLnGqcBYcezSWDXRLNKH4UyFJ6i1nv6QpJJB3g5F YJ3Gruf1BeWRhNy10LC++XqC96jLawfZCFTKGE65nBAoFe1a88uErfmnv5612sTN/1A7 RUBQ== 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 m33si388499edc.126.2019.11.12.18.46.27; Tue, 12 Nov 2019 18:46:52 -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 S1727669AbfKMCos (ORCPT + 99 others); Tue, 12 Nov 2019 21:44:48 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:12446 "EHLO mout-p-202.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbfKMCos (ORCPT ); Tue, 12 Nov 2019 21:44:48 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 47CTV33Jc9zQlBx; Wed, 13 Nov 2019 03:44:43 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id LsOzyR1eKTKd; Wed, 13 Nov 2019 03:44:38 +0100 (CET) Date: Wed, 13 Nov 2019 13:44:14 +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 , Eric Biederman , Andy Lutomirski , Andrew Morton , Alexei Starovoitov , Kees Cook , Jann Horn , Tycho Andersen , David Drysdale , Chanho Min , Oleg Nesterov , Rasmus Villemoes , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Christian Brauner , Aleksa Sarai , Linus Torvalds , 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 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Message-ID: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zcwix2zvi4el6ukc" Content-Disposition: inline In-Reply-To: <20191113020307.GB26530@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zcwix2zvi4el6ukc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-11-13, Al Viro wrote: > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: >=20 > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *= nd, unsigned flags) > > =20 > > nd->m_seq =3D read_seqbegin(&mount_lock); > > =20 > > - /* Figure out the starting path and root (if needed). */ > > - if (*s =3D=3D '/') { > > + /* Absolute pathname -- fetch the root. */ > > + if (flags & LOOKUP_IN_ROOT) { > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > + while (*s =3D=3D '/') > > + s++; >=20 > Er... Why bother skipping slashes? I mean, not only link_path_walk() > will skip them just fine, you are actually risking breakage in this: > if (*s && unlikely(!d_can_lookup(dentry))) { > fdput(f); > return ERR_PTR(-ENOTDIR); > } > which is downstream from there with you patch, AFAICS. I switched to stripping the slashes at your suggestion a few revisions ago[1], and had (wrongly) assumed we needed to handle "/" somehow in path_init(). But you're quite right about link_path_walk() -- and I'd be more than happy to drop it. [1]: https://lore.kernel.org/lkml/20190712125552.GL17978@ZenIV.linux.org.uk/ --=20 Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH --zcwix2zvi4el6ukc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQSxZm6dtfE8gxLLfYqdlLljIbnQEgUCXctt+gAKCRCdlLljIbnQ EtaOAP4wZ6FONr+jCigAii+B0S1x/aNqVoCXGa0s32/c+X1spQEAiLcI0bIEdqjF tuAr6TYPTrpe63nhzokAO32LJ1rVrQM= =G6qn -----END PGP SIGNATURE----- --zcwix2zvi4el6ukc--