From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.sws.net.au (smtp.sws.net.au [144.76.186.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FB993FA5D9 for ; Thu, 18 Jun 2026 15:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.76.186.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781796184; cv=none; b=g8Jt2wvIC52R1gg21TSGHmKSgKe0d1fV0tTKnA/3q6cPXiyO2Cqsjc1IMFzdkqXPbhmDEyfnCrtz2Bd6vN4HfgJSDbqU8/sUqitEkc4R1R5aLDFAqLLNypKVpZuj7gZf66Oz3d/rHtWEvtvXkxiTPDGjsOL3ObOQTH3/aFuKiGE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781796184; c=relaxed/simple; bh=4OJof4bmPRr1ZVW4tXXmKc+ZNjBms9CSowncUpKZ190=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U2uIcvAA++/e1wJ8SBH3i3Gj2OsFGyuzkzt7PFXgdA10VGhQZotqv8Fm/BBHj6wFGympd+QGtiST0n/j9iuXJK95GR7Izw30zECqWxtI11lMGcUhn48YFhEqtB7mKIRo2Aw3Na+4va7mTtudUwqIRANqM0TX3Xi4xcF7rVx0bms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=coker.com.au; spf=pass smtp.mailfrom=coker.com.au; dkim=pass (1024-bit key) header.d=coker.com.au header.i=@coker.com.au header.b=d7H/zJVw; arc=none smtp.client-ip=144.76.186.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=coker.com.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=coker.com.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=coker.com.au header.i=@coker.com.au header.b="d7H/zJVw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1781796175; bh=uwL8xrF5YzwSOrS9CVAb2O7TxD0QKTccZrQGgVVO+9g=; l=3479; h=From:To:Reply-To:Subject:Date:In-Reply-To:References:From; b=d7H/zJVwuNwqOmbhiK3ouLykrq/w9fPl1VXmaqRcp94VOjT/QqkiypQah7GRtOEF6 FSnL1DMtZDhe1apuMZsYqqk3bPWRraH220DUx+5Iu5+dCHt/kMi71MwLz0oDuQ80in K8+GXJDUmDizg0PVV1iB6fTf671sJFXaJbj0XCxA= Received: from xev.localnet (14-201-74-182.tpgi.com.au [14.201.74.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) (Authenticated sender: russell@coker.com.au) by smtp.sws.net.au (Postfix) with ESMTPSA id 40E34100AC; Fri, 19 Jun 2026 01:22:53 +1000 (AEST) From: Russell Coker To: selinux-refpolicy@vger.kernel.org, Rahul Sandhu Reply-To: russell@coker.com.au Subject: Re: RFC: earlyinit_t Date: Fri, 19 Jun 2026 01:22:50 +1000 Message-ID: <5504686.lxrEIsy0gb@xev> In-Reply-To: References: Precedence: bulk X-Mailing-List: selinux-refpolicy@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" 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/