From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Date: Wed, 13 Nov 2019 02:59:41 +0000 Message-ID: <20191113025941.GE26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Aleksa Sarai 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 , Alexan On Wed, Nov 13, 2019 at 01:44:14PM +1100, Aleksa Sarai wrote: > On 2019-11-13, Al Viro wrote: > > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: > > > > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *nd, unsigned flags) > > > > > > nd->m_seq = read_seqbegin(&mount_lock); > > > > > > - /* Figure out the starting path and root (if needed). */ > > > - if (*s == '/') { > > > + /* Absolute pathname -- fetch the root. */ > > > + if (flags & LOOKUP_IN_ROOT) { > > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > > + while (*s == '/') > > > + s++; > > > > 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. That, IIRC, was about untangling the weirdness around multiple calls of dirfd_path_init() and basically went "we might want just strip the slashes in case of that flag very early in the entire thing, so that later the normal logics for absolute/relative would DTRT". Since your check is right next to checking for absolute pathnames (and not in the very beginning of path_init()), we might as well turn the check for absolute pathname into *s == '/' && !(flags & LOOKUP_IN_ROOT) and be done with that. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:40158 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbfKMDAS (ORCPT ); Tue, 12 Nov 2019 22:00:18 -0500 Date: Wed, 13 Nov 2019 02:59:41 +0000 From: Al Viro Subject: Re: [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Message-ID: <20191113025941.GE26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Aleksa Sarai 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 Message-ID: <20191113025941.T8ht-_cHgyAmp91NsV0PItX79picZIl-MmF1KbLTujc@z> On Wed, Nov 13, 2019 at 01:44:14PM +1100, Aleksa Sarai wrote: > On 2019-11-13, Al Viro wrote: > > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: > > > > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *nd, unsigned flags) > > > > > > nd->m_seq = read_seqbegin(&mount_lock); > > > > > > - /* Figure out the starting path and root (if needed). */ > > > - if (*s == '/') { > > > + /* Absolute pathname -- fetch the root. */ > > > + if (flags & LOOKUP_IN_ROOT) { > > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > > + while (*s == '/') > > > + s++; > > > > 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. That, IIRC, was about untangling the weirdness around multiple calls of dirfd_path_init() and basically went "we might want just strip the slashes in case of that flag very early in the entire thing, so that later the normal logics for absolute/relative would DTRT". Since your check is right next to checking for absolute pathnames (and not in the very beginning of path_init()), we might as well turn the check for absolute pathname into *s == '/' && !(flags & LOOKUP_IN_ROOT) and be done with that. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Date: Wed, 13 Nov 2019 02:59:41 +0000 Subject: Re: [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Message-Id: <20191113025941.GE26530@ZenIV.linux.org.uk> List-Id: References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> In-Reply-To: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Aleksa Sarai 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 , Alexan On Wed, Nov 13, 2019 at 01:44:14PM +1100, Aleksa Sarai wrote: > On 2019-11-13, Al Viro wrote: > > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: > > > > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *nd, unsigned flags) > > > > > > nd->m_seq = read_seqbegin(&mount_lock); > > > > > > - /* Figure out the starting path and root (if needed). */ > > > - if (*s = '/') { > > > + /* Absolute pathname -- fetch the root. */ > > > + if (flags & LOOKUP_IN_ROOT) { > > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > > + while (*s = '/') > > > + s++; > > > > 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. That, IIRC, was about untangling the weirdness around multiple calls of dirfd_path_init() and basically went "we might want just strip the slashes in case of that flag very early in the entire thing, so that later the normal logics for absolute/relative would DTRT". Since your check is right next to checking for absolute pathnames (and not in the very beginning of path_init()), we might as well turn the check for absolute pathname into *s = '/' && !(flags & LOOKUP_IN_ROOT) and be done with that. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C023C43331 for ; Wed, 13 Nov 2019 03:54:56 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAC29222C9 for ; Wed, 13 Nov 2019 03:54:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAC29222C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47CW311DqPzF3th for ; Wed, 13 Nov 2019 14:54:53 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=ftp.linux.org.uk (client-ip=195.92.253.2; helo=zeniv.linux.org.uk; envelope-from=viro@ftp.linux.org.uk; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 47CTr86C1ZzF5sv for ; Wed, 13 Nov 2019 14:00:24 +1100 (AEDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUisf-0001fa-C2; Wed, 13 Nov 2019 02:59:41 +0000 Date: Wed, 13 Nov 2019 02:59:41 +0000 From: Al Viro To: Aleksa Sarai Subject: Re: [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Message-ID: <20191113025941.GE26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , linux-kernel@vger.kernel.org, David Howells , linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Christian Brauner , Jiri Olsa , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , Shuah Khan , 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 , Christian Brauner , "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 Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, Nov 13, 2019 at 01:44:14PM +1100, Aleksa Sarai wrote: > On 2019-11-13, Al Viro wrote: > > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: > > > > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *nd, unsigned flags) > > > > > > nd->m_seq = read_seqbegin(&mount_lock); > > > > > > - /* Figure out the starting path and root (if needed). */ > > > - if (*s == '/') { > > > + /* Absolute pathname -- fetch the root. */ > > > + if (flags & LOOKUP_IN_ROOT) { > > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > > + while (*s == '/') > > > + s++; > > > > 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. That, IIRC, was about untangling the weirdness around multiple calls of dirfd_path_init() and basically went "we might want just strip the slashes in case of that flag very early in the entire thing, so that later the normal logics for absolute/relative would DTRT". Since your check is right next to checking for absolute pathnames (and not in the very beginning of path_init()), we might as well turn the check for absolute pathname into *s == '/' && !(flags & LOOKUP_IN_ROOT) and be done with that. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188E3C43331 for ; Wed, 13 Nov 2019 03:00:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB0C2204FD for ; Wed, 13 Nov 2019 03:00:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GCXrfPMv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB0C2204FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UBXJduBT0VzglVykGV0JKaf0C48c75e1k8Jsb25EmQ4=; b=GCXrfPMvJNoFNg spCH2XcjwClIKqEc0JRG2/C/3MFXGPpnZZC/vLM0VbXtmcjGPo1a8T1u8BE1A7zGMV0QQ7EoYkUb7 o1QQdr/fGrrDufUfzDLgNn9jtHHzFT6CyYGhk8k8+B66Kz3Z/gCv9qqC15h+/7KK3Uis9Q46cU1V8 gnFWYvfJCrmh2BboXdltqZHx5we1Hu6NdokNHWJzC3tEKqpJMpDn7L6Fv4nmjTuJNYJh8P2OMyNEi Mlk16YdFW6DHSOWzZFmjoj6Y8oVmmmULYxbrqAXCW1e4uKQBVRRf9W8MQaKqWBkBrtmE2UawybbGY OOYc4deSfmibiFVdvf5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUitJ-0005hw-Sg; Wed, 13 Nov 2019 03:00:21 +0000 Received: from zeniv.linux.org.uk ([195.92.253.2]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUitH-0005gu-H4 for linux-arm-kernel@lists.infradead.org; Wed, 13 Nov 2019 03:00:20 +0000 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iUisf-0001fa-C2; Wed, 13 Nov 2019 02:59:41 +0000 Date: Wed, 13 Nov 2019 02:59:41 +0000 From: Al Viro To: Aleksa Sarai Subject: Re: [PATCH v15 5/9] namei: LOOKUP_IN_ROOT: chroot-like scoped resolution Message-ID: <20191113025941.GE26530@ZenIV.linux.org.uk> References: <20191105090553.6350-1-cyphar@cyphar.com> <20191105090553.6350-6-cyphar@cyphar.com> <20191113020307.GB26530@ZenIV.linux.org.uk> <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191113024414.wlmvtjstpnkxa36n@yavin.dot.cyphar.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191112_190019_572061_EE657C08 X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Rasmus Villemoes , Alexei Starovoitov , linux-kernel@vger.kernel.org, David Howells , linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, Christian Brauner , Jiri Olsa , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Tycho Andersen , Aleksa Sarai , Shuah Khan , 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 , Christian Brauner , "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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 13, 2019 at 01:44:14PM +1100, Aleksa Sarai wrote: > On 2019-11-13, Al Viro wrote: > > On Tue, Nov 05, 2019 at 08:05:49PM +1100, Aleksa Sarai wrote: > > > > > @@ -2277,12 +2277,20 @@ static const char *path_init(struct nameidata *nd, unsigned flags) > > > > > > nd->m_seq = read_seqbegin(&mount_lock); > > > > > > - /* Figure out the starting path and root (if needed). */ > > > - if (*s == '/') { > > > + /* Absolute pathname -- fetch the root. */ > > > + if (flags & LOOKUP_IN_ROOT) { > > > + /* With LOOKUP_IN_ROOT, act as a relative path. */ > > > + while (*s == '/') > > > + s++; > > > > 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. That, IIRC, was about untangling the weirdness around multiple calls of dirfd_path_init() and basically went "we might want just strip the slashes in case of that flag very early in the entire thing, so that later the normal logics for absolute/relative would DTRT". Since your check is right next to checking for absolute pathnames (and not in the very beginning of path_init()), we might as well turn the check for absolute pathname into *s == '/' && !(flags & LOOKUP_IN_ROOT) and be done with that. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel