From: Greg Edwards <gedwards@ddn.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Richard Guy Briggs <rgb@redhat.com>, linux-audit@redhat.com
Subject: Re: [PATCH 1/2] audit: move processing of "audit" boot param to audit_init()
Date: Fri, 2 Mar 2018 13:46:50 -0800 [thread overview]
Message-ID: <20180302214650.GB21780@soma> (raw)
In-Reply-To: <CAHC9VhTfhLfeGiKrz3MT6dL4b789NftN5CBcoLRo3fDKA9YhsQ@mail.gmail.com>
On Fri, Mar 02, 2018 at 03:33:54PM -0500, Paul Moore wrote:
> On Tue, Feb 27, 2018 at 5:52 PM, Greg Edwards <gedwards@ddn.com> wrote:
>> So, if you want to keep the panic behavior on bad audit parameters, your
>> delayed processing should do the trick. If it instead, you are fine
>> with just pr_err and leaving audit enabled for that error case, then we
>> are almost back to my original patch, with the exceptions you previously
>> noted:
>>
>> * leave audit enabled on parsing error
>> * change panic on audit_set_enabled() failure to pr_err
>> * handle on/off as well
>
> If we get rid of the need to panic(), which I think we are all okay
> with, I think we can resolve everything with something like this, yes?
>
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 1a3e75d9a66c..d41d09e84163 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1618,16 +1618,20 @@ postcore_initcall(audit_init);
> /* Process kernel command-line parameter at boot time. audit=0 or audit=1. */
> static int __init audit_enable(char *str)
> {
> - long val;
> -
> - if (kstrtol(str, 0, &val))
> - panic("audit: invalid 'audit' parameter value (%s)\n", str);
> - audit_default = (val ? AUDIT_ON : AUDIT_OFF);
> + if (!strcasecmp(str, "off") || !strcmp(str, "0"))
> + audit_default = AUDIT_OFF;
> + else if (!strcasecmp(str, "on") || !strcmp(str, "1"))
> + audit_default = AUDIT_ON;
> + else {
> + pr_err("audit: invalid 'audit' parameter value (%s)\n", str);
> + audit_default = AUDIT_ON;
> + }
>
> if (audit_default == AUDIT_OFF)
> audit_initialized = AUDIT_DISABLED;
> if (audit_set_enabled(audit_default))
> - panic("audit: error setting audit state (%d)\n", audit_default);
> + pr_err("audit: error setting audit state (%d)\n",
> + audit_default);
>
> pr_info("%s\n", audit_default ?
> "enabled (after initialization)" : "disabled (until reboot)");
>
Paul, yes this works great, and exactly what I was thinking.
Greg
next prev parent reply other threads:[~2018-03-02 21:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 0:22 [PATCH 0/2] audit boot parameter cleanups Greg Edwards
2018-02-23 0:22 ` [PATCH 1/2] audit: move processing of "audit" boot param to audit_init() Greg Edwards
2018-02-27 0:00 ` Paul Moore
2018-02-27 5:53 ` Richard Guy Briggs
2018-02-27 12:43 ` Paul Moore
2018-02-27 19:01 ` Richard Guy Briggs
2018-02-27 15:59 ` Greg Edwards
2018-02-27 22:28 ` Paul Moore
2018-02-27 22:52 ` Greg Edwards
2018-03-02 20:33 ` Paul Moore
2018-03-02 21:46 ` Greg Edwards [this message]
2018-03-02 22:30 ` Paul Moore
2018-02-23 0:22 ` [PATCH 2/2] audit: add "on"/"off" as valid boot parameter values Greg Edwards
2018-02-23 16:07 ` [PATCH 0/2] audit boot parameter cleanups Richard Guy Briggs
2018-02-23 23:58 ` Paul Moore
2018-02-26 4:58 ` Richard Guy Briggs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180302214650.GB21780@soma \
--to=gedwards@ddn.com \
--cc=linux-audit@redhat.com \
--cc=paul@paul-moore.com \
--cc=rgb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).