Received: by 10.213.65.68 with SMTP id h4csp36381imn; Mon, 19 Mar 2018 18:43:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELv5BZBsTzjiaQaAM2BvII+r+0t0g0gewubeGa/BKK5ghN9Y1DgH0IAqtUU6c+nRWgUG86wr X-Received: by 2002:a17:902:4545:: with SMTP id m63-v6mr9206066pld.149.1521510217672; Mon, 19 Mar 2018 18:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510217; cv=none; d=google.com; s=arc-20160816; b=G6leazyRgWvUxjHFwpKfkmXo7CxqLnFVqPRWRIuWYJHMeG5/1MM/OJ2QOWmi0BA6oQ a/52YPClaWcpMGVrRDprzUbbWavPwwPBMkNNZzpnOrNs6pR9O3RYSXGkqFpP6IKP8yQn vUXf7+Ldc+sMNMGT93cgx76E9PVzBGrcNMJjlmSmomKmDc9iKuI4QsxIgSJHCOoE0ySM EWO5Q0jzLHEZTVqIdgJlBpP3Q3Lhl3DpIRe8KSpluOWApRE7HuGJIdZQaIQ9lrsq5XTh QNW31IPOWbjOhIuF0RQ6CEqH3eEZuKe57M2vI1fKOYIS02K3BSBBMcYG1qgRGaEqRYjL SQCQ== 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=AnnCdpY8XLXVLqLcNcCSTSduRLzyOQN46XWi3aEOh2A=; b=0WJxnRtEttTZcSK+WHRLNJkJ+I6THpF9xFJyCvSuESHN3r4KdJBauUcWmCsnkqAoNd lcqqwDJRcZXg1Q9RJMGkcW7A+wY5W+K2C1IrYzCZ/4QbIlQx6zjCGmWAYsT2nG8zeFWC 8pGXVyNtTWOO1bWPvY7G5hSoQYbghWQBZBtAZiztTzHfEKqCNTZk4TceWQMlQn36h+JM t1cFCyWhLeSm3MvFwtlDfQjvWflDUNNl5p5OepjTVJyJgoOD6d48opmu/uuHOP9GQ7IX sZtsfXZ2N22szPFUiQRa84T5mT9aG58cd+iN8zdVPeoKNSJta41513MYGyBOxAIv0gks 0xdQ== 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 g66si442283pfc.13.2018.03.19.18.43.23; Mon, 19 Mar 2018 18:43:37 -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 S970048AbeCSS1p (ORCPT + 99 others); Mon, 19 Mar 2018 14:27:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51302 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970041AbeCSS1g (ORCPT ); Mon, 19 Mar 2018 14:27:36 -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 40F871266; Mon, 19 Mar 2018 18:27:35 +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.9 180/241] userns: Dont fail follow_automount based on s_user_ns Date: Mon, 19 Mar 2018 19:07:25 +0100 Message-Id: <20180319180758.600238403@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@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.9-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 @@ -1121,9 +1121,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;