selinux: remove deprecated interfaces
Stephen Smalley
maintainercover selinux: remove deprecated interfaces
Several selinuxfs interfaces have been deprecated for some time. Let's finish removing them entirely.
Stephen Smalley (3):
selinux: remove /sys/fs/selinux/user
selinux: remove /sys/fs/selinux/disable
selinux: remove /sys/fs/selinux/checkreqprot
.../{obsolete => removed}/sysfs-selinux-user | 0
security/selinux/selinuxfs.c | 176 ------------------
2 files changed, 176 deletions(-)
rename Documentation/ABI/{obsolete => removed}/sysfs-selinux-user (100%)Signature · 1 line
2.54.0
Stephen Smalley
maintainerPATCH 1/3 selinux: remove /sys/fs/selinux/user
Finish removing the legacy /sys/fs/selinux/user interface.
Commit d7b6918e22c7 ("selinux: Deprecate /sys/fs/selinux/user") started the deprecation process for /sys/fs/selinux/user:
The selinuxfs "user" node allows userspace to request a list of security contexts that can be reached for a given SELinux user from a given starting context. This was used by libselinux when various login-style programs requested contexts for users, but libselinux stopped using it in 2020. Kernel support will be removed no sooner than Dec 2025.
A pr_warn() message has been in place since Linux v6.13, and a 5 second sleep was introduced since Linux v6.17 to help make it more noticeable.
---
.../{obsolete => removed}/sysfs-selinux-user | 0
security/selinux/selinuxfs.c | 71 -------------------
2 files changed, 71 deletions(-)
rename Documentation/ABI/{obsolete => removed}/sysfs-selinux-user (100%)Documentation/ABI/removed/sysfs-selinux-user renamed from Documentation/ABI/obsolete/sysfs-selinux-user +0 -0
security/selinux/selinuxfs.c +0 -71
101 lines not on this page · raw message
Signature · 1 line
2.54.0
Stephen Smalley
maintainerPATCH 2/3 selinux: remove /sys/fs/selinux/disable
In reply to Stephen SmalleyCommit f22f9aaf6c3d ("selinux: remove the runtime disable functionality") removed the SELinux runtime disable functionality but left the /sys/fs/selinux/disable node intact and logged an error message. Get rid of it entirely.
--- security/selinux/selinuxfs.c | 42 ------------------------------------ 1 file changed, 42 deletions(-)
security/selinux/selinuxfs.c +0 -42
@@ -56,7 +56,6 @@ enum sel_inos {SEL_POLICYVERS ,/* return policy version for this kernel */ SEL_COMMIT_BOOLS ,/* commit new boolean values */ SEL_MLS ,/* return if MLS policy is enabled */ -SEL_DISABLE ,/* disable SELinux until next reboot */ SEL_MEMBER ,/* compute polyinstantiation membership decision */ SEL_CHECKREQPROT ,/* check requested protection, not kernel-applied one */ SEL_COMPAT_NET, /* whether to use old compat network packet controls */
@@ -267,46 +266,6 @@ static const struct file_operations sel_handle_status_ops = { .llseek = generic_file_llseek, }; -static ssize_t sel_write_disable (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) - -{ -char *page; -ssize_t length; -int new_value; - -if (count >=PAGE_SIZE ) -return -ENOMEM ; - -/* No partial writes. */ -if (*ppos !=0 ) -return -EINVAL ; - - page =memdup_user_nul (buf, count); -if (IS_ERR (page)) -return PTR_ERR (page); - -if (sscanf (page,"%d" , &new_value) !=1 ) { - length = -EINVAL ; - goto out; - } - length = count; - -if (new_value) { -pr_err ("SELinux: https://github.com/SELinuxProject/selinux-kernel/wiki/DEPRECATE-runtime-disable\n" ); -pr_err ("SELinux: Runtime disable is not supported, use selinux=0 on the kernel cmdline.\n" ); - } - -out: -kfree (page); -return length; -} - -static const struct file_operations sel_disable_ops = { - .write = sel_write_disable, - .llseek = generic_file_llseek, -}; -static ssize_t sel_read_policyvers (struct file *filp,char __user *buf,size_t count,loff_t *ppos) {
@@ -1904,7 +1863,6 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc) [SEL_POLICYVERS] = {"policyvers", &sel_policyvers_ops, S_IRUGO}, [SEL_COMMIT_BOOLS] = {"commit_pending_bools", &sel_commit_bools_ops, S_IWUSR}, [SEL_MLS] = {"mls", &sel_mls_ops, S_IRUGO}, - [SEL_DISABLE] = {"disable", &sel_disable_ops, S_IWUSR}, [SEL_MEMBER] = {"member", &transaction_ops, S_IRUGO|S_IWUGO}, [SEL_CHECKREQPROT] = {"checkreqprot", &sel_checkreqprot_ops, S_IRUGO|S_IWUSR}, [SEL_REJECT_UNKNOWN] = {"reject_unknown", &sel_handle_unknown_ops, S_IRUGO},
Signature · 1 line
2.54.0
Stephen Smalley
maintainerPATCH 3/3 selinux: remove /sys/fs/selinux/checkreqprot
In reply to Stephen Smalleycommit a7e4676e8e2cb ("selinux: remove the 'checkreqprot' functionality") removed the ability to modify the checkreqprot setting but left the /sys/fs/selinux/checkreqprot node intact with an error message logged. Get rid of it entirely.
--- security/selinux/selinuxfs.c | 63 ------------------------------------ 1 file changed, 63 deletions(-)
security/selinux/selinuxfs.c +0 -63
@@ -57,7 +57,6 @@ enum sel_inos {SEL_COMMIT_BOOLS ,/* commit new boolean values */ SEL_MLS ,/* return if MLS policy is enabled */ SEL_MEMBER ,/* compute polyinstantiation membership decision */ -SEL_CHECKREQPROT ,/* check requested protection, not kernel-applied one */ SEL_COMPAT_NET ,/* whether to use old compat network packet controls */ SEL_REJECT_UNKNOWN ,/* export unknown reject handling to userspace */ SEL_DENY_UNKNOWN, /* export unknown deny handling to userspace */
@@ -633,67 +632,6 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size)return length; } -static ssize_t sel_read_checkreqprot (struct file *filp,char __user *buf, -size_t count,loff_t *ppos) -{ -char tmpbuf[TMPBUFLEN ]; -ssize_t length; - - length =scnprintf (tmpbuf,TMPBUFLEN ,"%u" , -checkreqprot_get ()); -return simple_read_from_buffer (buf, count, ppos, tmpbuf, length); -} - -static ssize_t sel_write_checkreqprot (struct file *file,const char __user *buf, -size_t count,loff_t *ppos) -{ -char *page; -ssize_t length; -unsigned int new_value; - - length =avc_has_perm (current_sid (),SECINITSID_SECURITY , -SECCLASS_SECURITY ,SECURITY__SETCHECKREQPROT , -NULL ); -if (length) -return length; - -if (count >=PAGE_SIZE ) -return -ENOMEM ; - -/* No partial writes. */ -if (*ppos !=0 ) -return -EINVAL ; - - page =memdup_user_nul (buf, count); -if (IS_ERR (page)) -return PTR_ERR (page); - -if (sscanf (page,"%u" , &new_value) !=1 ) { - length = -EINVAL ; - goto out; - } - length = count; - -if (new_value) { -char comm[sizeof (current->comm)]; - -strscpy (comm, current->comm); -pr_err ("SELinux: %s (%d) set checkreqprot to 1. This is no longer supported.\n" , - comm, current->pid); - } - -selinux_ima_measure_state (); - -out: -kfree (page); -return length; -} -static const struct file_operations sel_checkreqprot_ops = { - .read = sel_read_checkreqprot, - .write = sel_write_checkreqprot, - .llseek = generic_file_llseek, -}; -static ssize_t sel_write_validatetrans (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -1864,7 +1802,6 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc) [SEL_COMMIT_BOOLS] = {"commit_pending_bools", &sel_commit_bools_ops, S_IWUSR}, [SEL_MLS] = {"mls", &sel_mls_ops, S_IRUGO}, [SEL_MEMBER] = {"member", &transaction_ops, S_IRUGO|S_IWUGO}, - [SEL_CHECKREQPROT] = {"checkreqprot", &sel_checkreqprot_ops, S_IRUGO|S_IWUSR}, [SEL_REJECT_UNKNOWN] = {"reject_unknown", &sel_handle_unknown_ops, S_IRUGO}, [SEL_DENY_UNKNOWN] = {"deny_unknown", &sel_handle_unknown_ops, S_IRUGO}, [SEL_STATUS] = {"status", &sel_handle_status_ops, S_IRUGO},
Signature · 1 line
2.54.0
Paul Moore
maintainerQuoted 9 lines · Stephen Smalley
Several selinuxfs interfaces have been deprecated for some time. Let's finish removing them entirely.
Stephen Smalley (3):
selinux: remove/sys/fs/selinux/user
selinux: remove/sys/fs/selinux/disable
selinux: remove/sys/fs/selinux/checkreqprot
Quoted 4 lines
.../{obsolete => removed}/sysfs-selinux-user | 0
security/selinux/selinuxfs.c | 176 ------------------
2 files changed, 176 deletions(-)
rename Documentation/ABI/{obsolete => removed}/sysfs-selinux-user (100%)I'd be much happier if we continued to expose the selinuxfs files to limit the impact to old userspace, but if you wanted to hollow out the handlers I would be okay with that.
Signature · 1 line
paul-moore.com