From patchwork Fri Apr 22 15:38:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 8913691 Return-Path: X-Original-To: patchwork-selinux@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 B5E069F457 for ; Fri, 22 Apr 2016 15:55:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11D312014A for ; Fri, 22 Apr 2016 15:55:07 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (smtp.nsa.gov [8.44.101.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E77820149 for ; Fri, 22 Apr 2016 15:55:05 +0000 (UTC) X-TM-IMSS-Message-ID: <61c1011c00000a47@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1) id 61c1011c00000a47 ; Fri, 22 Apr 2016 11:50:34 -0400 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3MFpAk3008377; Fri, 22 Apr 2016 11:51:11 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u3MFd6Un105258 for ; Fri, 22 Apr 2016 11:39:06 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u3MFd3xN004296 for ; Fri, 22 Apr 2016 11:39:05 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CqBAA7RBpX/yQp0ApeHYJwgXu1XoIZhBCGDgKBdAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBoGmBMT4xik+FKAEEjF0BAQEBAQEEAgEXBgqEDYIKjmABjkuJSIFVjEGJKYVlRY0sMIEOYoF4PoFTTgGIegEBAQ X-IPAS-Result: A0CqBAA7RBpX/yQp0ApeHYJwgXu1XoIZhBCGDgKBdAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBoGmBMT4xik+FKAEEjF0BAQEBAQEEAgEXBgqEDYIKjmABjkuJSIFVjEGJKYVlRY0sMIEOYoF4PoFTTgGIegEBAQ X-IronPort-AV: E=Sophos;i="5.24,517,1454994000"; d="scan'208";a="5402606" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 22 Apr 2016 11:39:01 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3Aq+BOBxTcFlE5Sp3X/f3w4pqANdpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65ZxaN2/xhgRfzUJnB7Loc0qyN4/CmBjRLscrJmUtBWaIPfidNsd?= =?us-ascii?q?8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4?= =?us-ascii?q?bt74BpTVx5zukbviq9uMO04Y2HKUWvBbElaflU3prM4YgI9veO4a6yDihT92Qd?= =?us-ascii?q?lQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGY2zRakzTKRZATI6KCh1oZSz7ViQ?= =?us-ascii?q?BTeIszExSGQd2iUOSyLE4R33RJL4tGGy4ud32SSWMNfzZaAxWC+57qBtDhTvjX?= =?us-ascii?q?FDfxc9/XHejMB9luploQim70hhwpTTSJOYMvtgOKfce84KA21bUYBMVHoSLJm7?= =?us-ascii?q?at40AvYBdchftZL9qlZG+QCzGQnqCuT10T9Fi1f91Ks91eUqGAWA1wslSYFd+E?= =?us-ascii?q?/Ipcn4Yf9BGdu+y7PFmHCaN6tb?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A1EiAQCfQhpXjzLaVdFeHYJwgXu1XoIZh?= =?us-ascii?q?BCCDYQBAoF0AQEBAQEBAgIPAQEBAQcLCwkhglx9Wz0BAQEDEhUZAQE3AQ9RNAE?= =?us-ascii?q?FARwGARIiiAgBoGyBMT4xik+FKAEEjF0BAQEBAQEEAgEXBgqEDYIKjmCOTIlIg?= =?us-ascii?q?VWMQYkphWVFjSwwgQ6CWh4ggVNOAYh6AQEB?= X-IPAS-Result: =?us-ascii?q?A1EiAQCfQhpXjzLaVdFeHYJwgXu1XoIZhBCCDYQBAoF0AQE?= =?us-ascii?q?BAQEBAgIPAQEBAQcLCwkhglx9Wz0BAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBo?= =?us-ascii?q?GyBMT4xik+FKAEEjF0BAQEBAQEEAgEXBgqEDYIKjmCOTIlIgVWMQYkphWVFjSw?= =?us-ascii?q?wgQ6CWh4ggVNOAYh6AQEB?= X-IronPort-AV: E=Sophos;i="5.24,517,1454976000"; d="scan'208";a="12934420" Received: from emvm-gh1-uea09.nsa.gov ([10.208.42.194]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Apr 2016 15:39:00 +0000 X-TM-IMSS-Message-ID: Received: from mail-oi0-f50.google.com (mail-oi0-f50.google.com [209.85.218.50]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id ad94375500000614 ; Fri, 22 Apr 2016 11:38:33 -0400 Received: by mail-oi0-f50.google.com with SMTP id k142so120563938oib.1 for ; Fri, 22 Apr 2016 08:38:59 -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=tLFegEwwDcylJqTnIoGKgxep+AhVHNMSNa0m7lNyOmU=; b=Hn66zJW0paPIZ/WihjGVT9XoPrWElWH3SsPsWbjr6PWQHHjf+4yRkh6DhCp1sFPRLy gmfG4MDSK0HGKQ5KxYh0k50YCpSI4bOcJwQ4+sNn+jl00cIuelj+ZQhJsaB8PJQaD2zf CQYhr/fljTbnbJDAkfmNa/7XuGXYgam2za7mFh9isgFSUH3Dy31waJcjAIqCEWoI8Ncs i16hEMMeMljJso4fpHFkYxF34KEZcOBdaPyvvpbP68X7gTqL2qAfWsUUHMfRqxNRO+kR /Igc2aUDygjxcCbAc8iBH0nN2EnZnrI9eBMX5LZ9GleNvvM7bn0fcLlk3wmNlSxbWIzm yxUQ== 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=tLFegEwwDcylJqTnIoGKgxep+AhVHNMSNa0m7lNyOmU=; b=MpinS28Ox7I7av/IfqX48EUpbMf8OCg7wqmdw2x39JvjXfsWW22CJ2uaLX3SB09pFk wWwcujkS79CnnGsnr0CNCesNc4dibCPn3rMvjCpaLP8WvAi0RzD+L40OXsnngZH55fMQ u84ejDYEgvoaOLvdGiowGhozrhLX24bbGFJwRBjueG2+FVurLiSJ6R1guoucBXrp/+HZ y+RawQgR0gdI9qXh+rqsX9l4xCfMdRKvEhvE4Z8u1qas49UE4U7QCdGzU2dB5epodAet wo4xzC5tlv18ffE1gjwHlcOksQ2u+O+ymYo/Tk/H1eneKoOw+dxp2g63sBXEJ56iUKzw ZztQ== X-Gm-Message-State: AOPr4FUgWr+whzpf16gPiAyL+WlHr8LRTgm0b05Lb9b/PEgYk2nlSLSo38JXDYivu1SzgNmz X-Received: by 10.202.60.5 with SMTP id j5mr8894267oia.43.1461339538692; Fri, 22 Apr 2016 08:38:58 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:ad1c:41df:dcb1:a4a0]) by smtp.gmail.com with ESMTPSA id xt3sm2104107obc.28.2016.04.22.08.38.58 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 22 Apr 2016 08:38:58 -0700 (PDT) From: Seth Forshee To: "Eric W. Biederman" , Alexander Viro Subject: [PATCH v3 02/21] fs: Remove check of s_user_ns for existing mounts in fs_fully_visible() Date: Fri, 22 Apr 2016 10:38:19 -0500 Message-Id: <1461339521-123191-3-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> References: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> X-TM-AS-MML: disable X-Mailman-Approved-At: Fri, 22 Apr 2016 11:40:16 -0400 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: linux-bcache@vger.kernel.org, Serge Hallyn , Seth Forshee , dm-devel@redhat.com, Miklos Szeredi , Richard Weinberger , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, fuse-devel@lists.sourceforge.net, Austin S Hemmelgarn , linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, Pavel Tikhomirov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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