From patchwork Mon Jan 22 16:24:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Crequy X-Patchwork-Id: 10178841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A12960390 for ; Mon, 22 Jan 2018 16:25:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CB2228397 for ; Mon, 22 Jan 2018 16:25:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 105DB283BB; Mon, 22 Jan 2018 16:25:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2D6F283C7 for ; Mon, 22 Jan 2018 16:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751028AbeAVQZW (ORCPT ); Mon, 22 Jan 2018 11:25:22 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:41705 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087AbeAVQZV (ORCPT ); Mon, 22 Jan 2018 11:25:21 -0500 Received: by mail-wm0-f68.google.com with SMTP id f71so17420094wmf.0; Mon, 22 Jan 2018 08:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JUfV9va6RmWp8BK7LQaxTCfU3OKTt96bTzHFUZvMO7w=; b=R6RMOatDFYi5OgJzSFYbCxxha/hS+Bk/biPunQQs1MbN1FzcDTy+QBOqSdpeVbjLYc zrWYtBauTflIw0yYNKNPYCR1y+glqBAr+s9rPzSTURLfmRvneUnI+AqOIDg5NyK8yCTd EVg6E/H31KOPVO05nm8IniL062te+GMSi4GOmSgMLltkuIfkXdLNFvXYtLiaiGb0T7BF ABTFRzthP6c0x1FUtnZ9UyDKvwDVJRLmgh9n04V1Hi+k7MEfh9evFw6adrkWuSD50Bpa sjwr8poJKS4quScxxqqEKFlEnySWK7wyr34ofKWTV6fhsOOgriGZiQqgC8VeepCv0/gs ls1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JUfV9va6RmWp8BK7LQaxTCfU3OKTt96bTzHFUZvMO7w=; b=iRiGaaar1NMewX84M+KojYLMLxXgj1kbtGRxt3g6sck0oAgGpqj5cC/f6MT3q15AD6 HicOhPFSpfcFknghrH0kVuTWZoef5UqvKd7Zpem6Ey3aUEF/BLchtxZCGJPBteaGFkAq zXrg72JI+j3BNNPnnTJ6QvyV5qT0JMExlEheFvTVUKEUfWXkchp75K1JE5kvIcmL67dp daCtZ6lahwrK41PhHJqNAhXDivYf66seco5drkoAxS040rBE0AR1aT3/LStAz0L6ZYvM biv7fifSRuTyrkKiUUlC/QynWnKl9ZzJmAHwOpd7m8QEzpgkK/jU+/R/9mAiHueI/Vnh tYRA== X-Gm-Message-State: AKwxytcOIInSp1K4GFMoku2jDmG1h0TCgOb9De5cDflc9qsFQge9J+JU QFJfpHmWxg4f2vyku2yir64= X-Google-Smtp-Source: AH8x226Dl8dz9zSomHefe2JtdqldIyENp1xgAf7T5n6+dJYl/p/Z/brB4VE+tqt7hLL42u+jXVZWOA== X-Received: by 10.80.181.9 with SMTP id y9mr14072668edd.131.1516638319479; Mon, 22 Jan 2018 08:25:19 -0800 (PST) Received: from localhost.localdomain ([178.19.216.175]) by smtp.gmail.com with ESMTPSA id g21sm11920844edg.88.2018.01.22.08.25.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 08:25:18 -0800 (PST) From: Alban Crequy X-Google-Original-From: Alban Crequy To: alban@kinvolk.io Cc: dongsu@kinvolk.io, iago@kinvolk.io, linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, zohar@linux.vnet.ibm.com, dmitry.kasatkin@gmail.com, james.l.morris@oracle.com, serge@hallyn.com, seth.forshee@canonical.com, hch@infradead.org Subject: [RFC PATCH v3 1/2] fuse: introduce new fs_type flag FS_IMA_NO_CACHE Date: Mon, 22 Jan 2018 17:24:51 +0100 Message-Id: <20180122162452.8756-2-alban@kinvolk.io> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180122162452.8756-1-alban@kinvolk.io> References: <20180122162452.8756-1-alban@kinvolk.io> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Alban Crequy This new fs_type flag FS_IMA_NO_CACHE means files should be re-measured, re-appraised and re-audited each time. Cached integrity results should not be used. It is useful in FUSE because the userspace FUSE process can change the underlying files at any time without notifying the kernel. Cc: linux-kernel@vger.kernel.org Cc: linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: Miklos Szeredi Cc: Alexander Viro Cc: Mimi Zohar Cc: Dmitry Kasatkin Cc: James Morris Cc: "Serge E. Hallyn" Cc: Seth Forshee Cc: Christoph Hellwig Tested-by: Dongsu Park Signed-off-by: Alban Crequy --- fs/fuse/inode.c | 2 +- include/linux/fs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 624f18bbfd2b..0a9e516461d5 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1205,7 +1205,7 @@ static void fuse_kill_sb_anon(struct super_block *sb) static struct file_system_type fuse_fs_type = { .owner = THIS_MODULE, .name = "fuse", - .fs_flags = FS_HAS_SUBTYPE, + .fs_flags = FS_HAS_SUBTYPE | FS_IMA_NO_CACHE, .mount = fuse_mount, .kill_sb = fuse_kill_sb_anon, }; diff --git a/include/linux/fs.h b/include/linux/fs.h index 511fbaabf624..ced841ba6701 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_IMA_NO_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 *);