Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp105492imm; Mon, 4 Jun 2018 13:56:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKICbZzgnW5nv69D/trd981IoqpEwAzp6A9OKT+1mnSAbvEPbizBvgQsRcmNSLs76JyZ0fCC X-Received: by 2002:a62:ec5b:: with SMTP id k88-v6mr22400326pfh.85.1528145766774; Mon, 04 Jun 2018 13:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528145766; cv=none; d=google.com; s=arc-20160816; b=wBFJjq0P8+ub7ORdJrcBOi6A0RMs8oBlFtHZLtv6ECVlzxEWMMBLmRku7hju6f3Yah tqBd3L6Bo8UlDtILs6OC9E3HNmvJ3J/zGrsjMDUqF4hxFrXKWUtuz1bwGNwBtV0LREbd lErDQoa3X2RKXwEtEFSer8sHxVZsS/H6HPct6xmjJy9HlV6fcL5RwM2T3x61HEvXIJ+e 7KstPURu52KkCiBBW0fDXXU9wnZKtpTWWjhWH7+x9zBoKKr7h+v6pIB++3Fs8/3cVspu DiHvKfJiUurqpqGd9ag7n7mYk4wiiBdbWDyu0xHRoUF2gbQdz++8xWDET+JMkboYtXoL lMzA== 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=x1dfwaiNZI/4Ibg27lntJCdu0UDvf7Sp+8Ylgq9ypBtlQxb44hQeQcgXEgKwNwK4ks l8krv9FNJFojwt4jTKk6RrgQjMgSRb8ozAiKHCyrv1n9tLoc2d6lX/0lfFgGn+7EjjFK 3WkpOm+WcRVUcJJilJsLhfpY8kFT/fp4p21wxMms/KCd0UcYEzmFG85eaOyG1uI0r7DB vdBHlf22nA0MTs6QgD1hopT5JuPNJYqrW7EdBcn7gjjCzPh1zU+lkrwpM8DC4EfIEFnx haPhjdZ89FO6Ik3cv+Si7/G6CKhrzoYU0BOYF43h/w6ezWj2F/2j8LPh6H2+dav+rSF7 h9YA== 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 f89-v6si20711062pff.208.2018.06.04.13.55.50; Mon, 04 Jun 2018 13:56:06 -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 S1751510AbeFDUzN (ORCPT + 99 others); Mon, 4 Jun 2018 16:55:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59690 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbeFDUzI (ORCPT ); Mon, 4 Jun 2018 16:55:08 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w54Kic99005724 for ; Mon, 4 Jun 2018 16:55:08 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jd9kd8172-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Jun 2018 16:55:08 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2018 14:55:07 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Jun 2018 14:55:04 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w54Kt35Q62455950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Jun 2018 13:55:03 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C58A96E04C; Mon, 4 Jun 2018 14:55:03 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B7776E05E; Mon, 4 Jun 2018 14:55:03 -0600 (MDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 4 Jun 2018 14:55:02 -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 v3 3/4] ima: Do not audit if CONFIG_INTEGRITY_AUDIT is not set Date: Mon, 4 Jun 2018 16:54:54 -0400 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180604205455.2325754-1-stefanb@linux.vnet.ibm.com> References: <20180604205455.2325754-1-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060420-0016-0000-0000-000008E299D6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009129; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01042340; UDB=6.00533730; IPR=6.00821470; MB=3.00021461; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-04 20:55:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060420-0017-0000-0000-00003F1933FA Message-Id: <20180604205455.2325754-4-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-04_14:,, 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-1806040238 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