From patchwork Mon Feb 11 16:53:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ignaz Forster X-Patchwork-Id: 10806333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA98E13A4 for ; Mon, 11 Feb 2019 16:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C96C62A1F0 for ; Mon, 11 Feb 2019 16:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD1CC2A2A0; Mon, 11 Feb 2019 16:55:06 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 7354E2A1AE for ; Mon, 11 Feb 2019 16:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727400AbfBKQzG (ORCPT ); Mon, 11 Feb 2019 11:55:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:36136 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726036AbfBKQzG (ORCPT ); Mon, 11 Feb 2019 11:55:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C983AAC8D; Mon, 11 Feb 2019 16:55:04 +0000 (UTC) From: Ignaz Forster To: Mimi Zohar , linux-integrity@vger.kernel.org, Miklos Szeredi , linux-unionfs@vger.kernel.org Cc: Fabian Vogt , Ignaz Forster , Fabian Vogt Subject: [PATCH 3/5] Execute IMA post create hook in vfs_create Date: Mon, 11 Feb 2019 17:53:21 +0100 Message-Id: <20190211165323.9369-4-iforster@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190211165323.9369-1-iforster@suse.com> References: <20190211165323.9369-1-iforster@suse.com> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ignaz Forster When creating a new file on overlayfs, the file can not be accessed due to missing security.ima / security.evm xattrs, as the creation of the required hashes is never triggered. Similarly to the existing handling of tmpfiles, trigger file hash generation by calling ima_post_create_file. Co-developed-by: Fabian Vogt Signed-off-by: Fabian Vogt Signed-off-by: Ignaz Forster --- fs/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 744e89474cda..3b4021e4fc32 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2910,8 +2910,10 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, if (error) return error; error = dir->i_op->create(dir, dentry, mode, want_excl); - if (!error) + if (!error) { fsnotify_create(dir, dentry); + ima_post_create_file(dentry->d_inode); + } return error; } EXPORT_SYMBOL(vfs_create);