From: Vitaly Chikunov <vt@altlinux.org>
To: linux-security-module@vger.kernel.org, bpf@vger.kernel.org,
selinux@vger.kernel.org
Cc: Paul Moore <paul@paul-moore.com>, KP Singh <kpsingh@kernel.org>,
Matt Bobrowski <mattbobrowski@google.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
Ondrej Mosnacek <omosnace@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [BUG] lsm= with bpf before selinux breaks fscreate with EINVAL
Date: Mon, 11 May 2026 00:17:15 +0300 [thread overview]
Message-ID: <agDuCdGIeM-6z-j-@altlinux.org> (raw)
Hi,
We have boot failure when CONFIG_LSM has "bpf" listed before "selinux"
(without bpf lsm scripts loaded). (This also happens with a boot with
"security=selinux" if selinux was not in LSM= list but bpf is.)
systemd reports on the failing boot attempt:
Failed to set SELinux security context generic_u:object_r:device:s0 for /dev/shm: Invalid argument
Mounting tmpfs to /dev/shm of type tmpfs with options mode=01777.
Mounting tmpfs (tmpfs) on /dev/shm (MS_NOSUID|MS_NODEV|MS_STRICTATIME "mode=01777")...
Failed to mount tmpfs (type tmpfs) on /dev/shm (MS_NOSUID|MS_NODEV|MS_STRICTATIME "mode=01777"): No such file or directory
Failed to set SELinux security context generic_u:object_r:device:s0 for /dev/pts: Invalid argument
Mounting devpts to /dev/pts of type devpts with options mode=0620,gid=5.
Mounting devpts (devpts) on /dev/pts (MS_NOSUID|MS_NOEXEC "mode=0620,gid=5")...
Failed to mount devpts (type devpts) on /dev/pts (MS_NOSUID|MS_NOEXEC "mode=0620,gid=5"): No such file or directory
No filesystem is currently mounted on /sys/fs/cgroup.
Failed to set SELinux security context generic_u:object_r:def_t:s0 for /sys/fs/cgroup: Invalid argument
Mounting cgroup2 to /sys/fs/cgroup of type cgroup2 with options nsdelegate,memory_recursiveprot.
Mounting cgroup2 (cgroup2) on /sys/fs/cgroup (MS_NOSUID|MS_NODEV|MS_NOEXEC "nsdelegate,memory_recursiveprot")...
Failed to set SELinux security context generic_u:object_r:def_t:s0 for /sys/fs/pstore: Invalid argument
Mounting pstore to /sys/fs/pstore of type pstore with options n/a.
Mounting pstore (pstore) on /sys/fs/pstore (MS_NOSUID|MS_NODEV|MS_NOEXEC "")...
Failed to set SELinux security context generic_u:object_r:def_t:s0 for /sys/fs/bpf: Invalid argument
Mounting bpf to /sys/fs/bpf of type bpf with options mode=0700.
Mounting bpf (bpf) on /sys/fs/bpf (MS_NOSUID|MS_NODEV|MS_NOEXEC "mode=0700")...
[!!!!!!] Failed to mount API filesystems.
Freezing execution
'Invalid arguments' seems from setfscreatecon_raw.
Reproducer:
Boot with lsm=lockdown,capability,landlock,yama,safesetid,bpf,selinux,ima,evm
(none):~# cat /proc/thread-self/attr/current
cat: /proc/thread-self/attr/current: Invalid argument
(none):~# echo > /proc/thread-self/attr/fscreate
bash: echo: write error: Invalid argument
This appears to be caused by security_getprocattr / security_setprocattr
iterating until the first hook defined (which is bpf) and returning with
default value -EINVAL before selinux even sees them.
Perhaps, bpf LSM should avoid registering getprocattr/setprocattr hooks
that it does not implement, or the legacy LSM_ID_UNDEF procattr dispatch
should skip LSMs that cannot handle the requested attribute and continue
to seLinux (or whatever).
Thanks,
next reply other threads:[~2026-05-10 21:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 21:17 Vitaly Chikunov [this message]
2026-05-11 20:19 ` [BUG] lsm= with bpf before selinux breaks fscreate with EINVAL Paul Moore
2026-05-11 21:03 ` Vitaly Chikunov
2026-05-11 21:49 ` Paul Moore
2026-05-11 21:54 ` Vitaly Chikunov
2026-05-11 22:43 ` Vitaly Chikunov
2026-05-12 19:17 ` Paul Moore
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=agDuCdGIeM-6z-j-@altlinux.org \
--to=vt@altlinux.org \
--cc=bpf@vger.kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mattbobrowski@google.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/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.