Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2948438imm; Thu, 24 May 2018 19:41:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpEWB3MbFMnGxK44CY1yk9rjkjFZL8Kx6yCsqZUKLMgS4NdKBKUUFMxo94xWkUcOvxgh2wm X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr606574plk.101.1527216097286; Thu, 24 May 2018 19:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216097; cv=none; d=google.com; s=arc-20160816; b=CO6ChRP3DDekbVNUQJcnjNv1EC11x0raNgvvsUpddGDwmsJmVvZBH3SmoWUJKYtFlC U01bKgvS5wBEoDi0ASq7I5CRb0gw59OdTwnILjdM6mXTDLsTOqO3Z3EzzQ5ScWIjjr+R 3JBQdZNy+QNmf57qdWWgpE8js4wMCuaPG0RTXj1fqKJ3dntamWdw0rtlGq2gSx659dUk F7/S7OFLQyFyF2uEie5mr1p3vau6mv7pCmo7kqKZORva4NmWf5fRoGxajxkKmEG0J5C9 EmxvnXCjiZNTGx/gItDQ5aiHe6bucTpONvZqmL4UnxzZmYXkiYlpnmXgF3oRvchFbvRI Rzig== 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=mtZMQvw65VPKPi4I6nGE+S2MXi0o1I7Ga08ClCsmB1Y=; b=vvXhWbjw0tpiwaksWxv1wiOAzeebJH8v6EtFBZmv/giRkC50QAyxqgY3UixqdKbrCM +KKGYst82P5Yn/r66aIQDBL0ZbIRggo06NBvAtmkf9r/SZsW8MEL6f4LJvK6EhKY1z6L YqR4tWYnmO9fQGBYgdgK296q3pDEWdaZbXmmEKDv+ycbHsChvfNE2LxPK8xhtYscT+2M hVlahlPAxZREkAbFEZMTD2UhiemTig/pux7JFBcrupAIM9a0Zk6caB47emaeWkvhAszN i+ctGtAVQ08t0/NiyBpMJNt5G4b1OOGJWrnzLMNNdud7Zvafx5B7KDcLa3i/olfQNcP7 UbbQ== 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 g9-v6si22046027plt.232.2018.05.24.19.41.22; Thu, 24 May 2018 19:41:37 -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 S971362AbeEXUL7 (ORCPT + 99 others); Thu, 24 May 2018 16:11:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39006 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968880AbeEXULS (ORCPT ); Thu, 24 May 2018 16:11:18 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4OK4IIE033803 for ; Thu, 24 May 2018 16:11:17 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j61g8xvv6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 May 2018 16:11:17 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 May 2018 16:11:15 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 24 May 2018 16:11:13 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4OKBCHY18743620; Thu, 24 May 2018 20:11:12 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D237AAC0E6; Thu, 24 May 2018 16:12:41 -0400 (EDT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id C503EAC0E5; Thu, 24 May 2018 16:12:41 -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 6/8] integrity: Factor out common part of integrity_audit_msg() Date: Thu, 24 May 2018 16:11:03 -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-0040-0000-0000-000004317D4B 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:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052420-0041-0000-0000-000008379AE8 Message-Id: <20180524201105.3179904-7-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 Factor out a common part of integrity_audit_msg() that others can also call. Signed-off-by: Stefan Berger --- security/integrity/integrity.h | 16 ++++++++++++++++ security/integrity/integrity_audit.c | 24 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index 5e58e02ba8dc..9f2924cafa53 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 @@ -197,6 +198,11 @@ 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); + +void integrity_audit_msg_common(struct audit_buffer *ab, struct inode *inode, + const unsigned char *fname, const char *op, + const char *cause, int result); + #else static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, const unsigned char *fname, @@ -204,4 +210,14 @@ static inline void integrity_audit_msg(int audit_msgno, struct inode *inode, int result, int info) { } + +static inline void integrity_audit_msg_common(struct audit_buffer *ab, + struct inode *inode, + const unsigned char *fname, + const char *op, + const char *cause, + int result) +{ +} + #endif diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c index 8d25d3c4dcca..8f80b7c042a7 100644 --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c @@ -28,17 +28,12 @@ static int __init integrity_audit_setup(char *str) } __setup("integrity_audit=", integrity_audit_setup); -void integrity_audit_msg(int audit_msgno, struct inode *inode, - const unsigned char *fname, const char *op, - const char *cause, int result, int audit_info) +void integrity_audit_msg_common(struct audit_buffer *ab, struct inode *inode, + const unsigned char *fname, const char *op, + const char *cause, int result) { - struct audit_buffer *ab; char name[TASK_COMM_LEN]; - if (!integrity_audit_info && audit_info == 1) /* Skip info messages */ - return; - - ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", task_pid_nr(current), from_kuid(&init_user_ns, current_cred()->uid), @@ -59,5 +54,18 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode, audit_log_d_path_exe(ab, current->mm); audit_log_tty(ab, current); audit_log_format(ab, " res=%d", !result); +} + +void integrity_audit_msg(int audit_msgno, struct inode *inode, + const unsigned char *fname, const char *op, + const char *cause, int result, int audit_info) +{ + struct audit_buffer *ab; + + if (!integrity_audit_info && audit_info == 1) /* Skip info messages */ + return; + + ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno); + integrity_audit_msg_common(ab, inode, fname, op, cause, result); audit_log_end(ab); } -- 2.13.6