Re: [PATCH v15 2/9] namei: LOOKUP_NO_MAGICLINKS: block magic-link resolution
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Aleksa Sarai <cyphar@xxxxxxxxxx>
- Subject: Re: [PATCH v15 2/9] namei: LOOKUP_NO_MAGICLINKS: block magic-link resolution
- From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Nov 2019 01:24:26 +0000
- Cc: Jeff Layton <jlayton@xxxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, David Howells <dhowells@xxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Christian Brauner <christian.brauner@xxxxxxxxxx>, David Drysdale <drysdale@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, Eric Biederman <ebiederm@xxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>, Kees Cook <keescook@xxxxxxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, Tycho Andersen <tycho@xxxxxxxx>, Chanho Min <chanho.min@xxxxxxx>, Oleg Nesterov <oleg@xxxxxxxxxx>, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, Christian Brauner <christian@xxxxxxxxxx>, Aleksa Sarai <asarai@xxxxxxx>, containers@xxxxxxxxxxxxxxxxxxxxxxxxxx, linux-alpha@xxxxxxxxxxxxxxx, linux-api@xxxxxxxxxxxxxxx, libc-alpha@xxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-ia64@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-kselftest@xxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx
- In-reply-to: <20191105090553.6350-3-cyphar@cyphar.com>
- References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-3-cyphar@cyphar.com>
- User-agent: Mutt/1.12.1 (2019-06-15)
On Tue, Nov 05, 2019 at 08:05:46PM +1100, Aleksa Sarai wrote:
> @@ -1078,6 +1079,10 @@ const char *get_link(struct nameidata *nd)
> } else {
> res = get(dentry, inode, &last->done);
> }
> + if (nd->flags & LOOKUP_MAGICLINK_JUMPED) {
> + if (unlikely(nd->flags & LOOKUP_NO_MAGICLINKS))
> + return ERR_PTR(-ELOOP);
> + }
Minor nit - the first check probably wants unlikely() more than the
second one; it's probably noise anyway, but most of the symlinks
traversed are not going to be procfs ones, so you get test + branch
taken most of the time.
OTOH, that just might compile into
fetch nd->flags
and with LOOKUP_MAGICLINK_JUMPED | LOOKUP_NO_MAGICLINKS
compare with the same constant
unlikely branch when equal
Anyway, that's no more than a minor nit and can be dealt with later (if
at all)
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]