Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3823469imm; Tue, 29 May 2018 14:34:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLxEa3H8MM3bwNCGdn/b6xlsEh+0Ro/ySo+al7Y36OUFkhVYQUZppQrKjFOpt6z3cTwoUic X-Received: by 2002:a62:b204:: with SMTP id x4-v6mr102455pfe.21.1527629651441; Tue, 29 May 2018 14:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527629651; cv=none; d=google.com; s=arc-20160816; b=G7kmfgCcJHPomB9etLmvNpFzcL1DpyygELqkf4AQjctoYzxHX9cl4PeKuqScnt2NJZ 3EGln7YETkrWNjnr2stnCVgqF7vdaBRAzACB1X8a5Msgk/2pAaTHr6xFExcrcnmtD5vD SE0a5ogSYuHvbrlo9OlM7iTvTwTCJ31r0yjm9IRQ54aDPi9qFDrk0I5keqBqNriiXohi 0oSRz98V4dRdPmTDrngTv9KBZdJn8Ene+6WbBTS5uR6JrT/XoKsD6gakzDa84exDKHeK XWctx91eFkS4l+lTjbegtGyr4cDCo7nTMSiHjHd4Ig+UmdU+5awwGQTXiqqfgI+gQ9tW wC0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:arc-authentication-results; bh=4WGGl1a/xV1vcIIRLe8xXFtvOmwOCUegL+2nIobpCs0=; b=Yvo+ztYI6umz6dLxkue3D6tWiZJm0JxGF1N08kvKwio1nYnNfVWDNta5PwHgcZTmPP clULAn2H3/N2AKMAfJaN5aPWV5oUwW9ZswcHea+wTcxTx8PLqUFdi0GjlvCR20V3Oot+ oXr/GoBzbJ2hm9MiGtNss3Vg7sw/P3iqR2Tw6JAsFpXYGgNP4+WyICh4SAJTJHbyGSJo AWXBWHxljkUkcr7GKD3aO1x+QO4fg7Jv2HMJCb29Zzkq1OPLMgkZw/770pUlz6bRcfeY LxNPd0qwb833ycyPg5gj5uNHjJTxZcGuKpJXPgiB/hie1qmEgRs2LfIXEm3ijFD59/T1 BUSg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b35-v6si33423340plh.36.2018.05.29.14.33.57; Tue, 29 May 2018 14:34:11 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967183AbeE2Vca (ORCPT + 99 others); Tue, 29 May 2018 17:32:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37030 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966946AbeE2Vc0 (ORCPT ); Tue, 29 May 2018 17:32:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 444BC4023141; Tue, 29 May 2018 21:32:26 +0000 (UTC) Received: from x2.localnet (ovpn-121-112.rdu2.redhat.com [10.10.121.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5C9942225; Tue, 29 May 2018 21:32:23 +0000 (UTC) From: Steve Grubb To: Stefan Berger Cc: zohar@linux.vnet.ibm.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-audit@redhat.com Subject: Re: [PATCH 6/8] integrity: Factor out common part of integrity_audit_msg() Date: Tue, 29 May 2018 17:32:22 -0400 Message-ID: <2600105.j2Wzuo56oP@x2> Organization: Red Hat In-Reply-To: <20180524201105.3179904-7-stefanb@linux.vnet.ibm.com> References: <20180524201105.3179904-1-stefanb@linux.vnet.ibm.com> <20180524201105.3179904-7-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 29 May 2018 21:32:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 29 May 2018 21:32:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sgrubb@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, May 24, 2018 4:11:03 PM EDT Stefan Berger wrote: > Factor out a common part of integrity_audit_msg() that others > can also call. After all of these changes, do you mind sending an example event for testing/ review? Thanks, -Steve > 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); > }