mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Johansen <john.johansen@canonical.com>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <jmorris@namei.org>,
	David Rheinsberg <david.rheinsberg@gmail.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] apparmor: Restore Y/N in /sys for apparmor's "enabled"
Date: Mon, 8 Apr 2019 10:47:49 -0700	[thread overview]
Message-ID: <a7216d87-df56-8112-fd71-e9a4ff827804@canonical.com> (raw)
In-Reply-To: <CAGXu5j+k86VtegoRxV1s++YZdMxXEhQhqx1Yh7eu+YKHn0wNZA@mail.gmail.com>

On 4/8/19 10:25 AM, Kees Cook wrote:
> On Mon, Apr 8, 2019 at 9:58 AM John Johansen
> <john.johansen@canonical.com> wrote:
>>> +/* Can only be set before AppArmor is initialized (i.e. on boot cmdline). */
>>> +static int param_set_aaintbool(const char *val, const struct kernel_param *kp)
>>> +{
>>> +     struct kernel_param kp_local;
>>> +     bool value;
>>> +     int error;
>>> +
>>> +     if (apparmor_initialized)
>>> +             return -EPERM;
>>> +
>> This isn't sufficient/correct. apparmor_initialized is only set after
>> apparmor has gone through and completed initialization. However if
>> apparmor is not selected as one of the LSMs to enable, then this check
>> won't stop apparmor_enabled from being set post boot.
>>
>> However with the apparmor_enabled param being 0444 and the
>> apparmor_enabled_setup() fn handling boot cmdline do with even need
>> the set parameter fn?
> 
> Yup, that's true. I've gone and tested this, and yes, the 0444 is
> sufficient to protect the logic here (even if root chmods the inode).
> So the test here is redundant. However, very early in the threads
> about LSM boot cmdline enabling it was made clear that
> "apparmor.enabled=..." needed to stay working, which means the "set"
> op is still needed. (But I'm happy to do whatever you want here -- I
> was just trying to keep the functionality as it was.)
> 

Right, though the legacy case that most document reference is apparmor=0/1
which is handled by __apparmor_enabled_setup()

still best not to break apparmor.enabled

> Should I send a v2 without the "initialized" check or is this okay to
> leave as-is with the redundant check?
> 

redundant is fine, it will help protect against shooting ourselves in
the foot if some one ever tries changing the 0444

you can have my Acked-by: John Johansen <john.johansen@canonical.com>

  reply	other threads:[~2019-04-08 17:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 16:07 Kees Cook
2019-04-08 16:58 ` John Johansen
2019-04-08 17:25   ` Kees Cook
2019-04-08 17:47     ` John Johansen [this message]
2019-04-09  6:21 ` David Rheinsberg
2019-04-09 15:16   ` Kees Cook
2019-04-09 20:11     ` James Morris
2019-04-09 20:11     ` James Morris
2019-04-09 20:55       ` Kees Cook
2019-04-09 21:17         ` John Johansen
2019-04-09 21:17       ` John Johansen

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=a7216d87-df56-8112-fd71-e9a4ff827804@canonical.com \
    --to=john.johansen@canonical.com \
    --cc=david.rheinsberg@gmail.com \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.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

all inboxes | Powered by JetHome®