Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1925142ybh; Tue, 14 Jul 2020 10:47:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEC4DNzOUjBi75CjwUN/I+MErDDZfCR8xuSIsDTNRG7thKy/pN5AfuKeLh5kOFexhwBjlL X-Received: by 2002:a17:906:7fc8:: with SMTP id r8mr5793557ejs.412.1594748860360; Tue, 14 Jul 2020 10:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594748860; cv=none; d=google.com; s=arc-20160816; b=NKATmk/GTlVypKHId41h4mSz2a5N/CBEn4CZrZiHxUZ97pXLDSjM4YbGExhaoi+VVM 7ibLTHyOziD5hStLh5/uSAw949GJCUH361Xw+mzV8uSH0B3Q6+VCB8Kv8l9yTl+RrSXd BwKytrfxlQO0EMjf9rJj7C+/8sAp0u1lC7saeUGmp5EfdAYYgPKPgMZHmfliZih8nxXP QTK42oUwaaeYmj4cEa2bUPK0yLK+XEqgE5eG68dg0c90ImPf3Sbvxygp5NClOoQwOw43 UOX7u0X6Zi9m7UE0zTcxcs02UgX646Mgg67MPAIpDX/BCw/rtXn21qpdxBsBkNmtE3OH kqng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fRu/5iacxmutQ7kMDS7dLLg3NGipwsCDb2mhidsZLDQ=; b=y5jrspe8CDzdnVRi6hyPIHhKFtigDJ5aYjCiWJ8SBE+Mdpl9CbLMcAkJhPElZCjsSz 9tytm6oNeA6lvUcQnXJuC/DVgDxNEJz2D0Dneg3ZssvbqaJU82yjeKdAZMIqiFHWWtjE 1rC7B6I2fA93M1GYej3uGxaM5b9CSF3smt1SBg8QBES3sEG8bjk0mvxsSxOIljyCiawO o+QDf6lslW9alU9DWLZ494jzoVp6zT+ZHGMvJusCisk9I+tpV5oQcZHbJsLmGTeMyPyy NBM/vlUaqGzgHtJh8nTWSMd8OQPjpF5HPqQh6uLdMO2kFBvOFPeA7OdjyurRL7Usyo58 6a8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A371v1AQ; 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 h20si12097337eje.434.2020.07.14.10.47.17; Tue, 14 Jul 2020 10:47:40 -0700 (PDT) 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=A371v1AQ; 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 S1729064AbgGNRoP (ORCPT + 99 others); Tue, 14 Jul 2020 13:44:15 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58202 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727028AbgGNRoO (ORCPT ); Tue, 14 Jul 2020 13:44:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594748652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fRu/5iacxmutQ7kMDS7dLLg3NGipwsCDb2mhidsZLDQ=; b=A371v1AQk+HsL23DwZqr9lLNT8usudt7CFEVpM1I8eH52Ay+zND5Ivl4gFAWMFwSQO5OBV XHL91w/UvmgdN+V6xpd4ACT6ii7L/V0YmpW5vBC4CJmWCQ0cvtnY4AMqBgoN0JlFxVWvIX QlsbkqUMqEmcnLVpnfhWHZzN0tHIits= 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-164--oAd_irlPMmMGcwJY665gQ-1; Tue, 14 Jul 2020 13:44:05 -0400 X-MC-Unique: -oAd_irlPMmMGcwJY665gQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 741CF100CCC4; Tue, 14 Jul 2020 17:44:04 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9E786FEDF; Tue, 14 Jul 2020 17:43:56 +0000 (UTC) Date: Tue, 14 Jul 2020 13:43:53 -0400 From: Richard Guy Briggs To: Paul Moore Cc: Linux-Audit Mailing List , LKML , Linux Security Module list , Eric Paris , john.johansen@canonical.com Subject: Re: [PATCH ghak84 v4] audit: purge audit_log_string from the intra-kernel audit API Message-ID: <20200714174353.ds7lj3iisy67t2zu@madcap2.tricolour.ca> References: <6effbbd4574407d6af21162e57d9102d5f8b02ed.1594664015.git.rgb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-07-14 12:21, Paul Moore wrote: > On Mon, Jul 13, 2020 at 3:52 PM Richard Guy Briggs wrote: > > > > audit_log_string() was inteded to be an internal audit function and > > since there are only two internal uses, remove them. Purge all external > > uses of it by restructuring code to use an existing audit_log_format() > > or using audit_log_format(). > > > > Please see the upstream issue > > https://github.com/linux-audit/audit-kernel/issues/84 > > > > Signed-off-by: Richard Guy Briggs > > --- > > Passes audit-testsuite. > > > > Changelog: > > v4 > > - use double quotes in all replaced audit_log_string() calls > > > > v3 > > - fix two warning: non-void function does not return a value in all control paths > > Reported-by: kernel test robot > > > > v2 > > - restructure to piggyback on existing audit_log_format() calls, checking quoting needs for each. > > > > v1 Vlad Dronov > > - https://github.com/nefigtut/audit-kernel/commit/dbbcba46335a002f44b05874153a85b9cc18aebf > > > > include/linux/audit.h | 5 ----- > > kernel/audit.c | 4 ++-- > > security/apparmor/audit.c | 10 ++++------ > > security/apparmor/file.c | 25 +++++++------------------ > > security/apparmor/ipc.c | 46 +++++++++++++++++++++++----------------------- > > security/apparmor/net.c | 14 ++++++++------ > > security/lsm_audit.c | 4 ++-- > > 7 files changed, 46 insertions(+), 62 deletions(-) > > Thanks for restoring the quotes, just one question below ... > > > diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c > > index 4ecedffbdd33..fe36d112aad9 100644 > > --- a/security/apparmor/ipc.c > > +++ b/security/apparmor/ipc.c > > @@ -20,25 +20,23 @@ > > > > /** > > * audit_ptrace_mask - convert mask to permission string > > - * @buffer: buffer to write string to (NOT NULL) > > * @mask: permission mask to convert > > + * > > + * Returns: pointer to static string > > */ > > -static void audit_ptrace_mask(struct audit_buffer *ab, u32 mask) > > +static const char *audit_ptrace_mask(u32 mask) > > { > > switch (mask) { > > case MAY_READ: > > - audit_log_string(ab, "read"); > > - break; > > + return "read"; > > case MAY_WRITE: > > - audit_log_string(ab, "trace"); > > - break; > > + return "trace"; > > case AA_MAY_BE_READ: > > - audit_log_string(ab, "readby"); > > - break; > > + return "readby"; > > case AA_MAY_BE_TRACED: > > - audit_log_string(ab, "tracedby"); > > - break; > > + return "tracedby"; > > } > > + return ""; > > Are we okay with this returning an empty string ("") in this case? > Should it be a question mark ("?")? > > My guess is that userspace parsing should be okay since it still has > quotes, I'm just not sure if we wanted to use a question mark as we do > in other cases where the field value is empty/unknown. Previously, it would have been an empty value, not even double quotes. "?" might be an improvement. > 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