From: Aleksa Sarai <cyphar@cyphar.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Alexei Starovoitov <ast@kernel.org>,
linux-kernel@vger.kernel.org, David Howells <dhowells@redhat.com>,
linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org,
Christian Brauner <christian.brauner@ubuntu.com>,
Shuah Khan <shuah@kernel.org>,
linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
Jiri Olsa <jolsa@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
linux-xtensa@linux-xtensa.org, Kees Cook <keescook@chromium.org>,
Arnd Bergmann <arnd@arndb.de>, Jann Horn <jannh@google.com>,
linuxppc-dev@lists.ozlabs.org, linux-m68k@lists.linux-m68k.org,
Andy Lutomirski <luto@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Namhyung Kim <namhyung@kernel.org>,
David Drysdale <drysdale@google.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
libc-alpha@sourceware.org, linux-parisc@vger.kernel.org,
linux-api@vger.kernel.org, Chanho Min <chanho.min@lge.com>,
Jeff Layton <jlayton@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
Eric Biederman <ebiederm@xmission.com>,
linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
containers@lists.linux-foundation.org
Subject: Re: [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution
Date: Thu, 14 Nov 2019 15:57:44 +1100 [thread overview]
Message-ID: <20191114045744.d3e7mp3zrupfe2wr@yavin.dot.cyphar.com> (raw)
In-Reply-To: <20191113074757.5b4u5vlyx2u6pbn6@yavin.dot.cyphar.com>
[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]
On 2019-11-13, Aleksa Sarai <cyphar@cyphar.com> wrote:
> On 2019-11-13, Al Viro <viro@zeniv.linux.org.uk> 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);
> >
> > 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?
>
> 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()?
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.
--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-11-14 4:58 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 9:05 [PATCH v15 0/9] open: introduce openat2(2) syscall Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 1/9] namei: LOOKUP_NO_SYMLINKS: block symlink resolution Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 2/9] namei: LOOKUP_NO_MAGICLINKS: block magic-link resolution Aleksa Sarai
2019-11-13 1:24 ` Al Viro
2019-11-13 1:24 ` Al Viro
2019-11-05 9:05 ` [PATCH v15 3/9] namei: LOOKUP_NO_XDEV: block mountpoint crossing Aleksa Sarai
2019-11-13 1:36 ` Al Viro
2019-11-13 1:36 ` Al Viro
2019-11-14 4:49 ` Aleksa Sarai
2019-11-14 4:49 ` Aleksa Sarai
2019-11-14 5:43 ` Al Viro
2019-11-14 5:43 ` Al Viro
2019-11-14 13:33 ` Aleksa Sarai
2019-11-14 13:33 ` Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 4/9] namei: LOOKUP_BENEATH: O_BENEATH-like scoped resolution Aleksa Sarai
2019-11-13 1:55 ` Al Viro
2019-11-13 1:55 ` Al Viro
2019-11-13 7:47 ` Aleksa Sarai
2019-11-13 7:47 ` Aleksa Sarai
2019-11-14 4:57 ` Aleksa Sarai [this message]
2019-11-14 4:57 ` Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like " Aleksa Sarai
2019-11-13 2:03 ` Al Viro
2019-11-13 2:03 ` Al Viro
2019-11-13 2:44 ` Aleksa Sarai
2019-11-13 2:44 ` Aleksa Sarai
2019-11-13 2:59 ` Al Viro
2019-11-13 2:59 ` Al Viro
2019-11-13 3:55 ` Aleksa Sarai
2019-11-13 3:55 ` Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 6/9] namei: LOOKUP_{IN_ROOT,BENEATH}: permit limited ".." resolution Aleksa Sarai
2019-11-13 2:09 ` Al Viro
2019-11-13 2:09 ` Al Viro
2019-11-13 7:52 ` Aleksa Sarai
2019-11-13 7:52 ` Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 7/9] open: introduce openat2(2) syscall Aleksa Sarai
2019-11-13 2:29 ` Al Viro
2019-11-13 2:29 ` Al Viro
2019-11-13 2:35 ` Aleksa Sarai
2019-11-13 2:35 ` Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 8/9] selftests: add openat2(2) selftests Aleksa Sarai
2019-11-05 9:05 ` [PATCH v15 9/9] Documentation: path-lookup: mention LOOKUP_MAGICLINK_JUMPED Aleksa Sarai
2019-11-11 13:24 ` [PATCH v15 0/9] open: introduce openat2(2) syscall Aleksa Sarai
2019-11-12 23:01 ` Kees Cook
2019-11-12 23:01 ` Kees Cook
2019-11-12 23:06 ` Christian Brauner
2019-11-12 23:06 ` Christian Brauner
2019-11-13 0:46 ` Aleksa Sarai
2019-11-13 0:46 ` Aleksa Sarai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191114045744.d3e7mp3zrupfe2wr@yavin.dot.cyphar.com \
--to=cyphar@cyphar.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnd@arndb.de \
--cc=ast@kernel.org \
--cc=bfields@fieldses.org \
--cc=chanho.min@lge.com \
--cc=christian.brauner@ubuntu.com \
--cc=containers@lists.linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=drysdale@google.com \
--cc=ebiederm@xmission.com \
--cc=jannh@google.com \
--cc=jlayton@kernel.org \
--cc=jolsa@redhat.com \
--cc=keescook@chromium.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=oleg@redhat.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=sparclinux@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).