Received: by 10.223.185.116 with SMTP id b49csp1826212wrg; Sun, 11 Feb 2018 22:29:57 -0800 (PST) X-Google-Smtp-Source: AH8x227cn2dAC6siY/JoMzlLU0YkrWP6X3F7qHtTzWIPImJnjFM1+OgRBpnrd3i0lObL4R4YLIld X-Received: by 2002:a17:902:6b83:: with SMTP id p3-v6mr9795755plk.18.1518416996940; Sun, 11 Feb 2018 22:29:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518416996; cv=none; d=google.com; s=arc-20160816; b=ug7hNd9XsEyL4SaXaJfzrWg2RQBpBsj1ECrePN+H+B7WAti0GZJJHk6QdcwFsmC716 ypSZulWJ24QIVjpJzbGDXXar4aVaiyZg3OsbmCtZDL61FaP2h9VEQ/vCekfCGcb6Ah0D tp71w+bFGruTMkulA1n0QjZbZw4ZUhdPNfbOBjv8F6jx8iutC5jYx8GUfao3SyLZCIRg ropnUrfYkH+URXOscOzeJzmWQBjBKGbXXz1+z1zw2c3LXJOe0y8aiMwZ521AUqJ2COyo x7wUR13TymeVv3DvODRiocTX6doqK8OguNUUnRAUxchErf9YG47xTimffIavV6NCxXEO JjfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ai2uPouXm2J/3d0vHathh2zYWURboerP/ox5LaeWje4=; b=a4HRwPZivFL3+lyUtV3xkB4Kjw9x8wta3fam47ck+NxKogaevWslJ77sHfM8wWC818 OhS9CbBCdoBEV0l/unGiDsQCs5NcNhi20/AhOEZgdrkcqYK1XQya4Wsp9y6JBYZh3uKQ PmfwTwdCO2EaGLI+xi71Gb6sQH2EJaSUdVHnuORWmKjKgQQoMzhrB6h0U6IJdc3DQL1B N8cURqnhVRno2Axz1ofh1jvZpCNe6jgENlVHj4dTCVL5h17EdJW/TI4DqACQ9kpaHN3a iGMGK1yRauvh5Y5rbEDY906NXKkiud9negiLmkIermS3++qxe7naWhnWjYljM9ZDoc7M uvmw== 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 i124si2310342pgc.589.2018.02.11.22.29.42; Sun, 11 Feb 2018 22:29:56 -0800 (PST) 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 S1751173AbeBLFGp (ORCPT + 99 others); Mon, 12 Feb 2018 00:06:45 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41556 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751111AbeBLFGm (ORCPT ); Mon, 12 Feb 2018 00:06:42 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A8C540FB635; Mon, 12 Feb 2018 05:06:42 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-12.rdu2.redhat.com [10.10.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85BE32024CA8; Mon, 12 Feb 2018 05:06:40 +0000 (UTC) From: Richard Guy Briggs To: Linux-Audit Mailing List , LKML Cc: Paul Moore , Eric Paris , Steve Grubb , Richard Guy Briggs Subject: [PATCH ghak8 ALT4 V4 3/3] audit: add new filetypes CREATE_ANON and PARENT_ANON Date: Mon, 12 Feb 2018 00:02:23 -0500 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Feb 2018 05:06:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 12 Feb 2018 05:06:42 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'rgb@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use new filetypes PARENT_ANON and CREATE_ANON to indicate the pathname supplied is incomplete and relative to the anonymous parent mountpoint of type filesystem noted in the fstype field. Sample output: type=PATH msg=audit(1514350593.987:136): item=808 name="events/nfs4/nfs4_setclientid" inode=16778 dev=00:0b mode=040755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:tracefs_t:s0 nametype=PARENT_ANON cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 fstype=0x74726163 type=PATH msg=audit(1514350593.987:136): item=809 name="events/nfs4/nfs4_setclientid/format" inode=16783 dev=00:0b mode=0100444 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:tracefs_t:s0 nametype=CREATE_ANON cap_fp=0000000000000000 cap_fi=0000000000000000 cap_fe=0 cap_fver=0 fstype=0x74726163 See: https://github.com/linux-audit/audit-kernel/issues/8 Test case: https://github.com/linux-audit/audit-testsuite/issues/42 Signed-off-by: Richard Guy Briggs --- include/linux/audit.h | 2 ++ kernel/audit.c | 6 ++++++ kernel/auditsc.c | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/audit.h b/include/linux/audit.h index 2020f1d..828e451 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h @@ -105,6 +105,8 @@ struct audit_field { #define AUDIT_TYPE_PARENT 2 /* a parent audit record */ #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ +#define AUDIT_TYPE_PARENT_ANON 5 /* an anonymous parent audit record */ +#define AUDIT_TYPE_CHILD_ANON 6 /* an anonymous child being created */ /* maximized args number that audit_socketcall can process */ #define AUDITSC_ARGS 6 diff --git a/kernel/audit.c b/kernel/audit.c index 1c9d0a4..64f0025 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -2170,6 +2170,12 @@ void audit_log_name(struct audit_context *context, struct audit_names *n, case AUDIT_TYPE_CHILD_CREATE: audit_log_format(ab, "CREATE"); break; + case AUDIT_TYPE_CHILD_ANON: + audit_log_format(ab, "CREATE_ANON"); + break; + case AUDIT_TYPE_PARENT_ANON: + audit_log_format(ab, "PARENT_ANON"); + break; default: audit_log_format(ab, "UNKNOWN"); break; diff --git a/kernel/auditsc.c b/kernel/auditsc.c index b73ede0..903595ec 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1940,7 +1940,7 @@ void __audit_inode_child(struct inode *parent, if (!found_parent) { /* create a new, "anonymous" parent record */ - n = audit_alloc_name(context, AUDIT_TYPE_PARENT); + n = audit_alloc_name(context, AUDIT_TYPE_PARENT_ANON); if (!n) return; audit_copy_inode(n, NULL, parent); @@ -1966,8 +1966,10 @@ void __audit_inode_child(struct inode *parent, audit_copy_inode(found_child, dentry, inode); else found_child->ino = AUDIT_INO_UNSET; - if (!found_parent) + if (!found_parent) { found_child->dentry = dget(dentry); + found_child->type = AUDIT_TYPE_CHILD_ANON; + } } EXPORT_SYMBOL_GPL(__audit_inode_child); -- 1.8.3.1