Skip to content

Commit

Permalink
[PATCH] selinux: enhance selinux to always ignore private inodes
Browse files Browse the repository at this point in the history
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]>
Signed-off-by: Stephen Smalley <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
stephensmalley authored and Linus Torvalds committed Feb 14, 2007
1 parent b599fdf commit bbaca6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit bbaca6c

Please sign in to comment.