Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3504346yba; Mon, 8 Apr 2019 21:44:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjgt0FueeZYudvQqUNa1hJxw84V2deoGGE3nCPgg0w62hZCReNItvVXOz5EDBlXU2rlXKU X-Received: by 2002:a62:6504:: with SMTP id z4mr34406065pfb.202.1554785075541; Mon, 08 Apr 2019 21:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554785075; cv=none; d=google.com; s=arc-20160816; b=u0o/PZlouxBhuRqEmCzDVaC/Bx9wYpTtD+FhpNW9S/WfD1hrdWZTKF1SIKwbR1lW5S 5XuVu8tWh47a03rcKsVsBNQ9rKIGEzLrNKlqY/jMVg1mpO6ETeyJAvIBoK/D93G7+sfE UnqTWooikkD8VWf8LPh7unE5E3UNXxneZmclmI5wDs2WqphVWRSEDrucKwlC15YfW270 v2JSUBnkIZQ2JOpU0pHx7lDQ8knhPNDUM4X9KrZfl2cW/PCUkLG4MefVYlxRDGYab6UI DkKrQ8seBMfwFd9fmTOFMsFof4lB4YJ7J+/q6qDfTFQ/L3733PfPcLqHHsdsxag4TW62 3feA== 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; bh=h1Amf3ja/Bz5dTJb0f0wW8NsCxmUGPYatgDx+v0YdvM=; b=s1Zms34JJL8qSYcYeXt4yhaktTZKBorqGmo9QByzx0Lrd5oBp3LNHZqfZsdJo1dDy1 w0GxdC6L1x0naUH39FVKbm0FMk6gS0AZh8eqIaA9JlzLUsEwx+DA3h++z2Py1IvfrWIS kIL+I7xjQfR3kBDOf7GRdwTc81dKR+2xV18uRichNEr8nFNzLXL3GsYCv8qBab8Xsa2C wwN+2Afr1UFqtrMSAY7AUvZ1axOeUwykjh9/6zXWseudEarDk7++wKunCcORnLPEkQ0w Stmym+6dCziHlJxYWqwmhatKkmcTTS22r43PzZE4ztPr5h8NRkspCQ/cv3g+mv1urrSa LrlQ== 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 f2si5368026pgc.182.2019.04.08.21.44.08; Mon, 08 Apr 2019 21:44:35 -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 S1728552AbfDIDk6 (ORCPT + 99 others); Mon, 8 Apr 2019 23:40:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40860 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727258AbfDIDk5 (ORCPT ); Mon, 8 Apr 2019 23:40:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 592CA3007C32; Tue, 9 Apr 2019 03:40:57 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-16.phx2.redhat.com [10.3.112.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40CE819C70; Tue, 9 Apr 2019 03:40:52 +0000 (UTC) From: Richard Guy Briggs To: containers@lists.linux-foundation.org, linux-api@vger.kernel.org, Linux-Audit Mailing List , linux-fsdevel@vger.kernel.org, LKML , netdev@vger.kernel.org, netfilter-devel@vger.kernel.org Cc: Paul Moore , sgrubb@redhat.com, omosnace@redhat.com, dhowells@redhat.com, simo@redhat.com, eparis@parisplace.org, serge@hallyn.com, ebiederm@xmission.com, nhorman@tuxdriver.com, Richard Guy Briggs Subject: [PATCH ghak90 V6 07/10] audit: add containerid support for user records Date: Mon, 8 Apr 2019 23:39:14 -0400 Message-Id: <1f814bc706534e70d4c79bb66d3c53d0e606b503.1554732921.git.rgb@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 09 Apr 2019 03:40:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add audit container identifier auxiliary record to user event standalone records. Signed-off-by: Richard Guy Briggs Acked-by: Neil Horman Reviewed-by: Ondrej Mosnacek --- kernel/audit.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 87e1d367f98c..6c742da66b32 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1143,12 +1143,6 @@ static void audit_log_common_recv_msg(struct audit_context *context, audit_log_task_context(*ab); } -static inline void audit_log_user_recv_msg(struct audit_buffer **ab, - u16 msg_type) -{ - audit_log_common_recv_msg(NULL, ab, msg_type); -} - int is_audit_feature_set(int i) { return af.features & AUDIT_FEATURE_TO_MASK(i); @@ -1411,13 +1405,16 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) err = audit_filter(msg_type, AUDIT_FILTER_USER); if (err == 1) { /* match or error */ + struct audit_context *context; + err = 0; if (msg_type == AUDIT_USER_TTY) { err = tty_audit_push(); if (err) break; } - audit_log_user_recv_msg(&ab, msg_type); + context = audit_alloc_local(GFP_KERNEL); + audit_log_common_recv_msg(context, &ab, msg_type); if (msg_type != AUDIT_USER_TTY) audit_log_format(ab, " msg='%.*s'", AUDIT_MESSAGE_TEXT_MAX, @@ -1433,6 +1430,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) audit_log_n_untrustedstring(ab, data, size); } audit_log_end(ab); + audit_log_contid(context, audit_get_contid(current)); + audit_free_context(context); } break; case AUDIT_ADD_RULE: -- 1.8.3.1