Received: by 10.213.65.68 with SMTP id h4csp482557imn; Fri, 16 Mar 2018 09:06:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELuV5s+cDj7On5ogWabv+D2DlqzlIsZahru2M0bUkn9zZUVMmsGavmPvi5oaz9JGaOMv+RG1 X-Received: by 10.101.78.201 with SMTP id w9mr1834616pgq.83.1521216368551; Fri, 16 Mar 2018 09:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521216368; cv=none; d=google.com; s=arc-20160816; b=PzD8Z13QU+H6863z+JEN6IYJ42IJkNMso5oQVdDS6ZlKDDHZ3cK+J9cQsnc777Vjyy v8GKzaJnQVFkSD/KfbO4/kd8ijK0oN/xPouomgcsu0Ym3Zdgcwv6j1UYAJirF1N76Tbe d4bL+c4X1JPAvIYcOtPssgZ/e3M6HWaghbTzUBzYjMlV0gASN2lV3A0fZMNAMhpsVfmM dTvKm/ibMOzRszEON9Ou3+Ia7++W92p4hQjg7MTS5zeWnRDo1iKb47vBAYzwVQqn0QCY +Nzs4e3+CZE5wwgo+BKtkRda85eLhcz/nJHvXTMJfdngGGJl2a+mhA4I/5VD1/EuMgKl wcRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SexQPr8ffgAcYf34Iq4p/9YegS7+HgjgdJ+jO4KIxKo=; b=pd//IHpnZdtKe4KyfJkrTsUEv7OgSM5ZWM5T2xMIyFblEBKtEVJbdQju2cv/No5jFz nPTx9L0MMzMH1p+lqNXzKVV8q11Rc7GyW0hZC12ypO6ejOvOIgW9xxpU3RksSfSXvv6R 3oIIlrbYVPA5Z/gUhPUwuzdfqN+M0s8E96lpT5H83HYI0cFYrxPG6U50UhzLLQiLsV7k vQgJFqSi9UbZ/y4l1UgBQ4EPo34gOm7RYbgY/OcM832zugWk5eYWj+JJJrKRP5OOaFQX RaLPQPy20BQCDOSqw0AWqOYveh/kgu2RGZIT5anXozhewDwLfOUmZO9wCERSCcbt+KN8 PoPA== 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 bb12-v6si6225669plb.164.2018.03.16.09.05.54; Fri, 16 Mar 2018 09:06:08 -0700 (PDT) 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 S1754832AbeCPPmE (ORCPT + 99 others); Fri, 16 Mar 2018 11:42:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44202 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754641AbeCPPmA (ORCPT ); Fri, 16 Mar 2018 11:42:00 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F2244FC4; Fri, 16 Mar 2018 15:41:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Kent , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 4.15 064/128] userns: Dont fail follow_automount based on s_user_ns Date: Fri, 16 Mar 2018 16:23:25 +0100 Message-Id: <20180316152339.965605773@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Eric W. Biederman" [ Upstream commit bbc3e471011417598e598707486f5d8814ec9c01 ] 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") Acked-by: Ian Kent Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/namei.c | 3 --- 1 file changed, 3 deletions(-) --- a/fs/namei.c +++ b/fs/namei.c @@ -1133,9 +1133,6 @@ static int follow_automount(struct path path->dentry->d_inode) return -EISDIR; - 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;