From: Stephen Smalley <[email protected]> Hmmm...turns out to not be quite enough, as the /proc/sys inodes aren't truly private to the fs, so we can run into them in a variety of security hooks beyond just the inode hooks, such as security_file_permission (when reading and writing them via the vfs helpers), security_sb_mount (when mounting other filesystems on directories in proc like binfmt_misc), and deeper within the security module itself (as in flush_unauthorized_files upon inheritance across execve). So I think we have to add an IS_PRIVATE() guard within SELinux, as below. Note however that the use of the private flag here could be confusing, as these inodes are _not_ private to the fs, are exposed to userspace, and security modules must implement the sysctl hook to get any access control over them. Signed-off-by: Eric W. Biederman <[email protected]> --- security/selinux/hooks.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index de16b9f..ff9fccc 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1077,6 +1077,9 @@ static int inode_has_perm(struct task_struct *tsk, struct inode_security_struct *isec; struct avc_audit_data ad; + if (unlikely (IS_PRIVATE (inode))) + return 0; + tsec = tsk->security; isec = inode->i_security; -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 4/5] selinux: Enhance selinux to always ignore private inodes.
- From: Stephen Smalley <[email protected]>
- [PATCH 5/5] sysctl: Hide the sysctl proc inodes from selinux.
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH 4/5] selinux: Enhance selinux to always ignore private inodes.
- References:
- [PATCH] sysctl selinux: Don't look at table->de
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH] sysctl selinux: Don't look at table->de
- From: Stephen Smalley <[email protected]>
- [PATCH 1/2] sysctl: Add a parent entry to ctl_table and set the parent entry.
- From: [email protected] (Eric W. Biederman)
- [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: Stephen Smalley <[email protected]>
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: Stephen Smalley <[email protected]>
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: Stephen Smalley <[email protected]>
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: [email protected] (Eric W. Biederman)
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: Stephen Smalley <[email protected]>
- Re: [PATCH 2/2] sysctl: Restore the selinux path based label lookup for sysctls.
- From: [email protected] (Eric W. Biederman)
- [PATCH 0/5] sysctl cleanup selinux fixes
- From: [email protected] (Eric W. Biederman)
- [PATCH 1/5] sysctl: Remove declaration of nonexistent sysctl_init()
- From: [email protected] (Eric W. Biederman)
- [PATCH 2/5] sysctl: Set the parent field in the root sysctl table
- From: [email protected] (Eric W. Biederman)
- [PATCH 3/5] sysctl: Fix the selinux_sysctl_get_sid
- From: [email protected] (Eric W. Biederman)
- [PATCH] sysctl selinux: Don't look at table->de
- Prev by Date: Re: The who needs reviews anyways [PATCH]
- Next by Date: Re: [patch 1/3] fs: add an iovec iterator
- Previous by thread: [PATCH 3/5] sysctl: Fix the selinux_sysctl_get_sid
- Next by thread: [PATCH 5/5] sysctl: Hide the sysctl proc inodes from selinux.
- Index(es):