Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp806779ybh; Tue, 21 Jul 2020 08:21:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwjJoC6dy2f8chPC2nldwRxJNmA5pXAxRz4cEz2Aj2lJ74Q5nPU4N2sUQQ/DDPfU5/ez3u X-Received: by 2002:a05:6402:1c11:: with SMTP id ck17mr25282612edb.38.1595344868048; Tue, 21 Jul 2020 08:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595344868; cv=none; d=google.com; s=arc-20160816; b=DKTJc99SyLTuIWBrR72uLsz6ku+TX87Pkor5l5EYDJ+BOQvvm9wGYSK1P7uTuUb/s7 VWNnsu4h20bvHBQsqvKpxyNoD4F0ahtkQCGt2OmV7YOThPlp8etJUZlGeL0Xf8j9i14O wH7BiOWoWMyvXNOZk6EiHpgA0NTD2HjQNOZUeINuLeQY+xFue18xOv0IyrUjK4a6wqPn KlTzfLvIdmwJ9Fg9sEKN/dppDRBYG4TYyRs5bjErlsjeCEOl2Yj2SLKezkveMAMeAQn9 miHHUArww1ZKxR0DhXyf/vWD2nX2XM8s3Gs9jFK3v92EM/cDCyw6KsJbOSnYe4SqX5S0 F+nw== 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=CVY6ngE/wUOCAJ5ZXM4RxqaDGgVG+i4hISevEon3J24=; b=R4b4HPaNyke6rq+OY3njwysLJg5wubZdwXjZTBOGueT8hedm2JHueSMsryKnpiB3kT uTgN97accIlnoaZbfY6BOFaoKIktuvl+2OdJP+JnBS1XyCkZaKqhatmUf0brQdznQiPY oSFUFWMdS1MsOPqLAMvP2UoISXQLsei00C8FyJk+T5EtNDTXoY0kfWXnSRPQ/7YcYFjd 60v+7o7xEEBTe5Gb+d50x9TPuEYjwavgD4NZvgdOydv9s9EDQdFIqhKpDY858mW4lEvw 89Uuak3dFAJhdhJMkmJ7WuveuC10vT4MYx/h+A2c1SCX5ZHBInwyyftq2i4Im7rdzyBW aq+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=PShVHcuB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si12693882edr.239.2020.07.21.08.20.44; Tue, 21 Jul 2020 08:21:08 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=PShVHcuB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729925AbgGUPUM (ORCPT + 99 others); Tue, 21 Jul 2020 11:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729647AbgGUPUM (ORCPT ); Tue, 21 Jul 2020 11:20:12 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE467C061794 for ; Tue, 21 Jul 2020 08:20:11 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id a21so22010539ejj.10 for ; Tue, 21 Jul 2020 08:20:11 -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=CVY6ngE/wUOCAJ5ZXM4RxqaDGgVG+i4hISevEon3J24=; b=PShVHcuB5n4LdkFuYUlDfgcU4l08VeViecqRx966bZmdDekCay/647wqbwHHKhJtOA PIA/K7ogQS3s25r6G+G+VT8OM8fo1SCTSkTata49MSs/DVqOwyBLqZYY91Va/sy7huBS SSp9ickzRl9a5mQOl1C0lxefP8AJ0CY33iNKW1PGZOmgNYsfdwkDCPXcMUzeAWnEpOLG XkjAzSXGbgKXIWyZoUtUwOUtftpg8ywhv7PteOJ7SgJ5Qwxh+5UD+wOfs/FGZeqKlnCz i+1e6Vu+HDvEMMw/8VMIwRZHMAxTnmrDjjdI3xrrIBk/sOCnnsicY19qC+eKF0bWxy1Y 5oZA== 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=CVY6ngE/wUOCAJ5ZXM4RxqaDGgVG+i4hISevEon3J24=; b=uLSqfXHgKguvjSkON7SIF7V78Lqi5k2w4JSxc4/1JshJWjya/3BfWrMsmOgOZAnlMh 1qp1RIDxZUMHVooR95o8EenRfhtGl9reumrS+dlFMfooYg817YJInKJjmDX3KZwpltlm Yexgcxl+WmXjx7cMH2OEWpWJnvJT9/DvhU8Q175cqy9zZH9gydWu9UVmf7xsuulY4kjp 84GzfniizRulTRMKjw1pqfnThAvkfNCcBEgbVuLGHA4lgtgcEJEsptGqKKBXW8nMp26P cmWWgu7tERms6t8FivrDmRbYoWe8lXWAefszU7PmNE+fgV07XhkC13ASuhTYJzajk1E5 qNaw== X-Gm-Message-State: AOAM53182aXW26V/vkb0j0Zrja0SG3bL4vK2yBGvJ2OtQhHUnXolVrSz jQC+2SBBeqhpKGEM10ef5sKNDCpPB5MnT3DyieXZ X-Received: by 2002:a17:906:1a59:: with SMTP id j25mr24366780ejf.398.1595344810149; Tue, 21 Jul 2020 08:20:10 -0700 (PDT) MIME-Version: 1.0 References: <6effbbd4574407d6af21162e57d9102d5f8b02ed.1594664015.git.rgb@redhat.com> <20200714174353.ds7lj3iisy67t2zu@madcap2.tricolour.ca> <20200714210027.me2ieywjfcsf4v5r@madcap2.tricolour.ca> In-Reply-To: <20200714210027.me2ieywjfcsf4v5r@madcap2.tricolour.ca> From: Paul Moore Date: Tue, 21 Jul 2020 11:19:59 -0400 Message-ID: Subject: Re: [PATCH ghak84 v4] audit: purge audit_log_string from the intra-kernel audit API To: Richard Guy Briggs Cc: john.johansen@canonical.com, Linux-Audit Mailing List , LKML , Linux Security Module list , Eric Paris 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 Tue, Jul 14, 2020 at 5:00 PM Richard Guy Briggs wrote: > On 2020-07-14 16:29, Paul Moore wrote: > > On Tue, Jul 14, 2020 at 1:44 PM Richard Guy Briggs wrote: > > > 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. > > > > Did you want to fix that now in this patch, or leave it to later? As > > I said above, I'm not too bothered by it with the quotes so either way > > is fine by me. > > I'd defer to Steve, otherwise I'd say leave it, since there wasn't > anything there before and this makes that more evident. > > > John, I'm assuming you are okay with this patch? With no comments from John or Steve in the past week, I've gone ahead and merged the patch into audit/next. -- paul moore www.paul-moore.com