Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp518259imm; Thu, 26 Jul 2018 07:34:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdcCg8sIqrIfeYa/5nIyA/VKzDYcW1VqNmjH4uQYKgKXbUiMi2yx+skDKWb+KYjsA6dFRWr X-Received: by 2002:a17:902:28aa:: with SMTP id f39-v6mr2246176plb.150.1532615673762; Thu, 26 Jul 2018 07:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532615673; cv=none; d=google.com; s=arc-20160816; b=0ItVf9Szesa9TSYFz5g32wPHMTLzns+0ICJd/h1YR82HWRs2eUBBeszzJdsH8mLUaU QV7sadvHycs/KZin5E0/ueQwV1/mWoXenvt79aM9OiTNVCoLQJTJVzdzofc0I97EoZ4/ 2eXH8ULJF5PZ9BWMUAd/mGrEE2+Pkp4VSZLHW3uQgyxyCuiWy1dDOytl9U6qvCrf/NrW PxROC6dKl6KbleSLJQyRdUTpFXfsitOId+wlH5Pyng+xGShwFqS1gDI2g0GmBd1NKuhr xPhUDfc2qUDg/QM3J7xjT9MLnaEG24MjoZ5Y+3ixclj3NQXH3TvYZJ6JEk7Mu+GVmRn8 1qUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=bzsXVBtt2hhfEY/067Ol4KZTOdgOku+o/Dnzgd6x/xA=; b=RObK7SXH6i+JxZteFZ5JA/JbcRg0jFgxhQ94zfkrkkA0ohMGJl+tVIYprx80RE0Ywo P75ZEsGqmXJLAI8RilTso0IL08D5yRVZe3xZ5onFI5Dbxgq6ul9dRbG3HXtSwT5bwYek myOqpZKHyn4QRIpWx59Dm6z1VVEjaimb8SwLYZcz62GN3PcTG2j3frK4CDYFYyiu/cUb hY+OvuFWeJQUZiin33lqohw/BEwwZB9w+5OtilKwRM68+1wVrAUL0sLV8m4z2rZ6wkRY Jc7ODOfl5742ufdqsCf07/P8XznCG+vGxDuIXEJ1tzFohLQLzrXCHxBBy9Aj9dT+N8BF shgg== 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 s24-v6si1368706plq.358.2018.07.26.07.34.18; Thu, 26 Jul 2018 07:34:33 -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 S1730640AbeGZPu0 (ORCPT + 99 others); Thu, 26 Jul 2018 11:50:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729892AbeGZPuZ (ORCPT ); Thu, 26 Jul 2018 11:50:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31CE640216E3; Thu, 26 Jul 2018 14:33:17 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-17.rdu2.redhat.com [10.10.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC8252166BA3; Thu, 26 Jul 2018 14:33:13 +0000 (UTC) Date: Thu, 26 Jul 2018 10:30:16 -0400 From: Richard Guy Briggs To: Paul Moore Cc: cgroups@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, linux-audit@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, ebiederm@xmission.com, luto@kernel.org, jlayton@redhat.com, carlos@redhat.com, dhowells@redhat.com, viro@zeniv.linux.org.uk, simo@redhat.com, Eric Paris , serge@hallyn.com Subject: Re: [RFC PATCH ghak90 (was ghak32) V3 04/10] audit: add support for non-syscall auxiliary records Message-ID: <20180726143016.uup5mnzi76uzlsqr@madcap2.tricolour.ca> References: <20180724193725.k27la4ubg2g2n4qm@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 26 Jul 2018 14:33:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 26 Jul 2018 14:33:17 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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 On 2018-07-24 17:57, Paul Moore wrote: > On Tue, Jul 24, 2018 at 3:40 PM Richard Guy Briggs wrote: > > On 2018-07-20 18:14, Paul Moore wrote: > > > On Wed, Jun 6, 2018 at 1:01 PM Richard Guy Briggs wrote: > > > > Standalone audit records have the timestamp and serial number generated > > > > on the fly and as such are unique, making them standalone. This new > > > > function audit_alloc_local() generates a local audit context that will > > > > be used only for a standalone record and its auxiliary record(s). The > > > > context is discarded immediately after the local associated records are > > > > produced. > > > > > > > > Signed-off-by: Richard Guy Briggs > > > > --- > > > > include/linux/audit.h | 8 ++++++++ > > > > kernel/auditsc.c | 25 +++++++++++++++++++++++-- > > > > 2 files changed, 31 insertions(+), 2 deletions(-) > > ... > > > > > + struct audit_context *context; > > > > + > > > > + if (!audit_ever_enabled) > > > > + return NULL; /* Return if not auditing. */ > > > > + > > > > + context = audit_alloc_context(AUDIT_RECORD_CONTEXT); > > > > + if (!context) > > > > + return NULL; > > > > + context->serial = audit_serial(); > > > > + context->ctime = current_kernel_time64(); > > > > + context->in_syscall = 1; > > > > > > Setting in_syscall is both interesting and a bit troubling, if for no > > > other reason than I expect most (all?) callers to be in an interrupt > > > context when audit_alloc_local() is called. Setting in_syscall would > > > appear to be conceptually in this case. Can you help explain why this > > > is the right thing to do, or necessary to ensure things are handled > > > correctly? > > > > I'll admit this is cheating a bit, but seemed harmless. It is needed so > > that auditsc_get_stamp() from audit_get_stamp() from audit_log_start() > > doesn't bail on me without giving me its already assigned time and > > serial values rather than generating a new one. I did look to see if > > there were any other undesireable side effects and found none, so I'm > > tmepted to rename the ->in_syscall to something a bit more helpful. I > > could add a new audit_context structure member to make > > auditsc_get_stamp() co-operative, but this seems wasteful and > > unnecessary. > > That's what I suspected. > > Let's look into renaming the "in_syscall" field, it borderline > confusing now, and hijacking it for something which is very obviously > not "in syscall" is A Very Bad Thing. Ok, looking more carefully, I'm not going to touch in_syscall, since it does more than I remember discovering when investigating why the existing stamp wasn't being used. I don't want to change the existing behaviour. I'll somewhat reluctantly grow the context struct and add a "local" boolean to it so that auditsc_get_stamp knows to use the existing stamp in both the in_syscall and local cases. > paul moore - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635