Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3138668pxb; Tue, 12 Jan 2021 07:15:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwix1qVGMtJKH2W8Q/0DNO6N0pqxm3G0WEs8F6PiLgASbLyqn1m1q7Mq66nVPsTk5LaK6S X-Received: by 2002:a50:9f4a:: with SMTP id b68mr3766891edf.296.1610464529612; Tue, 12 Jan 2021 07:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610464529; cv=none; d=google.com; s=arc-20160816; b=u/MLETq4idLlwBb1vDrSKTUv2p9ZSQZaThHpPNSKDZ6jpgan+67mRr45hlMGBZhb1L E9rCHDmLzqaQ0rqef1c5OU54FVpAt8Suxzx1a/Ruo5sbLuGHZiC1O/ijs7Lq0bjMfOZG sc5P9vdidsdrlJ59zux092Zed/erBvUvtNCrz0/ytGsJkRacod8TNVxtrbcL/Zrcgu3Y k2yEE0opJwYw0woCqxX4A/XvBeHe9z107JsbLwmMrKYQRxekASbcc5rJvfs01WYGN6dA BJ5Ui3HZQOclWuEGK6+R8/Hji9p63EtdGPgs7qh3UClK7qtzphHoItFI4iOT9M1oBLB/ 62gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=CEcMeW3r8WIQ8e8BupQyhzcepDHWsTIT5isBpREM2VE=; b=d/tRj950RcsFDVRfz3jB8V9DUfW0OrVKIj4e80ZRRjFASY6jqo17jdphDT9WrSvcIg ipA+quQzuCsgxCTvFb+JdN5tdQRK34jrBFOyy76syaPCBMIMlG6ZygCVghci/t7+YmCO RZV02krRC23BKtG/yubVMjiKpQU/SAtAUwVDYVn53C8vhzeOeqloRPigg8usuW3lPS4Y XquftEn9hKd/3zuW2xcf4yZVnD6BPRg7s+fWKGbjRzeCKgjnRR3EVQ1DcWMAJMyUsXJS QoxMjHOCd+hy/ms9+cWXwkmKZq37B7HJvWgjIUcvfgMnA+CDSgDQn75Wq5SbYaNn2sLD 6VXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cnYd5AD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si1472688eds.172.2021.01.12.07.15.05; Tue, 12 Jan 2021 07:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cnYd5AD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404251AbhALPND (ORCPT + 99 others); Tue, 12 Jan 2021 10:13:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29597 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404209AbhALPNB (ORCPT ); Tue, 12 Jan 2021 10:13:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610464295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=CEcMeW3r8WIQ8e8BupQyhzcepDHWsTIT5isBpREM2VE=; b=cnYd5AD5xcg3cquQS7CfnRsQZfA/5Smroo+7CDuusVr1SEj7CoDqD79tbPQ+R8Su7XlXUk fVCMg2hC8d7QByzvOHKEGDbdtM0JAdFqE8Oz//i7LZBluJKSQ4vrmZO5/vJCkQeZB897oh G/4ac5yc7Ab86cc9xYr46I/gpnPSZtQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-mqIA9YfLNGisrvaAxwTllQ-1; Tue, 12 Jan 2021 10:11:32 -0500 X-MC-Unique: mqIA9YfLNGisrvaAxwTllQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 752B7100C600; Tue, 12 Jan 2021 15:11:29 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id F36BB5D9CD; Tue, 12 Jan 2021 15:11:15 +0000 (UTC) From: Richard Guy Briggs To: Linux Containers List , Linux API , Linux-Audit Mailing List , Linux FSdevel , LKML , Linux NetDev Upstream Mailing List , Netfilter Devel List Cc: Neil Horman , David Howells , "Eric W. Biederman" , Simo Sorce , Eric Paris , mpatel@redhat.com, Serge Hallyn , Kees Cook , Jens Axboe , Christian Brauner , Richard Guy Briggs Subject: [PATCH ghak90 v11 06/11] audit: add containerid support for user records Date: Tue, 12 Jan 2021 10:09:34 -0500 Message-Id: <4a50ebc6f10c2365a04f271160d62b869a02a816.1610399347.git.rgb@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 314af418bf67..946fe5862dc7 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1339,12 +1339,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); @@ -1620,6 +1614,7 @@ 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 */ char *str = data; + struct audit_context *context; err = 0; if (msg_type == AUDIT_USER_TTY) { @@ -1627,7 +1622,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 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) { /* ensure NULL termination */ str[data_len - 1] = '\0'; @@ -1641,6 +1637,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) audit_log_n_untrustedstring(ab, str, data_len); } audit_log_end(ab); + audit_log_container_id_ctx(context); + audit_free_context(context); } break; case AUDIT_ADD_RULE: -- 2.18.4