Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp671727imm; Thu, 31 May 2018 07:28:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKZgiNe8DAsQzK21BlQzcJ02naJ32BeAkF5/MM1HHmzouq9IIC7dLdcP+8ybR8QacgFS3i3 X-Received: by 2002:a63:85c8:: with SMTP id u191-v6mr5479374pgd.300.1527776884542; Thu, 31 May 2018 07:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527776884; cv=none; d=google.com; s=arc-20160816; b=JQVC78LpC1UZaAusINwB4tuyJnW640r0EXC+JKpwqknQ3I+Ic23rrevSmymGtVpoqg NniEaTCBcVecMZZT6UVg/RkxPa+swPohBVLr4ecenrEVpPvrIqsWrVCxneF66p3c85u9 H6/NcRPq2sNN+uz2ZIVJ5RkctxQhw0DYfBDB7QgzH8vX5gcI7bZYwfl0s/GW5qDtN1Wt eklo8HCbkKSCbnvsnK406lJxizk6ZdwrxTSJCkOjW7Vc3LteNIgzeA+MWF3ajPJ8DPz/ jdUlPr0GwoZDZZL1VJ5ROstGxBo0LwuES4kF5IlhGlaCXmz3jCEYNny6H5rtabMcmfmu F+rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=o717o7wf3oBlPB3Y3L2BzgY8AQWMDypP+ECtKJo4260=; b=hBl4CZ2f7enPUxvcWNHntyy7XTBACqvPKyBAtQxT4zgk/48ic/ezIlUDF4OiSnCjvj cJcJ2pAk+RUuAK78Wv0AgXGndnF1dTBIBggH8M/ZkU9pWOfnqeY4vBaweA06bfvPzs0a 18SL58fTP80gtg9QUzg8t0q36NtGamgDN51gN2zyzNcvC3Vfcb5593wnTlQ8tvexJggb RldHTVS2ope9+YE7eBw1vRRgm2EXExGKDF/9lT9DEAxk5j6uHXH/C2ZoCQLF2xYW2yKm Ah3B7t1wiZY+V2m45VnUAnwALjVVGd0bPNtWD64N4KnQMUEZzYzFLXexrJn5exW2TT6b MWKg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 73-v6si37571932pfh.315.2018.05.31.07.27.50; Thu, 31 May 2018 07:28:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755437AbeEaOZr (ORCPT + 99 others); Thu, 31 May 2018 10:25:47 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53336 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755339AbeEaOZN (ORCPT ); Thu, 31 May 2018 10:25:13 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4VEOGNg126484 for ; Thu, 31 May 2018 10:25:12 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jah5kd0q1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 31 May 2018 10:25:12 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 May 2018 08:25:12 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 31 May 2018 08:25:08 -0600 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4VEP7ZE17039664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 31 May 2018 07:25:08 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D302378037; Thu, 31 May 2018 08:25:07 -0600 (MDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP id 64BD27804D; Thu, 31 May 2018 08:25:07 -0600 (MDT) From: Stefan Berger To: zohar@linux.vnet.ibm.com, paul@paul-moore.com, linux-integrity@vger.kernel.org, linux-audit@redhat.com Cc: sgrubb@redhat.com, linux-kernel@vger.kernel.org, Stefan Berger Subject: [PATCH v2 3/4] ima: Do not audit if CONFIG_INTEGRITY_AUDIT is not set Date: Thu, 31 May 2018 10:24:59 -0400 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180531142500.4193818-1-stefanb@linux.vnet.ibm.com> References: <20180531142500.4193818-1-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18053114-0020-0000-0000-00000E0F4EA8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009102; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000264; SDB=6.01040334; UDB=6.00532532; IPR=6.00819463; MB=3.00021393; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-31 14:25:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18053114-0021-0000-0000-000061AE8518 Message-Id: <20180531142500.4193818-4-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-31_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805310163 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If Integrity is not auditing, IMA shouldn't audit, either. Signed-off-by: Stefan Berger --- security/integrity/ima/Kconfig | 1 + security/integrity/ima/ima_policy.c | 6 +++++- security/integrity/integrity.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig index 6a8f67714c83..94c2151331aa 100644 --- a/security/integrity/ima/Kconfig +++ b/security/integrity/ima/Kconfig @@ -12,6 +12,7 @@ config IMA select TCG_TIS if TCG_TPM && X86 select TCG_CRB if TCG_TPM && ACPI select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES + select INTEGRITY_AUDIT if AUDIT help The Trusted Computing Group(TCG) runtime Integrity Measurement Architecture(IMA) maintains a list of hash diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index 3fcf0935468c..bc99713dfe57 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -628,6 +628,9 @@ static int ima_lsm_rule_init(struct ima_rule_entry *entry, static void ima_log_string_op(struct audit_buffer *ab, char *key, char *value, bool (*rule_operator)(kuid_t, kuid_t)) { + if (!ab) + return; + if (rule_operator == &uid_gt) audit_log_format(ab, "%s>", key); else if (rule_operator == &uid_lt) @@ -649,7 +652,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) bool uid_token; int result = 0; - ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_RULE); + ab = integrity_audit_log_start(NULL, GFP_KERNEL, + AUDIT_INTEGRITY_RULE); entry->uid = INVALID_UID; entry->fowner = INVALID_UID; diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index 0bb372eed62a..e60473b13a8d 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h @@ -15,6 +15,7 @@ #include #include #include +#include /* iint action cache flags */ #define IMA_MEASURE 0x00000001 @@ -199,6 +200,13 @@ static inline void evm_load_x509(void) void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result, int info); + +static inline struct audit_buffer * +integrity_audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type) +{ + return audit_log_start(ctx, gfp_mask, type); +} + #else static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, @@ -206,4 +214,11 @@ static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, int result, int info) { } + +static inline struct audit_buffer * +integrity_audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type) +{ + return NULL; +} + #endif -- 2.13.6