]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selinux: allow multiple opens of /sys/fs/selinux/policy
authorStephen Smalley <stephen.smalley.work@gmail.com>
Tue, 5 May 2026 14:06:38 +0000 (10:06 -0400)
committerPaul Moore <paul@paul-moore.com>
Tue, 5 May 2026 19:47:25 +0000 (15:47 -0400)
commita02cd6805562305f936e807da83e253b719dd965
tree341165f8e17f161b65a2d5371a1a1b31541463c2
parentad1ac3d740cc6b858a99ab9c45c8c0574be7d1d3
selinux: allow multiple opens of /sys/fs/selinux/policy

Currently there can only be a single open of /sys/fs/selinux/policy at
any time. This allows any process to block any other process from
reading the kernel policy. The original motivation seems to have been
a mix of preventing an inconsistent view of the policy size and
preventing userspace from allocating kernel memory without bound, but
this is arguably equally bad. Eliminate the policy_opened flag and
shrink the critical section that the policy mutex is held. While we
are making changes here, drop a couple of extraneous BUG_ONs.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/selinux/20100726193414.19538.64028.stgit@paris.rdu.redhat.com/
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/selinuxfs.c