linux/security/apparmor
Paul Moore f22f9aaf6c selinux: remove the runtime disable functionality
After working with the larger SELinux-based distros for several
years, we're finally at a place where we can disable the SELinux
runtime disable functionality.  The existing kernel deprecation
notice explains the functionality and why we want to remove it:

  The selinuxfs "disable" node allows SELinux to be disabled at
  runtime prior to a policy being loaded into the kernel.  If
  disabled via this mechanism, SELinux will remain disabled until
  the system is rebooted.

  The preferred method of disabling SELinux is via the "selinux=0"
  boot parameter, but the selinuxfs "disable" node was created to
  make it easier for systems with primitive bootloaders that did not
  allow for easy modification of the kernel command line.
  Unfortunately, allowing for SELinux to be disabled at runtime makes
  it difficult to secure the kernel's LSM hooks using the
  "__ro_after_init" feature.

It is that last sentence, mentioning the '__ro_after_init' hardening,
which is the real motivation for this change, and if you look at the
diffstat you'll see that the impact of this patch reaches across all
the different LSMs, helping prevent tampering at the LSM hook level.

From a SELinux perspective, it is important to note that if you
continue to disable SELinux via "/etc/selinux/config" it may appear
that SELinux is disabled, but it is simply in an uninitialized state.
If you load a policy with `load_policy -i`, you will see SELinux
come alive just as if you had loaded the policy during early-boot.

It is also worth noting that the "/sys/fs/selinux/disable" file is
always writable now, regardless of the Kconfig settings, but writing
to the file has no effect on the system, other than to display an
error on the console if a non-zero/true value is written.

Finally, in the several years where we have been working on
deprecating this functionality, there has only been one instance of
someone mentioning any user visible breakage.  In this particular
case it was an individual's kernel test system, and the workaround
documented in the deprecation notice ("selinux=0" on the kernel
command line) resolved the issue without problem.

Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2023-03-20 12:34:23 -04:00
..
include + Features 2022-12-14 13:42:09 -08:00
.gitignore
apparmorfs.c fs: port ->mkdir() to pass mnt_idmap 2023-01-19 09:24:26 +01:00
audit.c AppArmor: Fix kernel-doc 2022-10-25 00:15:18 -07:00
capability.c apparmor: rework profile->rules to be a list 2022-10-03 14:49:04 -07:00
crypto.c
domain.c fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2023-01-19 09:24:29 +01:00
file.c fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2023-01-19 09:24:29 +01:00
ipc.c AppArmor: Fix kernel-doc 2022-10-25 00:15:18 -07:00
Kconfig + Features 2022-12-14 13:42:09 -08:00
label.c apparmor: remove useless static inline functions 2022-10-24 22:35:11 -07:00
lib.c apparmor: rework profile->rules to be a list 2022-10-03 14:49:04 -07:00
lsm.c selinux: remove the runtime disable functionality 2023-03-20 12:34:23 -04:00
Makefile + Features 2022-12-14 13:42:09 -08:00
match.c apparmor: Add __init annotation to aa_{setup/teardown}_dfa_engine() 2022-11-01 21:17:26 -07:00
mount.c apparmor: rework profile->rules to be a list 2022-10-03 14:49:04 -07:00
net.c apparmor: rework profile->rules to be a list 2022-10-03 14:49:04 -07:00
nulldfa.in
path.c
policy.c apparmor: fix a memleak in free_ruleset() 2022-10-25 00:15:19 -07:00
policy_compat.c apparmor: Fix regression in compat permissions for getattr 2023-02-15 11:24:38 -08:00
policy_ns.c apparmor: Fix memleak in alloc_ns() 2022-11-01 05:32:13 -07:00
policy_unpack.c capability: just use a 'u64' instead of a 'u32[2]' array 2023-03-01 10:01:22 -08:00
policy_unpack_test.c + Features 2022-12-14 13:42:09 -08:00
procattr.c apparmor: fix obsoleted comments for aa_getprocattr() and audit_resource() 2022-10-24 22:35:23 -07:00
resource.c apparmor: Fix spelling of function name in comment block 2022-10-25 00:15:19 -07:00
secid.c
stacksplitdfa.in
task.c apparmor: Simplify obtain the newest label on a cred 2022-10-03 14:49:04 -07:00