All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <stephen.smalley@gmail.com>
To: russell@coker.com.au
Cc: selinux@tycho.nsa.gov, Caleb Case <ccase@tresys.com>,
	Daniel J Walsh <dwalsh@redhat.com>,
	Chad Sellers <csellers@tresys.com>
Subject: Policy loading:  initramfs vs. patched /sbin/init
Date: Thu, 24 Jul 2008 22:08:01 -0400	[thread overview]
Message-ID: <1216951692.5185.36.camel@sulphur> (raw)
In-Reply-To: <200807231242.51484.russell@coker.com.au>

Hi,

I saw your blog entry about policy loading on planet selinux - you ought
to bring issues like that up on selinux list for discussion rather than
just blogging about them.

First, to clarify, while Ubuntu and Fedora are initiating the policy
load from the initramfs, they are taking the policy from the real root
filesystem.  Thus, the policy is not being stored on the initramfs image
and updates to policy do not require rebuilding the image.

Both Ubuntu and Fedora have the script that runs from the initramfs
initiate the policy load, but Ubuntu does it by having the script invoke
the load_policy utility from the real root (chroot /path/to/realroot
load_policy -i) while Fedora does it by having the script invoke a nash
built-in command that directly calls the selinux_init_load_policy()
libselinux function call after chroot'ing into the real root.  The
Fedora approach was motivated by not wanting to pull the chroot utility
into the initrd and by wanting more precise error handling (making nash
exit if policy load fails and the system is enforcing so that the system
halts).  However this has caused some issues with pulling libsepol into
the initramfs and thereby limiting the maximum policy that can be loaded
to whatever policy version is supported by the initramfs libsepol.

On the positive side, the initramfs-based approach does mean
that /sbin/init from the real root automatically transitions into the
right domain since policy is already loaded.  And policy gets loaded no
matter what init is used or even if the user specifies an alternate
init= program on the kernel command line.

As you note, performing the load from initramfs can be problematic for
systems that cannot or choose not to use an initramfs, and that has come
up for two kernel developers already where they just happened to not use
an initramfs for a kernel they built themselves and had SELinux left
disabled (no policy loaded) unwittingly.

So I'm not fundamentally opposed to having the support in /sbin/init as
well if that's feasible, but you'll need it to detect whether policy has
already been loaded and skip it if so or it will end up loading policy
twice on systems that are using the initramfs-based approach.



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2008-07-25  2:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23  0:17 what is the point of semodule -u? Russell Coker
2008-07-23  2:11 ` Stephen Smalley
2008-07-23  2:42   ` Russell Coker
2008-07-25  2:08     ` Stephen Smalley [this message]
2008-07-25  3:35       ` Policy loading: initramfs vs. patched /sbin/init Russell Coker
2008-07-25 13:38         ` Stephen Smalley
2008-07-25 21:33           ` Russell Coker

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=1216951692.5185.36.camel@sulphur \
    --to=stephen.smalley@gmail.com \
    --cc=ccase@tresys.com \
    --cc=csellers@tresys.com \
    --cc=dwalsh@redhat.com \
    --cc=russell@coker.com.au \
    --cc=selinux@tycho.nsa.gov \
    /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.