From: Russell Coker <russell@coker.com.au>
To: selinux-refpolicy@vger.kernel.org, Rahul Sandhu <nvraxn@posteo.uk>
Subject: Re: RFC: earlyinit_t
Date: Fri, 19 Jun 2026 01:22:50 +1000 [thread overview]
Message-ID: <5504686.lxrEIsy0gb@xev> (raw)
In-Reply-To: <DJC8ZMO4UNCV.1S56VN4W5H5T4@posteo.uk>
On Friday, 19 June 2026 00:34:01 AEST Rahul Sandhu wrote:
> kernel_t is currently a bit overloaded in terms of scope; the domain is
> used both for kernel threads and early userspace, before the transition
> that is done (typically) by the init system.
That was never a problem in the traditional Unix design.
> Unfortunately, these targets differ in terms of the level of access
> other domains require to them. Just as an example, modern systems that
> are running systemd create a plethora of sockets and other objects in
> the initramfs, so long as systemd itself is running there, that persist
> for the system's entire boot and onwards. systemd-journald's socket is
> a good example of a socket created early, which as a result ends up as
> kernel_t. For another example, I have this recent denial from udev[2].
This is a bad idea. The initramfs should just do whatever is needed to mount
real root and nothing more.
> Hence, I propose creating a new domain, earlyinit_t, and changing the
> init sid to use that instead of kernel_t. A couple questions linger at
> the moment off the top of my head:
If people continue with the bad idea of processes running from initramfs to
multiuser mode there is no other choice.
> 1. Does earlyinit_t belong in the kernel policy module or would a new
> policy module, earlyinit, be preferable?
Probably best to have a new module and make it optional for systems that don't
do that sort of thing.
> 2. Is there any desire to add constraints via type enforcement to what
> earlyinit_t may do? I'm not currently seeing a usecase, so I think
> it may be tempting to give it near limitless permission.
With the unconfined.pp module loaded the domains init_t, initrc_t, and
kernel_t are all unconfined. But I think we should be aiming for less
unconfined domains not more.
> I also would think it desirable to call unconfined_domain(earlyinit_t)
> in an optional policy block as that should make the boot more robust in
> my opinion.
Systems without the unconfined module work well currently with a few tweaks.
> Is there any contention to calling files_manage_all_files(earlyinit_t),
> fs_mount_all_fs(earlyinit_t), etc for each various subsystem? On a side
> note, I think it may be useful to move unconfined_domain() to another
> module. I can understand not wanting to force unconfined_t and friends
> to exist, but I think some domains end up being _basically_ unconfined
> but not really simply because we can't call unconfined_domain() always
> on them, as it's gated behind an optional policy block. This is another
> significant change, but I think the utility to it also extends beyond
> this RFC to some other domains and modules, for example init_t running
> under systemd.
The problem with this is demonstrated by all the ifdef(`distro_ubuntu',`
sections in the current policy, they have 19 domains unconfined that everyone
else has confined. Removing the unconfined module is a way of quickly fixing
that on an Ubuntu system.
> [1]
> https://github.com/SELinuxProject/refpolicy/pull/1164#issuecomment-47276043
> 62 [2] avc: denied { read write } for pid=1183 comm="systemd-udevd"
> path="socket:[3032]" dev="sockfs" ino=3032
> scontext=system_u:system_r:udev_t:s0 tcontext=system_u:system_r:kernel_t:s0
> tclass=netlink_kobject_uevent_socket permissive=1
--
My Main Blog http://etbe.coker.com.au/
My Documents Blog http://doc.coker.com.au/
next prev parent reply other threads:[~2026-06-18 15:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 14:34 RFC: earlyinit_t Rahul Sandhu
2026-06-18 15:22 ` Russell Coker [this message]
2026-06-18 17:18 ` Rahul Sandhu
2026-06-18 21:04 ` Christopher J. PeBenito
2026-06-18 23:30 ` Rahul Sandhu
2026-06-19 7:38 ` Russell Coker
2026-06-19 7:29 ` 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=5504686.lxrEIsy0gb@xev \
--to=russell@coker.com.au \
--cc=nvraxn@posteo.uk \
--cc=selinux-refpolicy@vger.kernel.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.