Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp826515ybi; Thu, 30 May 2019 07:21:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfv07fyR7hB/AV9qcuKqCplzcH86Ye1Ikn89Ts4KtxECWIC52iE2ydvyN3Gm7Tv5niCnGP X-Received: by 2002:a17:902:7c08:: with SMTP id x8mr3918971pll.159.1559226093892; Thu, 30 May 2019 07:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559226093; cv=none; d=google.com; s=arc-20160816; b=GShR15TksXsIPajL5cRHFhDGKMWQF/HfiIzLhvtdNj1p209ZsXD0k60V2nGwhfKL86 tdprBHj8qKgvWskbvhSRYtZiymI8qF8siHlbNnPkZzwxAizJgYh7JEvxx+2mmGowdpam MNDOx55dX4hzxYUFa0L3zrVeXGVZbIKwBE+b1HXcDlTaYk9p7Q4jf/sGqBflZBJPHU3b jtSDdiiu8o2xd5Kl4LpDC3zK3El1Oc3/mK0f5oG+Vl/G1+A97mx9d9HNMxMgTOJOwBxk /o5/4rpoK/Y8OJLrySdjBP0gbUxxjPTQgeicoU8krYyZnmWojbJmt4PTBFeviDQjqGJd laUg== 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; bh=1uiyc4MjURRLyNHEN4XhqMm4GCIOUOOfXQZHGfYnOR4=; b=dYKVfyHcJ2vxILehucCz3BDqoneorF9Htc70WJOHrSCuREZnXSM26B9ov2GPGS6oZD JXuXwnObQwCVwp1CRHA3ipO4bUoGnm3Uf1ltaWhG8FlqOeG5i+oY5Kac86AaYydlUDS/ HcV38ABsYtST5nntz1QpgJSdYGFdzQVoWH1ZWFDUxWrd/uVX9GlUZkAZnhYhGhSNPdxx f/rq0RuHseMfbeTpbaSNadMvUpfjJl124RyDazKuxG4GFVYIpI0WZpvkmu9T2UVWupjc x0rNkaZGhFZDieMV2OQ/VnpV/Y/w49W/lRFamuLq74MuiKQF8BN31ntA2D74CDpcl/Aj kjXQ== 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 a17si3646246pfa.108.2019.05.30.07.21.17; Thu, 30 May 2019 07:21: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 S1726960AbfE3OUG (ORCPT + 99 others); Thu, 30 May 2019 10:20:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50310 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727323AbfE3OUF (ORCPT ); Thu, 30 May 2019 10:20:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 66F33308FC47; Thu, 30 May 2019 14:20:05 +0000 (UTC) Received: from madcap2.tricolour.ca (ovpn-112-16.phx2.redhat.com [10.3.112.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB1AF7941C; Thu, 30 May 2019 14:19:54 +0000 (UTC) Date: Thu, 30 May 2019 10:19:51 -0400 From: Richard Guy Briggs To: Paul Moore Cc: 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, sgrubb@redhat.com, omosnace@redhat.com, dhowells@redhat.com, simo@redhat.com, Eric Paris , Serge Hallyn , ebiederm@xmission.com, nhorman@tuxdriver.com Subject: Re: [PATCH ghak90 V6 08/10] audit: add containerid filtering Message-ID: <20190530141951.iofimovrndap4npq@madcap2.tricolour.ca> References: <0785ee2644804f3ec6af1243cc0dcf89709c1fd4.1554732921.git.rgb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 30 May 2019 14:20:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-05-29 18:16, Paul Moore wrote: > On Mon, Apr 8, 2019 at 11:41 PM Richard Guy Briggs wrote: > > > > Implement audit container identifier filtering using the AUDIT_CONTID > > field name to send an 8-character string representing a u64 since the > > value field is only u32. > > > > Sending it as two u32 was considered, but gathering and comparing two > > fields was more complex. > > > > The feature indicator is AUDIT_FEATURE_BITMAP_CONTAINERID. > > > > Please see the github audit kernel issue for the contid filter feature: > > https://github.com/linux-audit/audit-kernel/issues/91 > > Please see the github audit userspace issue for filter additions: > > https://github.com/linux-audit/audit-userspace/issues/40 > > Please see the github audit testsuiite issue for the test case: > > https://github.com/linux-audit/audit-testsuite/issues/64 > > Please see the github audit wiki for the feature overview: > > https://github.com/linux-audit/audit-kernel/wiki/RFE-Audit-Container-ID > > Signed-off-by: Richard Guy Briggs > > Acked-by: Serge Hallyn > > Acked-by: Neil Horman > > Reviewed-by: Ondrej Mosnacek > > --- > > include/linux/audit.h | 1 + > > include/uapi/linux/audit.h | 5 ++++- > > kernel/audit.h | 1 + > > kernel/auditfilter.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ > > kernel/auditsc.c | 4 ++++ > > 5 files changed, 57 insertions(+), 1 deletion(-) > > ... > > > diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c > > index 63f8b3f26fab..407b5bb3b4c6 100644 > > --- a/kernel/auditfilter.c > > +++ b/kernel/auditfilter.c > > @@ -1206,6 +1224,31 @@ int audit_comparator(u32 left, u32 op, u32 right) > > } > > } > > > > +int audit_comparator64(u64 left, u32 op, u64 right) > > +{ > > + switch (op) { > > + case Audit_equal: > > + return (left == right); > > + case Audit_not_equal: > > + return (left != right); > > + case Audit_lt: > > + return (left < right); > > + case Audit_le: > > + return (left <= right); > > + case Audit_gt: > > + return (left > right); > > + case Audit_ge: > > + return (left >= right); > > + case Audit_bitmask: > > + return (left & right); > > + case Audit_bittest: > > + return ((left & right) == right); > > + default: > > + BUG(); > > A little birdy mentioned the BUG() here as a potential issue and while > I had ignored it in earlier patches because this is likely a > cut-n-paste from another audit comparator function, I took a closer > look this time. It appears as though we will never have an invalid op > value as audit_data_to_entry()/audit_to_op() ensure that the op value > is a a known good value. Removing the BUG() from all the audit > comparators is a separate issue, but I think it would be good to > remove it from this newly added comparator; keeping it so that we > return "0" in the default case seems reasoanble. Fair enough. That BUG(); can be removed. > > + return 0; > > + } > > +} > > -- > paul moore > www.paul-moore.com - 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