Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1226526ybi; Thu, 30 May 2019 13:47:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqysvkP08yXQP0fOjGdj5IVfZVfG/DDQEoAvWBXcKtrv7prCR/KxlW5/Oq3EBHR7GJyvti58 X-Received: by 2002:a05:6a00:cc:: with SMTP id e12mr5724699pfj.207.1559249248377; Thu, 30 May 2019 13:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559249248; cv=none; d=google.com; s=arc-20160816; b=Bg1MUEG8l6Zmgl5HiybiWhJW80q7Biw5GbbK60dZy3F9Ae6lTiGLi1jIlZrZMmgKM+ +Hcj8b86eAh2Gfw9BQcnIC+WypOqF23ycdqkE1qxABeBcdli7UU+Y0ZTd6NmPw38P2Si FvmUU71Egxk5wcsremMMhOzkDOaLl8FEBK3WNzAsM0PVADd8+jivGFPi0iNHaJ+hhBRx 5DfvNDUuOXRH2n7l5MtK/wko12RRiEihKw2ltmpGJ9ozeb51bLPA4OinseELtHZowzbr fS1Miu1W5p/BnpyV6rcOn4hunsy90wsrqx3qM9xRklIqcL2/gkUtjReLq+9uBbAL+faC uThw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EhDqOLrNL+Ls6g+jJlH1kHSTN+6mKWoVpwhK7g7g/0o=; b=qT6RXKJdVTUGOidd7c797SLYDWWB+8UUPONGCvE9IJwbBOxn8RsqPa2heHAJqv/ycP u9+PpNvJ1ixGpDSOGbIb16KC+Z2RUJ1uehK1Wm8JvAbd1GuxbL5/JAAhWNCe4eB4fAAA AjvzZbT0d638yjyDflZpviFRTVutvuwbfwysRwmjaepupwVeso8q6yb3aLYo7bqiPYCk iwgFp6UcW8BCj+NhOVDtfIp3EDICOOmOvA3OVUWlBrUje4Cx5f/+65SXPIBgMb1Jo29n S78Tz1s2Hz2DlfcdLVwAPpNd0LkA7xX+q7tqydAmtHTXFthoDT11O1m3rFApI2HsvRfD cGKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=xlyV3ThJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si3420235pjv.56.2019.05.30.13.47.12; Thu, 30 May 2019 13:47:28 -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; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=xlyV3ThJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbfE3Upp (ORCPT + 99 others); Thu, 30 May 2019 16:45:45 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34348 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbfE3Upn (ORCPT ); Thu, 30 May 2019 16:45:43 -0400 Received: by mail-lf1-f66.google.com with SMTP id v18so6115111lfi.1 for ; Thu, 30 May 2019 13:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EhDqOLrNL+Ls6g+jJlH1kHSTN+6mKWoVpwhK7g7g/0o=; b=xlyV3ThJjdhKcZhreP5PbaxjF4yCg2iuc+K7UzQP6tLJWwrREj0I5yVvPo3B3jh7iK jh1rsg4jyI3plqbkkIs9e7MgP53igOczr5L4MydDQ87MWflfgTeiR7tPUVxTFoKpmcm4 6sepnRi8IUd5YcXQYTYWT9BEkanR1k/eUovXIZ4CYEx4LttHAIlePcabZEyckUcOfwA+ ld4cKn0kM4Vfx29ADhSIicvea8BSndd/KrqWITOd8GFDTydQiWEJoSMQKugjZoDNrglv RFE65J9Z1q+k0M/9D9082A8PAYYyDpKeO4/3eIRTiQyhsN5cVxluVIS5g72M/cFmB4vp uEtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EhDqOLrNL+Ls6g+jJlH1kHSTN+6mKWoVpwhK7g7g/0o=; b=jvE1DxnaUE/aRjL3bhKtXfY4eEt2CQSYhWi9MbsF2zSsXZKAGUwVUmG3n0cygMiS2Z bmVrstddO+tG2W132BqF7NuT/XJw/9eBSRcBnOp6U0KDFBbVfcjFS6T9vz/dXx9HhOj9 QGsV1dEA3mJQpkaetnrsYPC3v4Db0qRRALN4qwyX0xznh0vP+Te3Y0b/zprCt/CUEc9A xNFKq5xA6273/fF/kjZrGAi4xiiQ4QFFRPh455YVBZIL4G/wCHddv9sQUshE9fLyrNGH Xs3KQa9ION1aC+6QOoqKRm6J5sL7QtDhtuDReBSmPSEElLQxAuCTpVIDYoIbI9d9rfuL JSgw== X-Gm-Message-State: APjAAAU8Wab+FklV9ifi52CKYOkFrHwPUfXzlc5hDnaJkas+rJS5A4ym aC7qRR75VTWCjMX9JsuSIXzdJCWxpSDcHQSMUvzQ X-Received: by 2002:ac2:410a:: with SMTP id b10mr3157662lfi.175.1559249140261; Thu, 30 May 2019 13:45:40 -0700 (PDT) MIME-Version: 1.0 References: <0785ee2644804f3ec6af1243cc0dcf89709c1fd4.1554732921.git.rgb@redhat.com> <20190530141951.iofimovrndap4npq@madcap2.tricolour.ca> <20190530203702.fibsrazabbiifjvf@madcap2.tricolour.ca> In-Reply-To: <20190530203702.fibsrazabbiifjvf@madcap2.tricolour.ca> From: Paul Moore Date: Thu, 30 May 2019 16:45:28 -0400 Message-ID: Subject: Re: [PATCH ghak90 V6 08/10] audit: add containerid filtering To: Richard Guy Briggs 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 30, 2019 at 4:37 PM Richard Guy Briggs wrote: > On 2019-05-30 10:34, Paul Moore wrote: > > On Thu, May 30, 2019 at 10:20 AM Richard Guy Briggs wrote: > > > > > > 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. > > > > Please send a fixup patch for this. > > The fixup patch is trivial. Yes, I know. > The rebase to v5.2-rc1 audit/next had merge > conflicts with four recent patchsets. It may be simpler to submit a new > patchset and look at a diff of the two sets. I'm testing the rebase > now. Great thanks. Although you might want to hold off a bit on posting the next revision until we sort out the discussion which is happening in patch 02/10; unfortunately I fear we may need to change some of the logic. -- paul moore www.paul-moore.com