Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp931377yba; Thu, 16 May 2019 11:11:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWl07GPRcHQ7p4SgVSBeko8LcjNYGQiuGT0l2jZ/x9UQLAxwlgvWHf198OQHKj3/3+757i X-Received: by 2002:a63:fd4a:: with SMTP id m10mr52653248pgj.302.1558030279358; Thu, 16 May 2019 11:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558030279; cv=none; d=google.com; s=arc-20160816; b=vAvOE1rZJAnG05kP2bfbFsMNY2uWfM6LDVO/3Mvbhqdfw+N3ITN3dTaT6HvzfIQyAq Sux+txJEpmwzfARQfa7vYRkGQl129e2zZgZmGokgwv7QDQCrnUKnWra23uufSYjf1Fb8 FLNMBsFsxqzpNoViP4jAULGoOUMilNJcHyYn+T3CIDrxBZt/Aukz4xpO72VHMAO+STqH ypXaWeOhTQg+LvtAq5283u1+gHVF/7DM8brAbz9fXbYOku5zALVXVkEe2/QlZa+G7IXY Mqn7NKZMyf+lSh1Z9ulQNjC0jmbFbzoSGixytZ6cPQ0Z2q1X1wCJw6jSp3RPEV7LbS+l fpcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=2V6Y2HqH+nLKeWicZN40zzwv4Q5tRhoUqEvr62aS2RQ=; b=kpjqqPbatCFy/chXrBy/Ykoo4oE6lwMp94YhH+YPubFB3ZtB8FWLo3lmUj/yo6dg5q NBL0gq32tHGbQh/T+BlmMA2OwHA7jBePLQD+cxr5Na523g3yHuCciZwiCWri8UX8Znt5 SVOAetUHbSiKmeaWV/m7y10UaaHNW+5xERMM+0T45wqF5/Nn1Dic6G3cIC/XOJtRRPdC xb+vq/WdRIcUZ9UU96oIaJC7Wu5N4DklznZbnx/dv6nTrfr5hMDjApPynKmP8TBK7+Mr RJd1nVSBpV7L55x+YpuKEAKVD/NFwBFULtccfWUHf8K4ui/VBe3lvazHOLR6gujZ/Xwn n/zA== 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 h10si5442865pll.2.2019.05.16.11.11.00; Thu, 16 May 2019 11:11:19 -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 S1727044AbfEPQSX (ORCPT + 99 others); Thu, 16 May 2019 12:18:23 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:32948 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726422AbfEPQSX (ORCPT ); Thu, 16 May 2019 12:18:23 -0400 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 0D8EE4978D639E36D45B; Thu, 16 May 2019 17:18:22 +0100 (IST) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.154) by smtpsuk.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 16 May 2019 17:18:13 +0100 From: Roberto Sassu To: , , CC: , , , , , Roberto Sassu , Subject: [PATCH 4/4] ima: only audit failed appraisal verifications Date: Thu, 16 May 2019 18:12:57 +0200 Message-ID: <20190516161257.6640-4-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516161257.6640-1-roberto.sassu@huawei.com> References: <20190516161257.6640-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.65.154] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch ensures that integrity_audit_msg() is called only when the status is not INTEGRITY_PASS. Fixes: 8606404fa555c ("ima: digital signature verification support") Signed-off-by: Roberto Sassu Cc: stable@vger.kernel.org --- security/integrity/ima/ima_appraise.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index a32ed5d7afd1..f5f4506bcb8e 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -359,8 +359,9 @@ int ima_appraise_measurement(enum ima_hooks func, status = INTEGRITY_PASS; } - integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, filename, - op, cause, rc, 0); + if (status != INTEGRITY_PASS) + integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, + filename, op, cause, rc, 0); } else { ima_cache_flags(iint, func); } -- 2.17.1