Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4300506pxu; Mon, 21 Dec 2020 09:00:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOjytS4kDHB5hgJo7egmu2b37vSBmqh0RIzBiN0iHAjaSucnmIrF9ZB7yenlA12I+cB9GG X-Received: by 2002:a17:906:6c94:: with SMTP id s20mr16286163ejr.0.1608570052558; Mon, 21 Dec 2020 09:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608570052; cv=none; d=google.com; s=arc-20160816; b=1EWwV/FBxlNm/kze8pvnT4u0YCGFaKY/srewXZNBkefD2qjSQE1qYuB5jcWGW3oGZb U8sVHtecgbwD01OJO4vS3F/toTVGn0aX7JlLJPMumOhdNuB0q1SEuJEsqDK2yMB70gpd +vnH0OMzFoegvNUE/3TkiPpq42YYD/h99IeTn41f1jHjGlD30NGHW8E/MWMcDujVqwZs xCVgJgtlfF/hHUe6rwxIZzLU71DSJu0UAC2SQ1Cx54C80SksRgF658CLN1FVdbdBsWiX mO2c2BEc3rzD6sujUGc4EX8i2kjd8xSPEh7K7N7Oyo5+PZBYodWA2WRdmd2FWZaH7vba Wpzg== 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=Ay5ty1ak2NLe9F0sAaT0hqa6e0ZQhoO5r8/zx14K2kI=; b=bmEITfyQitL30UHePQDI2s5mnGiMM4klwobHpnXRrdVfwVnCF4wwf3w5IuvreqL3Ne VCa/+Q9ak0WucLWbZ8gq+/f+BZjvoK+TKQWjDLdsTi/TH5GTVYof5vWEqaIAqxXNphxw 2aOvdhR16vd2PxT9qAyKoxPWfeMzmtsMcOOzp+Czm+ahPmGxKyMH0Ds3cSS2AvJcpBjm iWF6WI3BZCt4GqftuiFtkqMPcEPTojUEIahJ7FJrfV9uefkRM7v4nkgzEE2zhJGJmWl+ ZgieJO+Zzuq7s9akupYOH1ulJecnj+VfhUJy7LfCjxvQJAyjfUTKl0kYM5b/3FQngMWC 6vpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CYUdggKg; 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 rn21si9496511ejb.130.2020.12.21.09.00.28; Mon, 21 Dec 2020 09:00:52 -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=CYUdggKg; 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 S1726329AbgLUQ7B (ORCPT + 99 others); Mon, 21 Dec 2020 11:59:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:57327 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbgLUQ66 (ORCPT ); Mon, 21 Dec 2020 11:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608569851; 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=Ay5ty1ak2NLe9F0sAaT0hqa6e0ZQhoO5r8/zx14K2kI=; b=CYUdggKgyOBF/3asKCX1zafYMTg1gLGQck8dNfKYNHcpis5gxTlUCGW4CoKfcwAVrU+5n4 v6cfL1hDT1gQ4nfa/QdQZpOFn8j6fJNQSy55T+lC/El4IrnxAV5qpuRHk7FDRBDxSLGtKs whtPmlujGFMDzqyIMWefgXWW1dq4yRg= 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-284-2o3xXVWEO_GQbeI7wEBBEw-1; Mon, 21 Dec 2020 11:57:30 -0500 X-MC-Unique: 2o3xXVWEO_GQbeI7wEBBEw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CBE2107ACE8; Mon, 21 Dec 2020 16:57:28 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C13360C0F; Mon, 21 Dec 2020 16:57:23 +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 v10 06/11] audit: add containerid support for user records Date: Mon, 21 Dec 2020 11:55:40 -0500 Message-Id: <4e13048fc7a35b7d03f2fd97455ddb07d6bc9c10.1608225886.git.rgb@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 1c2045c48baf..b23f004f4000 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1338,12 +1338,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); @@ -1619,6 +1613,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) { @@ -1626,7 +1621,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'; @@ -1640,6 +1636,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