From patchwork Thu Nov 30 00:04:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 10083961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA01760234 for ; Thu, 30 Nov 2017 00:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B2A129AA3 for ; Thu, 30 Nov 2017 00:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BFFF29D19; Thu, 30 Nov 2017 00:05:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49E6329AA3 for ; Thu, 30 Nov 2017 00:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752945AbdK3AFH (ORCPT ); Wed, 29 Nov 2017 19:05:07 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:46515 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdK3AFG (ORCPT ); Wed, 29 Nov 2017 19:05:06 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eKCLh-0004qh-LR; Wed, 29 Nov 2017 17:05:05 -0700 Received: from 67-3-248-7.omah.qwest.net ([67.3.248.7] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eKCLb-0001KK-Om; Wed, 29 Nov 2017 17:05:05 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Linux Containers Cc: , Miklos Szeredi , Ian Kent , , Seth Forshee References: <874lpck52r.fsf@xmission.com> Date: Wed, 29 Nov 2017 18:04:54 -0600 In-Reply-To: <874lpck52r.fsf@xmission.com> (Eric W. Biederman's message of "Wed, 29 Nov 2017 18:01:16 -0600") Message-ID: <87y3moiqc9.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 X-XM-SPF: eid=1eKCLb-0001KK-Om; ; ; mid=<87y3moiqc9.fsf@xmission.com>; ; ; hst=in02.mta.xmission.com; ; ; ip=67.3.248.7; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX19IbtNwph0JIT8wIGN4z1SwVfNgYiJ75yg= X-SA-Exim-Connect-IP: 67.3.248.7 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH 1/2] userns: Don't fail follow_automount based on s_user_ns X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When vfs_submount was added the test to limit automounts from filesystems that with s_user_ns != &init_user_ns accidentially left in follow_automount. The test was never about any security concerns and was always about how do we implement this for filesystems whose s_user_ns != &init_user_ns. At the moment this check makes no difference as there are no filesystems that both set FS_USERNS_MOUNT and implement d_automount. Remove this check now while I am thinking about it so there will not be odd booby traps for someone who does want to make this combination work. vfs_submount still needs improvements to allow this combination to work, and vfs_submount contains a check that presents a warning. The autofs4 filesystem could be modified to set FS_USERNS_MOUNT and it would need not work on this code path, as userspace performs the mounts. Fixes: 93faccbbfa95 ("fs: Better permission checking for submounts") Fixes: aeaa4a79ff6a ("fs: Call d_automount with the filesystems creds") Signed-off-by: "Eric W. Biederman" --- fs/namei.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index f0c7a7b9b6ca..f47118ed36e7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1142,9 +1142,6 @@ static int follow_automount(struct path *path, struct nameidata *nd, return -ENOENT; } - if (path->dentry->d_sb->s_user_ns != &init_user_ns) - return -EACCES; - nd->total_link_count++; if (nd->total_link_count >= 40) return -ELOOP;