From: Stephen Smalley <sds@tycho.nsa.gov>
To: Colin Walters <walters@verbum.org>, SELinux-NSA <SELinux@tycho.nsa.gov>
Cc: systemd Mailing List <systemd-devel@lists.freedesktop.org>
Subject: Re: [PATCH] selinux: Only attempt to load policy exactly once, in the real root
Date: Thu, 20 Feb 2014 13:06:23 -0500 [thread overview]
Message-ID: <5306441F.8050207@tycho.nsa.gov> (raw)
In-Reply-To: <20140220154726.19E25680237@frontend2.nyi.mail.srv.osa>
On 02/20/2014 10:42 AM, Colin Walters wrote:
> Currently on at least Fedora, SELinux policy does not come in
> the initramfs. systemd will attempt to load *both* in the
> initramfs and in the real root.
>
> Now, the selinux_init_load_policy() API has a regular error return
> value, as well as an "enforcing" boolean. To determine enforcing
> state, it looks for /etc/selinux/config as well as the presence
> of "enforcing=" on the kernel command line.
>
> Ordinarily, neither of those exist in the initramfs, so it will return
> "unknown" for enforcing, and systemd will simply ignore the failure to
> load policy.
>
> Then later after we switch to the real root, we have the config file,
> and all will work properly.
>
> Except...this all blows up if someone explicitly specifies enforcing=1
> on the kernel command line. Then systemd will fail to load the
> nonexistent policy in the initramfs and freeze.
>
> What this patch does is quite simple - we add an internal API that
> says where we expect to find policy, and attempt to load it exactly
> from there. Right now since I'm not aware of anyone who does
> policy-in-initramfs, this function is hardcoded to return false.
>
> Lots-of-very-painful-debugging-by: Colin Walters <walters@verbum.org>
> ---
> src/core/main.c | 6 ++++--
> src/core/selinux-setup.c | 10 ++++++++++
> src/core/selinux-setup.h | 2 ++
> 3 files changed, 16 insertions(+), 2 deletions(-)
Wouldn't it be better (and more correct) to probe both the initramfs and
the real root, and if neither one can load policy successfully and
enforcing=1, then halt?
next prev parent reply other threads:[~2014-02-20 18:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 15:42 [PATCH] selinux: Only attempt to load policy exactly once, in the real root Colin Walters
2014-02-20 18:06 ` Stephen Smalley [this message]
2014-02-20 18:17 ` Colin Walters
2014-02-20 18:36 ` [systemd-devel] " Lennart Poettering
2014-02-20 18:47 ` Colin Walters
2014-02-20 18:50 ` Eric Paris
2014-02-20 19:26 ` Lennart Poettering
2014-02-20 19:27 ` Eric Paris
2014-02-20 19:45 ` Daniel J Walsh
2014-02-20 20:52 ` Colin Walters
2014-02-20 21:10 ` Eric Paris
2014-02-20 21:21 ` Colin Walters
2014-02-20 23:44 ` Colin Walters
2014-02-21 2:33 ` Lennart Poettering
2014-02-20 18:51 ` Stephen Smalley
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=5306441F.8050207@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=SELinux@tycho.nsa.gov \
--cc=systemd-devel@lists.freedesktop.org \
--cc=walters@verbum.org \
/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.