Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1428172ybc; Tue, 19 Nov 2019 21:10:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyHDexelnGAdiceQBQuKfjtTLY3wd7WrU9SuGhht8dFgMQLY7oJsrOqppKWsFiX2fSNf/57 X-Received: by 2002:a17:906:c797:: with SMTP id cw23mr2472510ejb.19.1574226607366; Tue, 19 Nov 2019 21:10:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574226607; cv=none; d=google.com; s=arc-20160816; b=Zb2oDp3lJvdXPLi9/lGTtv08EK26sfCmbZXdovZvqJFZQvp2G0ptobQKi0RaeFjvsZ gf9j/GKLDVgVXEIUgy0q9v2hR+xVbqlClF4gbO3tAZ5aqWr54V/Wlxe0gHAtmghBtWcB QIW5036JDS8X4rvlqoJmn8JmdtZXpieslDHSe5tNiJe9/cHgjDJC3Xrf+itRnghFczk5 1WF8AH1E1lativnNpY65kgo2JcdS2gQHAJ4tqjG8leWN0jt2TDrswpnjY+ANZlnax3Fz NZLWMnNygR2UDmmus2z5t/rKI6C+lu0uu6fkxaKwzcw5pBhQ7/N6qz9teF/GLtD2XT05 0lPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Z8OmOvyx0H8rYdCic3vn5u30a4HU972lL+p3iipNAzs=; b=0Sg4f+YzbPmBUWSlRuiJJUfjsvNK3U88kzPLlNE72MKK4IkcQjej4OpZ85Tk883rjF 7WEtcoaJ73rHvkVHf02IrGRkt7gw+eLYm5+aEZ+bzVi9eBdWK1nZtWJF6Fnq2USKChm4 wh7Wd63zQlWZYZ+AO3SpYQVHk2LY76X5iHNKxEfirobs4MtrqGBAu6zX+HnPUiDhlCGP PvhmjbYqy/iNLZsMRCkpU0XRWSHVqrTFqEGI5ht6qsl/ANC9SHJzXocNYr39CGt3NOuq R0+jkkKIKoHw1WsTAapmOAl/15E5BryJGrHU/m+usIb/icrj6tHNayPcj1vwlzHIBy9p BW2g== 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 i13si15314489ejc.76.2019.11.19.21.09.42; Tue, 19 Nov 2019 21:10:07 -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 S1727051AbfKTFI0 (ORCPT + 99 others); Wed, 20 Nov 2019 00:08:26 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:11688 "EHLO mout-p-101.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbfKTFIY (ORCPT ); Wed, 20 Nov 2019 00:08:24 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 47HrLV2KxrzKmgm; Wed, 20 Nov 2019 06:08:18 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de [80.241.56.123]) (amavisd-new, port 10030) with ESMTP id k93rtjsO-WmU; Wed, 20 Nov 2019 06:08:13 +0100 (CET) From: Aleksa Sarai To: Al Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , David Howells , Shuah Khan , Shuah Khan , Ingo Molnar , Peter Zijlstra , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , Jonathan Corbet Cc: Aleksa Sarai , "Eric W. Biederman" , Andy Lutomirski , Andrew Morton , 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 , dev@opencontainers.org, containers@lists.linux-foundation.org, bpf@vger.kernel.org, netdev@vger.kernel.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-doc@vger.kernel.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: [PATCH RESEND v17 01/13] namei: only return -ECHILD from follow_dotdot_rcu() Date: Wed, 20 Nov 2019 16:06:19 +1100 Message-Id: <20191120050631.12816-2-cyphar@cyphar.com> In-Reply-To: <20191120050631.12816-1-cyphar@cyphar.com> References: <20191120050631.12816-1-cyphar@cyphar.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's over-zealous to return hard errors under RCU-walk here, given that a REF-walk will be triggered for all other cases handling ".." under RCU. The original purpose of this check was to ensure that if a rename occurs such that a directory is moved outside of the bind-mount which the resolution started in, it would be detected and blocked to avoid being able to mess with paths outside of the bind-mount. However, triggering a new REF-walk is just as effective a solution. Cc: "Eric W. Biederman" Fixes: 397d425dc26d ("vfs: Test for and handle paths that are unreachable from their mnt_root") Suggested-by: Al Viro Signed-off-by: Aleksa Sarai --- fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 671c3c1a3425..5a47d9c09581 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1359,7 +1359,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) nd->path.dentry = parent; nd->seq = seq; if (unlikely(!path_connected(&nd->path))) - return -ENOENT; + return -ECHILD; break; } else { struct mount *mnt = real_mount(nd->path.mnt); -- 2.24.0