Received: by 10.192.165.148 with SMTP id m20csp750081imm; Wed, 25 Apr 2018 07:08:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZosyJRsC9KvSS3WIE3/l5c+BXVFm/0+Y0K9eX+s27yBv2n6ftdj34JBF0V9I2r16kL8RIo2 X-Received: by 10.98.29.82 with SMTP id d79mr3438117pfd.230.1524665321005; Wed, 25 Apr 2018 07:08:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524665320; cv=none; d=google.com; s=arc-20160816; b=s9okbyTnmWsU/1QfX81ogVsmca6naMaJ/IKAZBH9aXRoKKb9ESKNyF12v+i2FC5ptd X2co0V1XoCfDb1gfd+g8lQxz/xyaykQj+926LnqTkyDGyfBUd9W8XrxYTplsQBlTlRwf NTONJtZyqcDiebqF2BktxuaGdXMaw1rehNcHAI8r4rwrVZVVwIqvRqBMnipcvp/J3eGx UIVB2qZSxy9/CE51k3lhjPf60a9vSlO4P4/YLBYMOsPz//oZY+c4oVjgAoh5JzYJFxCW AZlVBDlOxhFS2MjB8R+00zE82P52aNhZNEG+1j3aPvxNVU1V7LIguyz2NsA9xylqnm3K sdGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-phdr :arc-authentication-results; bh=bI5YOERf+Ep85AZX6NGXBuzzAB/Zyey3RP1f5QsvgzQ=; b=nNltJYqz3dBfs5ZDvFZoo2v+H1Oa/6uTCgPQ9dh7VE71GB/TndijmV8xzbvRieQekp cXS8twk4lt0gObMVZ835o7xcVFNZZYeZx8UO4233iBp2lJohytSB+yxbzYSU7j/RUEjz NzkCSdx3TmgqFeKxY9IWO19xPHjXc3bLli4Xdug3wmhcss7sxB1JlXPMiqTPymh8+Qa8 sMdmGVUf7cp/fu46+whUF6PAhGEBJ5k39t6HyssyGo0LKE52JUY47lljaKHcuwJcTeIL /8nR0L4CWhNK1wxPHyRAEDhp8fzUPL3eO/NSycSyA8ya8Se3X4sRLJH4H035VQOoZuvs Mpbg== 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 w17si16050049pfa.135.2018.04.25.07.08.25; Wed, 25 Apr 2018 07:08:40 -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 S1754377AbeDYOGE (ORCPT + 99 others); Wed, 25 Apr 2018 10:06:04 -0400 Received: from uhil19pa10.eemsg.mail.mil ([214.24.21.83]:2294 "EHLO uhil19pa10.eemsg.mail.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753336AbeDYOGA (ORCPT ); Wed, 25 Apr 2018 10:06:00 -0400 Received: from emsm-gh1-uea10.ncsc.mil ([214.29.60.2]) by uhil19pa10.eemsg.mail.mil with ESMTP/TLS/AES256-SHA; 25 Apr 2018 14:05:58 +0000 X-IronPort-AV: E=Sophos;i="5.49,326,1520899200"; d="scan'208";a="11093547" IronPort-PHdr: =?us-ascii?q?9a23=3Aa4LYmRWvb2q2vSE5DQnHNe3A3E/V8LGtZVwlr6?= =?us-ascii?q?E/grcLSJyIuqrYZRaPvadThVPEFb/W9+hDw7KP9fy4AipYud6oizMrSNR0TR?= =?us-ascii?q?gLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ?= =?us-ascii?q?/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9uIhi6txndutULioZ+N6g9zQ?= =?us-ascii?q?fErGFVcOpM32NoIlyTnxf45siu+ZNo7jpdtfE8+cNeSKv2Z6s3Q6BWAzQgKG?= =?us-ascii?q?A1+dbktQLfQguV53sTSXsZnxxVCAXY9h76X5Pxsizntuph3SSRIMP7QawoVT?= =?us-ascii?q?mk8qxmUwHjhjsZODEl8WHXks1wg7xdoBK9vBx03orYbJiIOPZiYq/ReNUXSm?= =?us-ascii?q?RbXsZVSidPHIWyYYUSBOYFJOpUsZXxq14IoBCjBwejGfnvxydViHHo06000+?= =?us-ascii?q?cvHw/I0wMvHd0BrHvaoc7pNKoQS+250LXEwDvBYv5QxDzz6JLIchckofyUQL?= =?us-ascii?q?xwbdTeyVEvFwzbiFWbtJHrPzaP2eQJt2iU8ephXv+ohm48tg5xuSOixtssi4?= =?us-ascii?q?bVhoIVzUrI9SNiwIkvP9G4R0l7YcC9HZZWqiqUNJN2T9s/T2xntys20L0LtY?= =?us-ascii?q?OhcCQUx5kr2QTTZ+GBfoOV+BzsTvyRLi19hH99fbK/gAu9/la4x+3nU8m0zE?= =?us-ascii?q?5Kri1YktnQrnwN1wLc6syASvZl4keuwyyP1wHO6uFfO0w0iaraJIIhwr43jJ?= =?us-ascii?q?YTt1jMHjTql0nsia+Wd0Ek9vCp6+ThfLrmuoeRO5J7hwzxKKgjmtGzDf4mPg?= =?us-ascii?q?UBQWSX4/mw2KXm/ULjQbVKivM2krPesJDfPckbvbO2AxRO34Y/6xewEzem0N?= =?us-ascii?q?MCkXkBN1JKYgiLj4fuO1HQOPz4F+uwg0ywkDd3wPDLJqDuApXKLnnNjrjheb?= =?us-ascii?q?J961VHxQop099Q+pJUBasdIP7pRkDxs9nYBAcjMwOo2+bnFMl91oQGVGKXGK?= =?us-ascii?q?CZLafSvESQ5u01PumMYJYZuDP6K/gi/f7hk2U1lkMafamsxZEXcmy3Hux6I0?= =?us-ascii?q?WFZnrhmtMBEWYMvgojQ+3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CI4/BoE0hjqEYpFcMyGBUisIAhgIIQ+CfpBqIzB6AQGPK?= =?us-ascii?q?AEB?= Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by EMSM-GH1-UEA10.NCSC.MIL with ESMTP; 25 Apr 2018 14:05:58 +0000 Received: from moss-pluto.infosec.tycho.ncsc.mil (moss-pluto [192.168.25.131]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w3PE5vM4011019; Wed, 25 Apr 2018 10:05:57 -0400 Subject: Re: [PATCH 04/24] VFS: Add LSM hooks for filesystem context [ver #7] To: David Howells Cc: Paul Moore , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, viro@zeniv.linux.org.uk, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org References: <152414466005.23902.12967974041384198114.stgit@warthog.procyon.org.uk> <152414469006.23902.8132059438921850399.stgit@warthog.procyon.org.uk> <3232.1524238511@warthog.procyon.org.uk> <703.1524583367@warthog.procyon.org.uk> From: Stephen Smalley Message-ID: <1bb08eac-517a-a07e-5e64-5771cc0c0afc@tycho.nsa.gov> Date: Wed, 25 Apr 2018 10:07:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <703.1524583367@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/24/2018 11:22 AM, David Howells wrote: > Stephen Smalley wrote: > >> Neither fsopen() nor fscontext_fs_write() appear to perform any kind of >> up-front permission checking (DAC or MAC), although some security hooks may >> be ultimately called to allocate structures, parse security options, etc. >> Is there a reason not apply a may_mount() or similar check up front? > > may_mount() is called by fsmount() at the moment. It may make sense to move > this earlier to fsopen(). Note that there's also going to be something that > looks like: > > fd = fspick("/mnt"); > fsmount(fd, "/a", MNT_NOEXEC); // ie. bind mount > > or: > > fd = fspick("/mnt"); > write(fd, "o intr"); > write(fd, "x reconfigure"); // ie. something like remount > close(fd); > > I guess we'd want to call may_mount() in fspick() too. But there's also the > possibility of using this to create a query interfact too: > > fd = fspick("/mnt"); > write(fd, "q intr"); > read(fd, value_buffer); My concern was that fsopen()/fscontext_fs_write() may expose attack surface (e.g. mount option parsing code) that might not be normally accessible to unprivileged userspace (i.e. gated by may_mount() and security_sb_mount()) prior to your changes.