From: Steve Grubb <sgrubb@redhat.com>
To: Paul Moore <paul@paul-moore.com>
Cc: Richard Guy Briggs <rgb@redhat.com>,
Greg Edwards <gedwards@ddn.com>,
linux-audit@redhat.com
Subject: Re: [PATCH v2] audit: do not panic kernel on invalid audit parameter
Date: Wed, 21 Feb 2018 17:52:53 -0500 [thread overview]
Message-ID: <2982282.dxEEPJdbBj@x2> (raw)
In-Reply-To: <161ba322928.2781.85c95baa4474aabc7814e68940a78392@paul-moore.com>
On Wednesday, February 21, 2018 4:08:25 PM EST Paul Moore wrote:
> On February 21, 2018 11:19:09 AM Greg Edwards <gedwards@ddn.com> wrote:
> > If you pass in an invalid audit kernel boot parameter, e.g. 'audit=off',
> > the kernel panics very early in boot with no output on the console
> > indicating the problem.
> >
> > Instead, print the error indicating an invalid audit parameter value,
> > but leave auditing enabled.
> >
> > Fixes: 80ab4df62706 ("audit: don't use simple_strtol() anymore")
> > Signed-off-by: Greg Edwards <gedwards@ddn.com>
> > ---
> >
> > Changes v1 -> v2:
> > - default to auditing enabled for the error case
> >
> > kernel/audit.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
>
> Thanks for the quick follow-up, it's actually a little *too* quick if I'm
> honest, I still haven't fully thought through all the different options
> here :)
>
> However, in the interest in capitalizing on your enthusiasm and willingness
> to help, here are some of the things I was thinking about, in no
> particular order:
>
> #1 - We might want to consider accepting both "0" and "off" as acceptable
> inputs. It should be a trivial change, and if we are going to default to
> on/enabled it seems like we should make a reasonable effort to do the
> right thing when people attempt to disable audit (unfortunately the kernel
> command line parameters seem to use both "0" and "off" so we can't blame
> people too much when they use "off").
>
> #2 - If panic("<msg>") doesn't work, does pr_err("<msg>")? If it does, I
> would be curious to understand why.
>
> #3 - Related to #2 above, but there are other calls to panic() and pr_*()
> in audit_enable() that should probably be re-evaluated and changed. If we
> can't notify users/admins here, why are we trying?
>
> #4 - Related to #2 and #3, if we can't emit messages in audit_enable() we
> need to find a way to "remember" that the user specified a bogus audit
> setting and let them know as soon as we can. One possibility might be to
> overload the audit_default variable (most places seem to treat it as a
> true/false value) with a "AUDIT_DEFAULT_INVALID" value (make it non-zero,
> say "3"?) and we could display a message in audit_init() or similar. Full
> disclosure, this *should* work ... I think ... but I might be missing some
> crucial detail.
Well, auditd will probably have a big problem starting up and that should be
a big clue. Also, this could be remembered in a way that a fault indication
is returned by auditctl -s? Loading audit rules leads to checking audit
status which journald keeps around.
-Steve
> I realize this is probably much more than you bargained for when you first
> submitted your patch, and if you're not interested in taking this any
> further I understand .... however, if you are willing to play a bit more I
> would be very grateful :)
> > diff --git a/kernel/audit.c b/kernel/audit.c
> > index 227db99b0f19..9b80e9895107 100644
> > --- a/kernel/audit.c
> > +++ b/kernel/audit.c
> > @@ -1572,8 +1572,10 @@ static int __init audit_enable(char *str)
> >
> > {
> >
> > long val;
> >
> > - if (kstrtol(str, 0, &val))
> > - panic("audit: invalid 'audit' parameter value (%s)\n", str);
> > + if (kstrtol(str, 0, &val)) {
> > + pr_err("invalid 'audit' parameter value (%s)\n", str);
> > + val = AUDIT_ON;
> > + }
> >
> > audit_default = (val ? AUDIT_ON : AUDIT_OFF);
> >
> > if (audit_default == AUDIT_OFF)
>
> --
> paul moore
> www.paul-moore.com
next prev parent reply other threads:[~2018-02-21 22:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 21:33 [PATCH] audit: do not panic kernel on invalid audit parameter Greg Edwards
2018-02-20 21:45 ` Paul Moore
2018-02-20 22:00 ` Greg Edwards
2018-02-20 22:06 ` Paul Moore
2018-02-21 5:12 ` Richard Guy Briggs
2018-02-21 16:18 ` [PATCH v2] " Greg Edwards
2018-02-21 21:08 ` Paul Moore
2018-02-21 22:51 ` Greg Edwards
2018-02-22 1:13 ` Richard Guy Briggs
2018-02-21 22:52 ` Steve Grubb [this message]
2018-03-05 22:05 ` [PATCH] audit: do not panic on invalid boot parameter Greg Edwards
2018-03-06 3:24 ` Richard Guy Briggs
2018-03-06 14:38 ` Paul Moore
2018-03-06 18:53 ` Paul Moore
2018-03-07 4:13 ` 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=2982282.dxEEPJdbBj@x2 \
--to=sgrubb@redhat.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.