1 From: Casey Schaufler <casey@schaufler-ca.com>
2 Date: Thu, 21 Nov 2013 10:55:10 +0200
3 Subject: Smack: Cgroup filesystem access
5 The cgroup filesystems are not mounted using conventional
6 mechanisms. This prevents the use of mount options to
7 set Smack attributes. This patch makes the behavior
8 of cgroup filesystems compatable with the way systemd
11 Change-Id: I1e0429f133db9e14117dc754d682dec08221354c
12 Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
13 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
15 security/smack/smack_lsm.c | 30 ++++++++++++++++++------------
16 1 file changed, 18 insertions(+), 12 deletions(-)
18 diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
19 index 14f52be..acd8574 100644
20 --- a/security/smack/smack_lsm.c
21 +++ b/security/smack/smack_lsm.c
22 @@ -2713,6 +2713,15 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
25 if (opt_dentry->d_parent == opt_dentry) {
26 + if (sbp->s_magic == CGROUP_SUPER_MAGIC) {
28 + * The cgroup filesystem is never mounted,
29 + * so there's no opportunity to set the mount
32 + sbsp->smk_root = smack_known_star.smk_known;
33 + sbsp->smk_default = smack_known_star.smk_known;
35 isp->smk_inode = sbsp->smk_root;
36 isp->smk_flags |= SMK_INODE_INSTANT;
38 @@ -2726,16 +2735,20 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
40 switch (sbp->s_magic) {
44 + case CGROUP_SUPER_MAGIC:
46 * Casey says that it's a little embarrassing
47 * that the smack file system doesn't do
48 * extended attributes.
50 - final = smack_known_star.smk_known;
55 * Casey says pipes are easy (?)
57 + * Socket access is controlled by the socket
58 + * structures associated with the task involved.
60 + * Cgroupfs is special
62 final = smack_known_star.smk_known;
64 @@ -2747,13 +2760,6 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
66 final = ckp->smk_known;
70 - * Socket access is controlled by the socket
71 - * structures associated with the task involved.
73 - final = smack_known_star.smk_known;
75 case PROC_SUPER_MAGIC:
77 * Casey says procfs appears not to care.