Re: [RFC][PATCH] security/selinux: Simplify proc inode to securitylabel mapping.

From: James Morris
Date: Wed Nov 25 2009 - 03:42:14 EST


On Fri, 20 Nov 2009, Eric W. Biederman wrote:

>
> Currently selinux has incestuous knowledge of the implementation details
> of procfs and sysctl that it uses to get a pathname from an inode. As it
> happens the point we care is in the security_d_instantiate lsm hook so
> we have a valid dentry that we can use to get the entire pathname on
> the proc filesystem. With the recent change to sys_sysctl to go through
> proc/sys all proc and sysctl accesses go through the vfs, which
> means we no longer need a sysctl special case.
>
> So get the path for the dentry, remove the incestuous knowledge
> and simplify the code.
>
> caveat: Because the dentry may not yet be hashed I think dentry_path will
> append (deleted) and thus is not the right function to call.

This seems to break labeling. Prior to this patch, I see:


# ls -lZ /proc/1/net/rpc/nfsd.fh
-rw-------. root root system_u:object_r:sysctl_rpc_t:s0 channel

with the patch:

# ls -lZ /proc/1/net/rpc/nfsd.fh
-rw-------. root root system_u:object_r:proc_t:s0 channel


--
James Morris
<jmorris@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/