From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33294 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755975AbeASQ4X (ORCPT ); Fri, 19 Jan 2018 11:56:23 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0JGtGSo097304 for ; Fri, 19 Jan 2018 11:56:22 -0500 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2fkhtyyxm9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 19 Jan 2018 11:56:21 -0500 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 19 Jan 2018 16:56:19 -0000 Subject: Re: [RFC PATCH v2] ima,fuse: introduce new fs flag FS_NO_IMA_CACHE From: Mimi Zohar To: Alban Crequy Cc: Alban Crequy , Iago =?ISO-8859-1?Q?L=F3pez?= Galeiras , Dongsu Park , LKML , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, Miklos Szeredi , Alexander Viro , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , Seth Forshee , Christoph Hellwig Date: Fri, 19 Jan 2018 11:56:10 -0500 In-Reply-To: References: <20180116151000.443-1-alban@kinvolk.io> <1516310702.3772.11.camel@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Message-Id: <1516380970.3772.112.camel@linux.vnet.ibm.com> Sender: linux-integrity-owner@vger.kernel.org List-ID: On Fri, 2018-01-19 at 11:35 +0100, Alban Crequy wrote: > On Thu, Jan 18, 2018 at 10:25 PM, Mimi Zohar wrote: > > On Tue, 2018-01-16 at 16:10 +0100, Alban Crequy wrote: > >> From: Alban Crequy > >> > >> This patch forces files to be re-measured, re-appraised and re-audited > >> on file systems with the feature flag FS_NO_IMA_CACHE. In that way, > >> cached integrity results won't be used. > >> > >> For now, this patch adds the new flag only FUSE filesystems. This is > >> needed because the userspace FUSE process can change the underlying > >> files at any time. > > > > Thanks, it's working nicely. > > > > > >> diff --git a/include/linux/fs.h b/include/linux/fs.h > >> index 511fbaabf624..2bd7e73ebc2a 100644 > >> --- a/include/linux/fs.h > >> +++ b/include/linux/fs.h > >> @@ -2075,6 +2075,7 @@ struct file_system_type { > >> #define FS_BINARY_MOUNTDATA 2 > >> #define FS_HAS_SUBTYPE 4 > >> #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ > >> +#define FS_NO_IMA_CACHE 16 /* Force IMA to re-measure, re-appraise, re-audit files */ > >> #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ > >> struct dentry *(*mount) (struct file_system_type *, int, > >> const char *, void *); > >> > > > > Since IMA is going to need another flag, we probably should have a > > consistent prefix (eg. "FS_IMA"). Maybe rename this flag to > > FS_IMA_NO_CACHE. > > Ok, I can rename it. > > Is there a discussion about the other IMA flag? There's not a single thread that I can point to, but more of an on going discussion as to what it means for a filesystem to support IMA and how that decision is made. - Initial measuring, verifying, auditing files - Safely detecting when a file changes - Not applicable/supported With Sascha Hauer's patch "ima: Use i_version only when filesystem supports it" and this patch, the second issue is addressed, but will cause files to be re-validated, perhaps unnecessarily, impacting performance. Some filesystems should not be evaluated, such as pseudo filesystems (eg. cgroups, sysfs, devpts, pstorefs, efivarfs, debugfs, selinux, smack). Instead of defining a flag indicating whether or not IMA is applicable/supported, we should define a new flag, indicating whether it is a pseudo filesystem. This would eliminate a large portion of at least the builtin IMA policy rules. > > I'm also wondering if this change should be > > separated from the IMA change. > > Do you mean one patch for adding the flag and the IMA change and > another patch for using the flag in FUSE? The flag and FUSE usage of the flag, separately from IMA. Mimi