Skip to content

Commit 36ea735

Browse files
committed
Smack: Label cgroup files for systemd
The cgroup filesystem isn't ready for an LSM to properly use extented attributes. This patch makes files created in the cgroup filesystem usable by a system running Smack and systemd. Targeted for git://git.gitorious.org/smack-next/kernel.git Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
1 parent a6834c0 commit 36ea735

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

‎security/smack/smack_lsm.c‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,6 +2821,15 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
28212821
* of the superblock.
28222822
*/
28232823
if (opt_dentry->d_parent == opt_dentry) {
2824+
if (sbp->s_magic == CGROUP_SUPER_MAGIC) {
2825+
/*
2826+
* The cgroup filesystem is never mounted,
2827+
* so there's no opportunity to set the mount
2828+
* options.
2829+
*/
2830+
sbsp->smk_root = smack_known_star.smk_known;
2831+
sbsp->smk_default = smack_known_star.smk_known;
2832+
}
28242833
isp->smk_inode = sbsp->smk_root;
28252834
isp->smk_flags |= SMK_INODE_INSTANT;
28262835
goto unlockandout;
@@ -2834,16 +2843,20 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
28342843
*/
28352844
switch (sbp->s_magic) {
28362845
case SMACK_MAGIC:
2846+
case PIPEFS_MAGIC:
2847+
case SOCKFS_MAGIC:
2848+
case CGROUP_SUPER_MAGIC:
28372849
/*
28382850
* Casey says that it's a little embarrassing
28392851
* that the smack file system doesn't do
28402852
* extended attributes.
2841-
*/
2842-
final = smack_known_star.smk_known;
2843-
break;
2844-
case PIPEFS_MAGIC:
2845-
/*
2853+
*
28462854
* Casey says pipes are easy (?)
2855+
*
2856+
* Socket access is controlled by the socket
2857+
* structures associated with the task involved.
2858+
*
2859+
* Cgroupfs is special
28472860
*/
28482861
final = smack_known_star.smk_known;
28492862
break;
@@ -2855,13 +2868,6 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
28552868
*/
28562869
final = ckp->smk_known;
28572870
break;
2858-
case SOCKFS_MAGIC:
2859-
/*
2860-
* Socket access is controlled by the socket
2861-
* structures associated with the task involved.
2862-
*/
2863-
final = smack_known_star.smk_known;
2864-
break;
28652871
case PROC_SUPER_MAGIC:
28662872
/*
28672873
* Casey says procfs appears not to care.

0 commit comments

Comments
 (0)