From patchwork Tue Apr 26 19:36:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 8944051 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3EDBA9F1C1 for ; Tue, 26 Apr 2016 19:50:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9671C200FE for ; Tue, 26 Apr 2016 19:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C8A0201C7 for ; Tue, 26 Apr 2016 19:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753482AbcDZTuS (ORCPT ); Tue, 26 Apr 2016 15:50:18 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:36046 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752209AbcDZTgt (ORCPT ); Tue, 26 Apr 2016 15:36:49 -0400 Received: by mail-io0-f177.google.com with SMTP id u185so30173793iod.3 for ; Tue, 26 Apr 2016 12:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MkAZrbSN9OaKpWLseQs21OBl8PIsFIyWJQ3xzlHxo4M=; b=VIHxPx+3bflNNquA2l/dItjpDFMXwuU9K6z8TuupFiNTsFF0cmpaKXYwV2CUCZHQya IQoKxL52xa/THYSDJzWQvVETuHgqvpNb/8D0usGsooskKAYBuHLVOz+Bb+tJiOheN0b5 e4d0HjBQyU9ujyWQR4h7C++ftiqNUeNZlacNimk8HnD9C4sC3CcYPwifgI1Iqa0o6DNj /MZrU3VnB/gOY2iZ6etWcPfAZIc51mH7HXmFKKbWGFNOJevCl+J3geSYVIAQCcDCYin7 MhKA9LFcnjnLLfY63GBh2algw4beoc0sS7s0pQpI85fGlMWArMof/HWh7nanVYP8XdEa OKJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MkAZrbSN9OaKpWLseQs21OBl8PIsFIyWJQ3xzlHxo4M=; b=bd6JH9LdxabIALE6n9xU11TZ7B6E/80uIKXMI3Oyx9ckz53bq2BGgqgnVVbLNIJlNP lLso2cC8AswRZlpcRQfV3oXsSwpIQFUlxT73DcOx1hXxJ4gRZjjSAyLPHMgHsqKd/HVn OWWTBYg4dqcyMDe1gWsaBojKV+tW+OQCISzazoUvS0BjxO0rpLV9YGgRMOTh2Nhr/Q10 qobSlswOBTpfA2TZGgZm50tVSf/W6LrRxzIZ9a8cLIvZPOPD5DT7V9GBV7LsZW7faTYw 6itUD2fyOYzYC9PT/jyKDzu7jr8VgmAqfVlLAp0RDbwLec3zMfzXyW5Bkiu2oDHWjoNL uJ2A== X-Gm-Message-State: AOPr4FWt9neigS30JABTChzdgr072QhCISgk3f8OCN+MowtAGAdndWFZxjTcGBqoKpTx9IYZ X-Received: by 10.107.159.137 with SMTP id i131mr5333844ioe.29.1461699408416; Tue, 26 Apr 2016 12:36:48 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:39a1:5bcf:aa:5b00]) by smtp.gmail.com with ESMTPSA id qb7sm8765877igb.17.2016.04.26.12.36.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:36:47 -0700 (PDT) From: Seth Forshee To: "Eric W. Biederman" , Alexander Viro Cc: Serge Hallyn , Richard Weinberger , Austin S Hemmelgarn , Miklos Szeredi , Pavel Tikhomirov , linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, selinux@tycho.nsa.gov, cgroups@vger.kernel.org, Seth Forshee Subject: [PATCH v4 02/21] fs: Remove check of s_user_ns for existing mounts in fs_fully_visible() Date: Tue, 26 Apr 2016 14:36:15 -0500 Message-Id: <1461699396-33000-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1461699396-33000-1-git-send-email-seth.forshee@canonical.com> References: <1461699396-33000-1-git-send-email-seth.forshee@canonical.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP fs_fully_visible() ignores MNT_LOCK_NODEV when FS_USERS_DEV_MOUNT is not set for the filesystem, but there is a bug in the logic that may cause mounting to fail. It is doing this only when the existing mount is not in init_user_ns but should check the new mount instead. But the new mount is always in a non-init namespace when fs_fully_visible() is called, so that condition can simply be removed. Signed-off-by: Seth Forshee --- fs/namespace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index f20c82f91ecb..c133318bec35 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3234,8 +3234,7 @@ static bool fs_fully_visible(struct file_system_type *type, int *new_mnt_flags) mnt_flags = mnt->mnt.mnt_flags; if (mnt->mnt.mnt_sb->s_iflags & SB_I_NOEXEC) mnt_flags &= ~(MNT_LOCK_NOSUID | MNT_LOCK_NOEXEC); - if (mnt->mnt.mnt_sb->s_user_ns != &init_user_ns && - !(mnt->mnt.mnt_sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) + if (!(mnt->mnt.mnt_sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) mnt_flags &= ~(MNT_LOCK_NODEV); /* Verify the mount flags are equal to or more permissive