From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBD4DC04AAA for ; Mon, 13 May 2019 12:54:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DD81208C3 for ; Mon, 13 May 2019 12:54:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MuFITepI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730042AbfEMMyk (ORCPT ); Mon, 13 May 2019 08:54:40 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39247 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727462AbfEMMyj (ORCPT ); Mon, 13 May 2019 08:54:39 -0400 Received: by mail-lj1-f194.google.com with SMTP id a10so2867325ljf.6; Mon, 13 May 2019 05:54:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/OasKaK8trru7E4rpuopnZXhAHikdiab0mVyv+wSaEY=; b=MuFITepIez4h6wo9/OA/es6WJGylkwB7T+8DCT+6yIsyj0DBFE18e4mDsnYc/rl3Du /fB7Y6/cyfE8iEkHuogqGapXqCyhEEFSY69FBG96e8mlnCSOK6Ix08wNfplumkH/T2yG sBPxnajy8tKiEzLDPiTLwkUe+Do0xtrk8f6VtcbkHaysMGmhc89by4Irw2/6YUHhukfe +qxi7IBqzViMVJ1stGGdYTChStX1W2fjAzBlys8NoT00a88cmGGf6iduJVJSgt9FZckx 9ROs+1XDYK1QSweiMFxW35OFzmrWQ8uQWd3yp6tT9e9OnzZn4KLUqW4FhdK+KsRXtIRa f0cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/OasKaK8trru7E4rpuopnZXhAHikdiab0mVyv+wSaEY=; b=FvY7kejrtJAjsKCXcsjH59/mqUJ8v/yJZk31RSW6APBU7rVz76P2nprW+2OboB61VV vxq8q+CQHFiK7k7uJB2B8eCYH9OsS7ttFoW+cvLu4KqJArIQvTUqC/hmx0dsXlC5oTkL FSwvZ6VuP7pimkMihWV2o/uifBPNaJ8toTBKd29w3EWq2Yw28zZvatKJxE9/WxlgE/2U ChRelj9yFW37E1Vw3eGO3rYq/RXhlMHkpdngLfOeW7+bnsUklNnez5NwOPKvWEgeYIqE FLLdQg9ImI2G8spBoE8MjVAcnuFeubT+6I68z3KbxgfR7UDahNMt2Ft58e15CsjgO6B/ 9wsw== X-Gm-Message-State: APjAAAUxTH41gfyg4SuEPzQqZ5im2G99/Phtl6iWlKuI5Ssc5vPNn1LQ 3ba7oVEMGTB2JmLNFP8KkpI3C1VIZ30= X-Google-Smtp-Source: APXvYqzmI6bu/aF+fXadcpT0jAcGTq2LMmg5wvMVjVSBAwnNrGyynelsuFwRzlWy8KnJm71or44haA== X-Received: by 2002:a2e:80d5:: with SMTP id r21mr1793058ljg.43.1557752077035; Mon, 13 May 2019 05:54:37 -0700 (PDT) Received: from localhost.localdomain (mobile-user-2e84ba-11.dhcp.inet.fi. [46.132.186.11]) by smtp.gmail.com with ESMTPSA id t22sm3202924lje.58.2019.05.13.05.54.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 05:54:36 -0700 (PDT) From: Janne Karhunen To: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, zohar@linux.ibm.com Cc: Janne Karhunen , Konsta Karsisto Subject: [PATCH 4/5] integrity: measure the file on sync Date: Mon, 13 May 2019 15:53:53 +0300 Message-Id: <20190513125354.23126-5-janne.karhunen@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190513125354.23126-1-janne.karhunen@gmail.com> References: <20190513125354.23126-1-janne.karhunen@gmail.com> Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: When user requests a file sync, make sure that the IMA measurement reflects the state of the data being sync'd. Depends on commit c8213962517e ("integrity: keep the integrity state of open files up to date")' Signed-off-by: Janne Karhunen Signed-off-by: Konsta Karsisto --- fs/sync.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/sync.c b/fs/sync.c index b54e0541ad89..90353f9ed931 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "internal.h" #define VALID_FLAGS (SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE| \ @@ -194,6 +195,8 @@ int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync) return -EINVAL; if (!datasync && (inode->i_state & I_DIRTY_TIME)) mark_inode_dirty_sync(inode); + ima_file_update(file); + return file->f_op->fsync(file, start, end, datasync); } EXPORT_SYMBOL(vfs_fsync_range); -- 2.17.1