public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@mandelbit.com>
To: development@lists.ipfire.org
Cc: Antonio Quartulli <antonio@mandelbit.com>
Subject: [PATCH] mountkernfs: Mount securityfs
Date: Thu, 12 Nov 2026 15:05:26 +0100	[thread overview]
Message-ID: <20261112140526.3332669-1-antonio@mandelbit.com> (raw)

Without securityfs, /sys/kernel/security/lsm and the lockdown state are
not available, so there is no easy way to check which security modules
(e.g. Landlock) are active. This led to the wrong conclusion in #13782
that Landlock is not initialised.

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
Notes:
- /etc/rc.d/init.d/mountkernfs needs to be shipped with the next Core
  Update; I left the filelists to you.
- Landlock itself works: on Core 189 and 205 a Landlock-restricted
  process gets EACCES, /sys/kernel/security/lsm lists landlock, and
  Suricata is confined (a rule reload of a yaml outside its sandbox
  fails with "Permission denied"). Details are in #13782.

 src/initscripts/system/mountkernfs | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/initscripts/system/mountkernfs b/src/initscripts/system/mountkernfs
index b660083ec..73e9ad03b 100644
--- a/src/initscripts/system/mountkernfs
+++ b/src/initscripts/system/mountkernfs
@@ -51,6 +51,11 @@ case "${1}" in
 			mount -t efivarfs efivarfs /sys/firmware/efi/efivars || failed=1
 		fi
 
+		if ! mountpoint /sys/kernel/security &>/dev/null && [ -d "/sys/kernel/security" ]; then
+			boot_mesg -n " /sys/kernel/security" ${NORMAL}
+			mount -n -t securityfs -o nosuid,nodev,noexec securityfs /sys/kernel/security || failed=1
+		fi
+
 		# create folder for dhcpcd changeroot
 		mkdir -p /run/dhcpcd/chroot
 		chown dhcpcd:dhcpcd /run/dhcpcd/chroot
-- 
2.56.0



                 reply	other threads:[~2026-11-12 14:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261112140526.3332669-1-antonio@mandelbit.com \
    --to=antonio@mandelbit.com \
    --cc=development@lists.ipfire.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox