Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2948399imm; Thu, 24 May 2018 19:41:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZotIJ227pC6YXw4M6FcJ7mzGLNWr/tT/5O8k7ovIIUY3VoXz8PXnMc7QvjU+8c+I59bznmp X-Received: by 2002:a17:902:d886:: with SMTP id b6-v6mr588280plz.361.1527216094702; Thu, 24 May 2018 19:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216094; cv=none; d=google.com; s=arc-20160816; b=YjgLOLXgFHKnQxYwxrGIzTlOnX0rIGB7eCRpJelTvVKN+vzqbY7/1eQHSWDfKAk105 T32mpTlR7K9SS50DltTVPwuiCKQfOZHxck1z33I1lgPZExjEXZWI4pyXpS/FZu5mITIY YBcH3SlZ5cIZ+xMloNM7/hJqhtRwG2w3GYAa2uuubNe8ZZQvMo9Oqq3KJP4Ge1OIsEu0 j5MUH/Iu+q1EbNobWk6yUgx0JU+8XZpme2Ixm6JH9zW2q+yXG8vsx+p9F/57L7stiIWI n24ETLWlWiajEJW+ypzsfW8L9tAxrBZ7nm82DM9iVjSCdzPIfCG2TGCVGqQBlA1aLVwm V8nQ== 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=cqpHA3ErNoW3jMPWeL99DVul9qKhGIN62q6DuFXE5LI=; b=YC3oLd1cuptKZsdAZoCFmgc+lg7y1zPOwWlLCcXSKP9OMiequbAkmY+XPLezHnEG6z WsH6H4vA0A07GWuBYJwgw+SRhs88JEz4i9e56kqJ7ywe16SwlOzfq7+DirXD89uFFATL 9F0jXMGRF4AqpB1h03otLSd2cDpGh6jQrLWVEK0LYeMNSDDnI6dptH2VACyN+9i6loiv 2meGdgEfVkvQf9k2mzKoUL+IX1Vik1vhJormw/4wW7/uZfSuA+soJMxtfrnswvw2XSta JK+iej+8y0bGLI5ZV2YFihISe7xw/6WgciWppLYs7uHtvT8Y7H6EQ7MPA4HJJlbuLCrO sXDg== 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 1-v6si22600454plx.236.2018.05.24.19.41.20; Thu, 24 May 2018 19:41:34 -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 S971349AbeEXUL5 (ORCPT + 99 others); Thu, 24 May 2018 16:11:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41046 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S969004AbeEXULT (ORCPT ); Thu, 24 May 2018 16:11:19 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4OK4ixj076106 for ; Thu, 24 May 2018 16:11:19 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j60vp8me9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 May 2018 16:11:18 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 May 2018 16:11:17 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 24 May 2018 16:11:14 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4OKBDKZ61866234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 May 2018 20:11:13 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DFCBDAC0E8; Thu, 24 May 2018 16:12:42 -0400 (EDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id C9288AC0E7; Thu, 24 May 2018 16:12:42 -0400 (EDT) From: Stefan Berger To: zohar@linux.vnet.ibm.com, sgrubb@redhat.com Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-audit@redhat.com, Stefan Berger Subject: [PATCH 7/8] ima: Do not audit if CONFIG_INTEGRITY_AUDIT is not set Date: Thu, 24 May 2018 16:11:04 -0400 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180524201105.3179904-1-stefanb@linux.vnet.ibm.com> References: <20180524201105.3179904-1-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18052420-0056-0000-0000-000004547EDA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009065; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000261; SDB=6.01036001; UDB=6.00529949; IPR=6.00815130; MB=3.00021234; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-24 20:11:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052420-0057-0000-0000-000008989C3B Message-Id: <20180524201105.3179904-8-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-24_07:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805240228 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 | 10 ++++++++++ 3 files changed, 16 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 7297450b813c..3aed25a7178a 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -609,6 +609,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) @@ -630,7 +633,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 9f2924cafa53..2afa266aea42 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h @@ -203,6 +203,11 @@ void integrity_audit_msg_common(struct audit_buffer *ab, struct inode *inode, const unsigned char *fname, const char *op, const char *cause, int result); +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, @@ -220,4 +225,9 @@ static inline void integrity_audit_msg_common(struct audit_buffer *ab, { } +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