Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1207663ybc; Sat, 16 Nov 2019 17:20:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwQnQ8Lmvr6SbkGJ2MgsU/9rnA+3D95cQR+rA8yhJQvQXQquW20iAMAMoM5mrgq+ZUIq49W X-Received: by 2002:a17:906:5586:: with SMTP id y6mr14163154ejp.76.1573953637955; Sat, 16 Nov 2019 17:20:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573953637; cv=none; d=google.com; s=arc-20160816; b=TB78VIWX5TyFr7N/32mUYo29G62sVrwtkB/tJ+BYctpbHetieUyf1pzoyFN4k/SZuS giEOmldCkf3OATgyOVN7tnVqhkTnfBjNvBl9S9jzLszCBOk6olYmjkH6Qfuwsv0VI3hh qKzwetYaHgl2mL4JIZh77UTVipoHEpocOc/toyrrioXBDJe7N1eDq9FqY+9HI5hXUR/3 i8L2u6ef+lnIziNYZK17HvYC+qinguRUWfE2Q8Xlv2g5ZbmD0waM4krmcV+b5//FH6c0 PUrAjdXEKZIVPEU5uxQq1k3IlULTDi4jenKE5IOYLZBMG1ueX5XlH9COehZtkSn5TgbE BbBA== 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=H1f4QdMIASOZIdVkNFm1bqrjrdO5nNbFgATrU9m/9DIYZxavCM4tHhGXZcgA3tX1Ve /46Fw8c95WmmBOBF+k56T7SkL55ORHmjpxWWexfx+3qCj7VodpcLsifQbUbj1jzV+MOa fyitB3AtfcD2J/wOrAdSv7PuuGq1YxbondJW5CjFBOxLpkDuMOC1UttsWgk0ePgiRBYw RCFbp1O61mWQxCq3akeX9bym9IWjXzwYVsF7kvNt3WRs2eDeALLqibKhD+9wt/xqbEfd Dy8v5q3LLJNeTddRopMItsFnEiBrenrAcYY2QiGn3XyUAsxSKg4EmcennsWpzjantuW1 mbQw== 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 f3si10390502eda.251.2019.11.16.17.20.02; Sat, 16 Nov 2019 17:20:37 -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 S1726830AbfKQBSo (ORCPT + 99 others); Sat, 16 Nov 2019 20:18:44 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:46306 "EHLO mout-p-202.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726416AbfKQBSn (ORCPT ); Sat, 16 Nov 2019 20:18:43 -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-202.mailbox.org (Postfix) with ESMTPS id 47FvNs6P0TzQlBL; Sun, 17 Nov 2019 02:18:37 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id mA7ZJesK6gIY; Sun, 17 Nov 2019 02:18:33 +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 v17 01/13] namei: only return -ECHILD from follow_dotdot_rcu() Date: Sun, 17 Nov 2019 12:17:01 +1100 Message-Id: <20191117011713.13032-2-cyphar@cyphar.com> In-Reply-To: <20191117011713.13032-1-cyphar@cyphar.com> References: <20191117011713.13032-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