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
next prev parent reply other threads:[~2019-02-08 21:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <8f48e1d0-c109-f8a9-ea94-9659b16cae49@i-love.sakura.ne.jp>
[not found] ` <0d23d1a5-d4af-debf-6b5f-aaaf698daaa8@schaufler-ca.com>
2019-02-07 2:30 ` [PATCH] LSM: Allow syzbot to ignore security= parameter 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
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 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).