All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Casey Schaufler <casey@schaufler-ca.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	Paul Moore <paul@paul-moore.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	syzbot <syzbot+21016130b0580a9de3b5@syzkaller.appspotmail.com>,
	Tyler Hicks <tyhicks@canonical.com>,
	John Johansen <john.johansen@canonical.com>,
	James Morris <jmorris@namei.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	Serge Hallyn <serge@hallyn.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Jeffrey Vander Stoep <jeffv@google.com>,
	SELinux <selinux@vger.kernel.org>,
	Russell Coker <russell@coker.com.au>,
	Laurent Bigonville <bigon@debian.org>,
	syzkaller <syzkaller@googlegroups.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] LSM: Allow syzbot to ignore security= parameter.
Date: Fri, 8 Feb 2019 13:49:28 -0800	[thread overview]
Message-ID: <CAGXu5jJF1M8K39fT0ctOWKBJegboyvLD1pc9U2P_x=miENHw+A@mail.gmail.com> (raw)
In-Reply-To: <54c0ae39-f35c-bdcd-a217-8e62ef14e41b@i-love.sakura.ne.jp>

On Fri, Feb 8, 2019 at 2:52 AM Tetsuo Handa
<penguin-kernel@i-love.sakura.ne.jp> wrote:
>
> On 2019/02/08 1:24, Casey Schaufler wrote:
> >>>> Then, I think that it is straightforward (and easier to manage) to ignore security= parameter
> >>>> when lsm= parameter is specified.
> >>> That reduces flexibility somewhat. If I am debugging security modules
> >>> I may want to use lsm= to specify the order while using security= to
> >>> identify a specific exclusive module. I could do that using lsm= by
> >>> itself, but habits die hard.
> >> "lsm=" can be used for identifying a specific exclusive module, and Ubuntu kernels would
> >> have to use CONFIG_LSM (or "lsm=") for identifying the default exclusive module (in order
> >> to allow enabling both TOMOYO and one of SELinux,Smack,AppArmor at the same time).
> >>
> >> Since "security=" can't be used for selectively enable/disable more than one of
> >> SELinux,Smack,TOMOYO,AppArmor, I think that recommending users to migrate to "lsm=" is the
> >> better direction. And ignoring "security=" when "lsm=" is specified is easier to understand.
> >
> > I added Kees to the CC list. Kees, what to you think about
> > ignoring security= if lsm= is specified? I'm ambivalent.
> >
> >
>
> To help administrators easily understand what LSM modules are possibly enabled by default (which
> have to be fetched from e.g. /boot/config-`uname -r`) and specify lsm= parameter when they need,
> I propose changes shown below.
>
> diff --git a/security/security.c b/security/security.c
> index 3147785e..051d708 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -51,8 +51,6 @@
>  static __initdata const char *chosen_lsm_order;
>  static __initdata const char *chosen_major_lsm;
>
> -static __initconst const char * const builtin_lsm_order = CONFIG_LSM;
> -
>  /* Ordered list of LSMs to initialize. */
>  static __initdata struct lsm_info **ordered_lsms;
>  static __initdata struct lsm_info *exclusive;
> @@ -284,14 +282,22 @@ static void __init ordered_lsm_parse(const char *order, const char *origin)
>  static void __init ordered_lsm_init(void)
>  {
>         struct lsm_info **lsm;
> +       const char *order = CONFIG_LSM;
> +       const char *origin = "builtin";
>
>         ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms),
>                                 GFP_KERNEL);
>
> -       if (chosen_lsm_order)
> -               ordered_lsm_parse(chosen_lsm_order, "cmdline");
> -       else
> -               ordered_lsm_parse(builtin_lsm_order, "builtin");
> +       if (chosen_lsm_order) {
> +               if (chosen_major_lsm) {
> +                       pr_info("security= is ignored because of lsm=\n");

This is intended to be the new default way to change the LSM
("lsm=..."), so I'd rather not have this appear every time. Also, it
must continue to interact with the builtin ordering, so if you wanted
this, I think better would be to do:

diff --git a/security/security.c b/security/security.c
index 3147785e20d7..e6153ed54361 100644
--- a/security/security.c
+++ b/security/security.c
@@ -288,9 +288,13 @@ static void __init ordered_lsm_init(void)
        ordered_lsms = kcalloc(LSM_COUNT + 1, sizeof(*ordered_lsms),
                                GFP_KERNEL);

-       if (chosen_lsm_order)
+       if (chosen_lsm_order) {
+               if (chosen_major_lsm) {
+                       pr_info("security= is ignored because of lsm=\n");
+                       chosen_major_lsm = NULL;
+               }
                ordered_lsm_parse(chosen_lsm_order, "cmdline");
-       else
+       } else
                ordered_lsm_parse(builtin_lsm_order, "builtin");

        for (lsm = ordered_lsms; *lsm; lsm++)

> +       pr_info("Security Framework initializing: %s\n", order);
> +       ordered_lsm_parse(order, origin);
>
>         for (lsm = ordered_lsms; *lsm; lsm++)
>                 prepare_lsm(*lsm);
> @@ -333,8 +339,6 @@ int __init security_init(void)
>         int i;
>         struct hlist_head *list = (struct hlist_head *) &security_hook_heads;
>
> -       pr_info("Security Framework initializing\n");
> -
>         for (i = 0; i < sizeof(security_hook_heads) / sizeof(struct hlist_head);
>              i++)
>                 INIT_HLIST_HEAD(&list[i]);



-- 
Kees Cook

  parent reply	other threads:[~2019-02-08 21:49 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  2:17 WARNING in apparmor_secid_to_secctx syzbot
2018-08-30  2:17 ` syzbot
2018-08-30  2:21 ` Dmitry Vyukov
2018-08-30  2:21   ` Dmitry Vyukov
2018-08-31 16:03   ` Stephen Smalley
2018-08-31 16:03     ` Stephen Smalley
2018-08-31 16:07     ` Paul Moore
2018-08-31 16:07       ` Paul Moore
2018-08-31 16:16       ` Stephen Smalley
2018-08-31 16:16         ` Stephen Smalley
2018-08-31 16:17         ` Stephen Smalley
2018-08-31 16:17           ` Stephen Smalley
2018-08-31 22:38           ` Dmitry Vyukov
2018-08-31 22:38             ` Dmitry Vyukov
2018-09-04 12:57             ` Stephen Smalley
2018-09-04 12:57               ` Stephen Smalley
2018-09-04 13:16               ` Russell Coker
2018-09-04 13:16                 ` Russell Coker
2018-09-04 14:53                 ` Dmitry Vyukov
2018-09-04 14:53                   ` Dmitry Vyukov
2018-09-05 17:13                   ` Kees Cook
2018-09-05 17:13                     ` Kees Cook
2018-09-04 15:02               ` Dmitry Vyukov
2018-09-04 15:02                 ` Dmitry Vyukov
2018-09-04 15:28                 ` Stephen Smalley
2018-09-04 15:28                   ` Stephen Smalley
2018-09-04 15:38                   ` Dmitry Vyukov
2018-09-04 15:38                     ` Dmitry Vyukov
2018-09-04 17:02                     ` Stephen Smalley
2018-09-04 17:02                       ` Stephen Smalley
2018-09-05  1:21                       ` Paul Moore
2018-09-05  1:21                         ` Paul Moore
2018-09-05 11:08                         ` Dmitry Vyukov
2018-09-05 11:08                           ` Dmitry Vyukov
2018-09-05 17:37                           ` Casey Schaufler
2018-09-05 17:37                             ` Casey Schaufler
2018-09-06 10:59                             ` Dmitry Vyukov
2018-09-06 10:59                               ` Dmitry Vyukov
2018-09-06 11:19                               ` Dmitry Vyukov
2018-09-06 11:19                                 ` Dmitry Vyukov
2018-09-06 19:35                                 ` Dmitry Vyukov
2018-09-06 19:35                                   ` Dmitry Vyukov
2019-01-29 11:32                               ` Tetsuo Handa
2019-01-30 14:45                                 ` Dmitry Vyukov
2019-01-30 16:30                                   ` Micah Morton
2019-01-31  0:22                                   ` Tetsuo Handa
2019-02-01 10:09                                     ` Dmitry Vyukov
2019-02-01 10:11                                       ` Dmitry Vyukov
2019-02-01 10:43                                       ` Tetsuo Handa
2019-02-01 10:50                                         ` Dmitry Vyukov
2019-02-01 13:09                                           ` [PATCH] LSM: Allow syzbot to ignore security= parameter Tetsuo Handa
2019-02-04  8:07                                             ` Dmitry Vyukov
2019-02-06 10:23                                               ` Tetsuo Handa
2019-02-06 17:03                                                 ` Casey Schaufler
2019-02-07  2:30                                                   ` Tetsuo Handa
2019-02-07 16:24                                                     ` Casey Schaufler
2019-02-08 10:52                                                       ` Tetsuo Handa
2019-02-08 16:23                                                         ` Casey Schaufler
2019-02-09  0:28                                                           ` Tetsuo Handa
2019-02-09  1:40                                                             ` Tetsuo Handa
2019-02-08 21:49                                                         ` Kees Cook [this message]
2019-02-08 21:33                                                       ` Kees Cook
2018-08-30  3:43 ` WARNING in apparmor_secid_to_secctx syzbot
2018-08-30  3:43   ` syzbot
2018-09-01  9:18 ` John Johansen
2018-09-01  9:18   ` John Johansen
2018-09-02  4:33   ` Dmitry Vyukov
2018-09-02  4:33     ` Dmitry Vyukov
2018-09-02  4:52     ` John Johansen
2018-09-02  4:52       ` John Johansen
2018-09-02  5:03       ` Dmitry Vyukov
2018-09-02  5:03         ` Dmitry Vyukov
2018-09-02  5:03         ` syzbot
2018-09-02  5:03           ` syzbot
2018-09-02  5:05           ` Dmitry Vyukov
2018-09-02  5:05             ` Dmitry Vyukov
2018-09-02  5:46             ` syzbot
2018-09-02  5:46               ` syzbot

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='CAGXu5jJF1M8K39fT0ctOWKBJegboyvLD1pc9U2P_x=miENHw+A@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigon@debian.org \
    --cc=casey@schaufler-ca.com \
    --cc=dvyukov@google.com \
    --cc=jeffv@google.com \
    --cc=jmorris@namei.org \
    --cc=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=russell@coker.com.au \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=syzbot+21016130b0580a9de3b5@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tyhicks@canonical.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.