[PATCH 4/5] selinux: Enhance selinux to always ignore private inodes.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric W. Biederman
Date: Thursday, February 8, 2007 - 4:02 pm

From: Stephen Smalley <sds@tycho.nsa.gov>

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 <ebiederm@xmission.com>

---
 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;
 
-- 

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] sysctl selinux: Don't look at table-&gt;de, Eric W. Biederman, (Sun Jan 28, 12:21 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Stephen Smalley, (Mon Jan 29, 6:04 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, James Morris, (Mon Jan 29, 8:23 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Eric W. Biederman, (Mon Jan 29, 10:43 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Eric W. Biederman, (Mon Jan 29, 10:55 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Stephen Smalley, (Mon Jan 29, 11:43 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Casey Schaufler, (Mon Jan 29, 12:08 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Eric W. Biederman, (Mon Jan 29, 12:16 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Stephen Smalley, (Mon Jan 29, 12:26 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Stephen Smalley, (Mon Jan 29, 1:07 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Russell Coker, (Mon Jan 29, 4:28 pm)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Christoph Hellwig, (Tue Jan 30, 3:25 am)
Re: [PATCH] sysctl selinux: Don't look at table-&gt;de, Casey Schaufler, (Tue Jan 30, 10:19 am)
Re: [PATCH 2/2] sysctl: Restore the selinux path based lab ..., Eric W. Biederman, (Thu Feb 8, 10:53 am)
[PATCH 0/5] sysctl cleanup selinux fixes, Eric W. Biederman, (Thu Feb 8, 3:51 pm)
[PATCH 1/5] sysctl: Remove declaration of nonexistent sys ..., Eric W. Biederman, (Thu Feb 8, 3:53 pm)
[PATCH 3/5] sysctl: Fix the selinux_sysctl_get_sid, Eric W. Biederman, (Thu Feb 8, 3:55 pm)
[PATCH 4/5] selinux: Enhance selinux to always ignore priv ..., Eric W. Biederman, (Thu Feb 8, 4:02 pm)
[PATCH 5/5] sysctl: Hide the sysctl proc inodes from selinux., Eric W. Biederman, (Thu Feb 8, 4:04 pm)
Re: [PATCH 0/5] sysctl cleanup selinux fixes, Andrew Morton, (Fri Feb 9, 4:05 am)
Re: [PATCH 3/5] sysctl: Fix the selinux_sysctl_get_sid, Stephen Smalley, (Fri Feb 9, 5:24 am)
Re: [PATCH 0/5] sysctl cleanup selinux fixes, Eric W. Biederman, (Fri Feb 9, 11:09 am)