Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp970138imm; Tue, 5 Jun 2018 07:17:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQI3hd5bgdFkfv/jQnFgCh0Vhgl7HEHwLKuTlIeuZOOP9InvmykaPdji/2YJM/ndWvDa5K X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr12994271pla.80.1528208226540; Tue, 05 Jun 2018 07:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528208226; cv=none; d=google.com; s=arc-20160816; b=jUZQG8w9niRh0AidiJdigbE1/tRYY9HWsYEo1nNZv9++5ynjE+W/7G3N7zNYnUu5t8 DUljzH9SPAS79w2m/5VKdnoaXj+r6XmTiAvh5TEnqCmT1+S09CAl/85vepVbY/M2nCK0 ZqGfUOsaO2dn1JB1XvyrNtUjxd1fZWci4GTjgA3t+gsseelQ4twZuRFiBKS4nadHKrU3 izRs9UEpsbNb1MvfDpCtntldJUloseUbFVI1hq+3TISOi3qnCNFmnHmN92cd5sCX0UV7 R/J3mvnPBmgiJZkncRpKVX3qZn8LBicd899+y5+IQwzAEMah3E64UjCqL+lrlXTOI8l2 QjCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject :arc-authentication-results; bh=OOkyxBBZ5fSNDeq7eZjWBvxt3ebfz1xHeSbhRHwfTuA=; b=gHafD1FOwil+tLJ+oDt5Sx6qLaA/f/iqUUxq9wDM4cSP3aM/L37km1azMHiVS8v3su HKC8EsxDxfz0SvFIwlRelzJ0HwYhRKPxlJyzvGu6WlLiAm3U0xKD0mRsj8Xn78wOgg2y MDfN4VEYnJ6hA6VF9MwiSGJMV0vZNAKMK2R5e6fwihUc/FLG4G9ZnwfJunmDQgfIMlPU SK1Zsun/6gNtTUk8EOQpF6LtLKfPTsGuyj/rdsAhJNvixXSHwzxUXs/FEUElmeT+R0fr 18ranFGFTZ0FUCej6VMScJLvkeLydH+NU2Hu1Go0JHsp26WYCRVPEPRIwQNQNzTBq2mH Iiiw== 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 d6-v6si2376931pgn.493.2018.06.05.07.16.52; Tue, 05 Jun 2018 07:17: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 S1752199AbeFEOP0 (ORCPT + 99 others); Tue, 5 Jun 2018 10:15:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:2069 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751695AbeFEOPY (ORCPT ); Tue, 5 Jun 2018 10:15:24 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w55EE9pg062076 for ; Tue, 5 Jun 2018 10:15:24 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2jdu5vugeq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Jun 2018 10:15:23 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Jun 2018 15:15:19 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 5 Jun 2018 15:15:17 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w55EFGRs25231518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Jun 2018 14:15:16 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DEABA4055; Tue, 5 Jun 2018 15:06:19 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA0F7A406D; Tue, 5 Jun 2018 15:06:18 +0100 (BST) Received: from localhost.localdomain (unknown [9.80.107.39]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Jun 2018 15:06:18 +0100 (BST) Subject: Re: [PATCH v3 4/4] ima: Differentiate auditing policy rules from "audit" actions From: Mimi Zohar To: Paul Moore , Stefan Berger Cc: linux-integrity@vger.kernel.org, linux-audit@redhat.com, sgrubb@redhat.com, linux-kernel@vger.kernel.org Date: Tue, 05 Jun 2018 10:15:05 -0400 In-Reply-To: References: <20180604205455.2325754-1-stefanb@linux.vnet.ibm.com> <20180604205455.2325754-5-stefanb@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18060514-0028-0000-0000-000002CD6249 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060514-0029-0000-0000-0000238467B7 Message-Id: <1528208105.3237.155.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-05_05:,, 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-1806050164 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Mon, 2018-06-04 at 20:21 -0400, Paul Moore wrote: > On Mon, Jun 4, 2018 at 4:54 PM, Stefan Berger > wrote: > > The AUDIT_INTEGRITY_RULE is used for auditing IMA policy rules and > > the IMA "audit" policy action. This patch defines > > AUDIT_INTEGRITY_POLICY_RULE to reflect the IMA policy rules. > > > > Since we defined a new message type we can now also pass the > > audit_context and get an associated SYSCALL record. This now produces > > the following records when parsing IMA policy's rules: > > Aaand now I see you included the current->audit_context pointer I > mentioned in my comments for 3/4 ;) > > So basically this should be fine, although I should point out that you > do not need to define a new message type to associate records > together. The fact that we don't associate all connected records is > basically a bug. > > Anyway, patches 3/4 and 4/4 look good to me. Considering this is > likely going in during the *next* merge window, I would ask that you > convert from "current->audit_context" to "audit_context()" as soon as > this merge window closes. > > Thanks! Thanks, Paul.  I'd like to start queueing patches for the next open window now, instead of scrambling later.  Can I add your Ack now, and remember to make this change when rebasing? Mimi > > > type=UNKNOWN[1807] msg=audit(1527888965.738:320): action=audit \ > > func=MMAP_CHECK mask=MAY_EXEC res=1 > > type=UNKNOWN[1807] msg=audit(1527888965.738:320): action=audit \ > > func=FILE_CHECK mask=MAY_READ res=1 > > type=SYSCALL msg=audit(1527888965.738:320): arch=c000003e syscall=1 \ > > success=yes exit=17 a0=1 a1=55bcfcca9030 a2=11 a3=7fcc1b55fb38 \ > > items=0 ppid=1567 pid=1601 auid=0 uid=0 gid=0 euid=0 suid=0 \ > > fsuid=0 egid=0 sgid=0 fsgid=0 tty=tty2 ses=2 comm="echo" \ > > exe="/usr/bin/echo" \ > > subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null) > > > > Signed-off-by: Stefan Berger > > --- > > include/uapi/linux/audit.h | 1 + > > security/integrity/ima/ima_policy.c | 4 ++-- > > 2 files changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h > > index 65d9293f1fb8..cb358551376b 100644 > > --- a/include/uapi/linux/audit.h > > +++ b/include/uapi/linux/audit.h > > @@ -148,6 +148,7 @@ > > #define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */ > > #define AUDIT_INTEGRITY_RULE 1805 /* policy rule */ > > #define AUDIT_INTEGRITY_EVM_XATTR 1806 /* New EVM-covered xattr */ > > +#define AUDIT_INTEGRITY_POLICY_RULE 1807 /* IMA policy rules */ > > > > #define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */ > > > > diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c > > index bc99713dfe57..f7230db217a7 100644 > > --- a/security/integrity/ima/ima_policy.c > > +++ b/security/integrity/ima/ima_policy.c > > @@ -652,8 +652,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) > > bool uid_token; > > int result = 0; > > > > - ab = integrity_audit_log_start(NULL, GFP_KERNEL, > > - AUDIT_INTEGRITY_RULE); > > + ab = integrity_audit_log_start(current->audit_context, GFP_KERNEL, > > + AUDIT_INTEGRITY_POLICY_RULE); > > > > entry->uid = INVALID_UID; > > entry->fowner = INVALID_UID; > > -- > > 2.13.6 > > >