VYPR
Unrated severityNVD Advisory· Published Jun 8, 2026

CVE-2026-46302

CVE-2026-46302

Description

In the Linux kernel, the following vulnerability has been resolved:

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.

Affected products

1

Patches

4
714362f3779d

selinux: allow multiple opens of /sys/fs/selinux/policy

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitStephen SmalleyFixed in 7.0.7via kernel-cna
1 file changed · +4 24
  • security/selinux/selinuxfs.c+4 24 modified
    diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
    index e11da5461810c..35aa25b03852c 100644
    --- a/security/selinux/selinuxfs.c
    +++ b/security/selinux/selinuxfs.c
    @@ -76,7 +76,6 @@ struct selinux_fs_info {
     	int *bool_pending_values;
     	struct dentry *class_dir;
     	unsigned long last_class_ino;
    -	bool policy_opened;
     	unsigned long last_ino;
     	struct super_block *sb;
     };
    @@ -340,44 +339,31 @@ struct policy_load_memory {
     
     static int sel_open_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = NULL;
     	int rc;
     
    -	BUG_ON(filp->private_data);
    -
    -	mutex_lock(&selinux_state.policy_mutex);
    -
     	rc = avc_has_perm(current_sid(), SECINITSID_SECURITY,
     			  SECCLASS_SECURITY, SECURITY__READ_POLICY, NULL);
     	if (rc)
    -		goto err;
    -
    -	rc = -EBUSY;
    -	if (fsi->policy_opened)
    -		goto err;
    +		return rc;
     
    -	rc = -ENOMEM;
     	plm = kzalloc_obj(*plm);
     	if (!plm)
    -		goto err;
    +		return -ENOMEM;
     
    +	mutex_lock(&selinux_state.policy_mutex);
     	rc = security_read_policy(&plm->data, &plm->len);
     	if (rc)
     		goto err;
    -
     	if ((size_t)i_size_read(inode) != plm->len) {
     		inode_lock(inode);
     		i_size_write(inode, plm->len);
     		inode_unlock(inode);
     	}
    -
    -	fsi->policy_opened = 1;
    +	mutex_unlock(&selinux_state.policy_mutex);
     
     	filp->private_data = plm;
     
    -	mutex_unlock(&selinux_state.policy_mutex);
    -
     	return 0;
     err:
     	mutex_unlock(&selinux_state.policy_mutex);
    @@ -390,13 +376,8 @@ err:
     
     static int sel_release_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = filp->private_data;
     
    -	BUG_ON(!plm);
    -
    -	fsi->policy_opened = 0;
    -
     	vfree(plm->data);
     	kfree(plm);
     
    -- 
    cgit 1.3-korg
    
    
    
a02cd6805562

selinux: allow multiple opens of /sys/fs/selinux/policy

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitStephen SmalleyFixed in 7.1-rc3via kernel-cna
1 file changed · +4 24
  • security/selinux/selinuxfs.c+4 24 modified
    diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
    index 6ed6693091323..a43a38a3ae25b 100644
    --- a/security/selinux/selinuxfs.c
    +++ b/security/selinux/selinuxfs.c
    @@ -76,7 +76,6 @@ struct selinux_fs_info {
     	int *bool_pending_values;
     	struct dentry *class_dir;
     	unsigned long last_class_ino;
    -	bool policy_opened;
     	unsigned long last_ino;
     	struct super_block *sb;
     };
    @@ -340,44 +339,31 @@ struct policy_load_memory {
     
     static int sel_open_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = NULL;
     	int rc;
     
    -	BUG_ON(filp->private_data);
    -
    -	mutex_lock(&selinux_state.policy_mutex);
    -
     	rc = avc_has_perm(current_sid(), SECINITSID_SECURITY,
     			  SECCLASS_SECURITY, SECURITY__READ_POLICY, NULL);
     	if (rc)
    -		goto err;
    -
    -	rc = -EBUSY;
    -	if (fsi->policy_opened)
    -		goto err;
    +		return rc;
     
    -	rc = -ENOMEM;
     	plm = kzalloc_obj(*plm);
     	if (!plm)
    -		goto err;
    +		return -ENOMEM;
     
    +	mutex_lock(&selinux_state.policy_mutex);
     	rc = security_read_policy(&plm->data, &plm->len);
     	if (rc)
     		goto err;
    -
     	if ((size_t)i_size_read(inode) != plm->len) {
     		inode_lock(inode);
     		i_size_write(inode, plm->len);
     		inode_unlock(inode);
     	}
    -
    -	fsi->policy_opened = 1;
    +	mutex_unlock(&selinux_state.policy_mutex);
     
     	filp->private_data = plm;
     
    -	mutex_unlock(&selinux_state.policy_mutex);
    -
     	return 0;
     err:
     	mutex_unlock(&selinux_state.policy_mutex);
    @@ -390,13 +376,8 @@ err:
     
     static int sel_release_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = filp->private_data;
     
    -	BUG_ON(!plm);
    -
    -	fsi->policy_opened = 0;
    -
     	vfree(plm->data);
     	kfree(plm);
     
    -- 
    cgit 1.3-korg
    
    
    
a02cd6805562

selinux: allow multiple opens of /sys/fs/selinux/policy

1 file changed · +4 24
  • security/selinux/selinuxfs.c+4 24 modified
    diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
    index 6ed6693091323..a43a38a3ae25b 100644
    --- a/security/selinux/selinuxfs.c
    +++ b/security/selinux/selinuxfs.c
    @@ -76,7 +76,6 @@ struct selinux_fs_info {
     	int *bool_pending_values;
     	struct dentry *class_dir;
     	unsigned long last_class_ino;
    -	bool policy_opened;
     	unsigned long last_ino;
     	struct super_block *sb;
     };
    @@ -340,44 +339,31 @@ struct policy_load_memory {
     
     static int sel_open_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = NULL;
     	int rc;
     
    -	BUG_ON(filp->private_data);
    -
    -	mutex_lock(&selinux_state.policy_mutex);
    -
     	rc = avc_has_perm(current_sid(), SECINITSID_SECURITY,
     			  SECCLASS_SECURITY, SECURITY__READ_POLICY, NULL);
     	if (rc)
    -		goto err;
    -
    -	rc = -EBUSY;
    -	if (fsi->policy_opened)
    -		goto err;
    +		return rc;
     
    -	rc = -ENOMEM;
     	plm = kzalloc_obj(*plm);
     	if (!plm)
    -		goto err;
    +		return -ENOMEM;
     
    +	mutex_lock(&selinux_state.policy_mutex);
     	rc = security_read_policy(&plm->data, &plm->len);
     	if (rc)
     		goto err;
    -
     	if ((size_t)i_size_read(inode) != plm->len) {
     		inode_lock(inode);
     		i_size_write(inode, plm->len);
     		inode_unlock(inode);
     	}
    -
    -	fsi->policy_opened = 1;
    +	mutex_unlock(&selinux_state.policy_mutex);
     
     	filp->private_data = plm;
     
    -	mutex_unlock(&selinux_state.policy_mutex);
    -
     	return 0;
     err:
     	mutex_unlock(&selinux_state.policy_mutex);
    @@ -390,13 +376,8 @@ err:
     
     static int sel_release_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = filp->private_data;
     
    -	BUG_ON(!plm);
    -
    -	fsi->policy_opened = 0;
    -
     	vfree(plm->data);
     	kfree(plm);
     
    -- 
    cgit 1.3-korg
    
    
    
714362f3779d

selinux: allow multiple opens of /sys/fs/selinux/policy

1 file changed · +4 24
  • security/selinux/selinuxfs.c+4 24 modified
    diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
    index e11da5461810c..35aa25b03852c 100644
    --- a/security/selinux/selinuxfs.c
    +++ b/security/selinux/selinuxfs.c
    @@ -76,7 +76,6 @@ struct selinux_fs_info {
     	int *bool_pending_values;
     	struct dentry *class_dir;
     	unsigned long last_class_ino;
    -	bool policy_opened;
     	unsigned long last_ino;
     	struct super_block *sb;
     };
    @@ -340,44 +339,31 @@ struct policy_load_memory {
     
     static int sel_open_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = NULL;
     	int rc;
     
    -	BUG_ON(filp->private_data);
    -
    -	mutex_lock(&selinux_state.policy_mutex);
    -
     	rc = avc_has_perm(current_sid(), SECINITSID_SECURITY,
     			  SECCLASS_SECURITY, SECURITY__READ_POLICY, NULL);
     	if (rc)
    -		goto err;
    -
    -	rc = -EBUSY;
    -	if (fsi->policy_opened)
    -		goto err;
    +		return rc;
     
    -	rc = -ENOMEM;
     	plm = kzalloc_obj(*plm);
     	if (!plm)
    -		goto err;
    +		return -ENOMEM;
     
    +	mutex_lock(&selinux_state.policy_mutex);
     	rc = security_read_policy(&plm->data, &plm->len);
     	if (rc)
     		goto err;
    -
     	if ((size_t)i_size_read(inode) != plm->len) {
     		inode_lock(inode);
     		i_size_write(inode, plm->len);
     		inode_unlock(inode);
     	}
    -
    -	fsi->policy_opened = 1;
    +	mutex_unlock(&selinux_state.policy_mutex);
     
     	filp->private_data = plm;
     
    -	mutex_unlock(&selinux_state.policy_mutex);
    -
     	return 0;
     err:
     	mutex_unlock(&selinux_state.policy_mutex);
    @@ -390,13 +376,8 @@ err:
     
     static int sel_release_policy(struct inode *inode, struct file *filp)
     {
    -	struct selinux_fs_info *fsi = inode->i_sb->s_fs_info;
     	struct policy_load_memory *plm = filp->private_data;
     
    -	BUG_ON(!plm);
    -
    -	fsi->policy_opened = 0;
    -
     	vfree(plm->data);
     	kfree(plm);
     
    -- 
    cgit 1.3-korg
    
    
    

Vulnerability mechanics

Root cause

"The selinuxfs policy file previously only allowed a single process to open it at a time, enabling any process to block others."

Attack vector

Any process can open the `/sys/fs/selinux/policy` file. Previously, if a process held the file open, other processes attempting to open it would be denied access. This allowed any process to prevent other processes from reading the kernel policy.

Affected code

The vulnerability lies within the `sel_open_policy` and `sel_release_policy` functions in `security/selinux/selinuxfs.c`. The `policy_opened` flag, which enforced single access, has been removed from the `selinux_fs_info` structure.

What the fix does

The patch removes the `policy_opened` flag and shortens the critical section protected by the policy mutex. This change allows multiple processes to open `/sys/fs/selinux/policy` concurrently, resolving the issue where one process could block all others from accessing the kernel policy. Extraneous BUG_ON checks were also removed.

Preconditions

  • configSELinux must be enabled in the kernel.

Generated on Jun 8, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

2

News mentions

1