]> git.hungrycats.org Git - linux/commitdiff
selinux: use default proc sid on symlinks
authorStephen Smalley <sds@tycho.nsa.gov>
Mon, 22 Sep 2008 19:41:19 +0000 (15:41 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Aug 2010 23:40:12 +0000 (16:40 -0700)
commit ea6b184f7d521a503ecab71feca6e4057562252b upstream.

As we are not concerned with fine-grained control over reading of
symlinks in proc, always use the default proc SID for all proc symlinks.
This should help avoid permission issues upon changes to the proc tree
as in the /proc/net -> /proc/self/net example.
This does not alter labeling of symlinks within /proc/pid directories.
ls -Zd /proc/net output before and after the patch should show the difference.

Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@namei.org>
Cc: Florian Mickler <florian@mickler.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
security/selinux/hooks.c

index e2d25da181fa75c5c54c62fe3bc15950a56cce2a..750cb17d50bd57f2d6eefa7c6f53bc1f493ac3c1 100644 (file)
@@ -1290,7 +1290,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
                /* Default to the fs superblock SID. */
                isec->sid = sbsec->sid;
 
-               if (sbsec->proc) {
+               if (sbsec->proc && !S_ISLNK(inode->i_mode)) {
                        struct proc_inode *proci = PROC_I(inode);
                        if (proci->pde) {
                                isec->sclass = inode_mode_to_security_class(inode->i_mode);