Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp491594ybe; Wed, 18 Sep 2019 21:58:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEgp5Xup+vJawSl4B55jKx3B5+gO09o5ugoqaur4OyDR70dAyf5voTDNWTTl66SJ0rfzZB X-Received: by 2002:aa7:cf11:: with SMTP id a17mr14088250edy.153.1568869135962; Wed, 18 Sep 2019 21:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568869135; cv=none; d=google.com; s=arc-20160816; b=uwkxPnql6vJMcYREhNLMurxGKIDDnpYhC+1dwmb6/ZWifw5ydBYnjgjUhC7lKtwgi9 NZcPN61lL/ieU8rUWKyRVtCXaGhq6+jlcd4uV6ET6g6eVVpOADII8+R0m1skPdQUR5qj q62kN02KoLnBQlx88sD8tzgvAuLrgNLtBzmb0zPv2aHSb8wqT0CFZ+4RmXr9Sj/G03QU bEA30BL6MXCK9fXiQ+h7w9Ph9inu1J3n9XXk6dl37aY7VggUkc5k8t9QfUuK39ySl1Mm RXkRJycz7wXk66nlZO92TNvXWMuTiaejnZAORh/yJ2S0XTlvEMIQmPjKqe016In1j2cH +agg== 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=B9c6azF3ph+eWlkBQyUmsF8cNk7EJ542101AWbwLXLk=; b=YhOIvf0N8j1CVJlQZZ4Cv93leY5fvKQiXURqr1tlhtEWvOZHm5WXntub4z+EuSVonz lHYYy/sURMDY4/qsx6y54WO+Yt3nKukwSzeT0BX7mjnD9PFf6qkXcHyqDfFUaMhci/Ow xuGIxkcM63pk4tegWNIGw0AFjuHzzxi8+P2kVhvFpA3uGSt/BlMweVXS3zIoentarBLn avI2C/mS0KB9+9b4OI6TGzc2pvbf9OsbVIenFgwSe+7WJ+DHv78b4EhMTWukC35Slg6T hlyLeEa/ORVkz28iptVrPEeHeYq6rbp/3vBQM/DbgbnOOEMoeqMiW4K9as61+VkqU6oL Lw1g== 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 f31si5174395ede.253.2019.09.18.21.58.32; Wed, 18 Sep 2019 21:58:55 -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 S1731974AbfISBZ6 (ORCPT + 99 others); Wed, 18 Sep 2019 21:25:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53330 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbfISBZ5 (ORCPT ); Wed, 18 Sep 2019 21:25:57 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AFF47FDCD; Thu, 19 Sep 2019 01:25:52 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-19.phx2.redhat.com [10.3.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF49160F88; Thu, 19 Sep 2019 01:25:31 +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, dwalsh@redhat.com, mpatel@redhat.com, Richard Guy Briggs Subject: [PATCH ghak90 V7 10/21] audit: add containerid support for user records Date: Wed, 18 Sep 2019 21:22:27 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 19 Sep 2019 01:25: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 df3db29f5a8a..7cdb76b38966 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1140,12 +1140,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); @@ -1408,13 +1402,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, @@ -1430,6 +1427,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_container_id(context, audit_get_contid(current)); + audit_free_context(context); } break; case AUDIT_ADD_RULE: -- 1.8.3.1