Skip to contentSkip to conversation

security: selinux: allow per-file labeling for cgroupfs

PATCH In review Antonio Murdaca 4 participants 6 messages Feb 9, 2017 – Aug 22, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security: selinux: allow per-file labeling for cgroupfs

This patch allows genfscon per-file labeling for cgroupfs. For instance, this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)
security/selinux/hooks.c +2 -0
index 9a8f12f..5a3138e 100644
@@ -808,6 +808,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
 	if (!strcmp(sb->s_type->name, "debugfs") ||
 	    !strcmp(sb->s_type->name, "sysfs") ||
+	    !strcmp(sb->s_type->name, "cgroup") ||
+	    !strcmp(sb->s_type->name, "cgroup2") ||
 	    !strcmp(sb->s_type->name, "pstore"))
 		sbsec->flags |= SE_SBGENFS;
 
Signature · 7 lines
2.9.3

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]
To get help, send an email containing "help" to [email protected]
maintainer
#1 lore raw
Quoted 8 lines · Antonio Murdaca

This patch allows genfscon per-file labeling for cgroupfs. For instance, this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)

Now that the merge window is behind us, let's get this merged, but could you update it to use the selinux_policycap_cgroupseclabel policy capability? See 2651225b5ebcdde ("selinux: wrap cgroup seclabel support with its own policy capability") for more information.

Also, how goes the testing?

Quoted 21 lines
security/selinux/hooks.c +2 -1
index 9a8f12f..5a3138e 100644
@@ -808,6 +808,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
        if (!strcmp(sb->s_type->name, "debugfs") ||
            !strcmp(sb->s_type->name, "sysfs") ||
+           !strcmp(sb->s_type->name, "cgroup") ||
+           !strcmp(sb->s_type->name, "cgroup2") ||
            !strcmp(sb->s_type->name, "pstore"))
                sbsec->flags |= SE_SBGENFS;
 
--

2.9.3

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]
To get help, send an email containing "help" to [email protected]

Signature · 2 lines
paul moore
www.paul-moore.com
#2 lore raw
Quoted 13 lines · Paul Moore

On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <[email protected]

Quoted 11 lines

wrote:

This patch allows genfscon per-file labeling for cgroupfs. For instance,
this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++

 1 file changed, 2 insertions(+)
Quoted 5 lines

Now that the merge window is behind us, let's get this merged, but could you update it to use the selinux_policycap_cgroupseclabel policy
capability?  See 2651225b5ebcdde ("selinux: wrap cgroup seclabel support with its own policy capability") for more information.

I don't think that is necessary.  This change unlike the other one should not yield any difference in behavior with existing policy; it just allows one to specify fine-grained labeling for cgroup nodes in future policy.  It doesn't affect any userspace interface.

Quoted 27 lines

Also, how goes the testing?

Quoted 24 lines
security/selinux/hooks.c +0 -0
index 9a8f12f..5a3138e 100644
@@ -808,6 +808,8 @@ static int selinux_set_mnt_opts(struct
 super_block *sb,
 

        if (!strcmp(sb->s_type->name, "debugfs") ||

            !strcmp(sb->s_type->name, "sysfs") ||
+           !strcmp(sb->s_type->name, "cgroup") ||
+           !strcmp(sb->s_type->name, "cgroup2") ||

            !strcmp(sb->s_type->name, "pstore"))
                sbsec->flags |= SE_SBGENFS;

--
2.9.3

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected]. To get help, send an email containing "help" to Selinux-request@tyc ho.nsa.gov.

maintainer
#3 lore raw
Quoted 20 lines · Stephen Smalley
Quoted 13 lines · Paul Moore

On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <[email protected]

Quoted 11 lines

wrote:

This patch allows genfscon per-file labeling for cgroupfs. For instance,
this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

Now that the merge window is behind us, let's get this merged, but could you update it to use the selinux_policycap_cgroupseclabel policy
capability? See 2651225b5ebcdde ("selinux: wrap cgroup seclabel support with its own policy capability") for more information.

Quoted 4 lines

I don't think that is necessary. This change unlike the other one should not yield any difference in behavior with existing policy; it just allows one to specify fine-grained labeling for cgroup nodes in future policy. It doesn't affect any userspace interface.

Yes, I thought about that, and if the policy capability was already present in a released kernel then I wouldn't worry about it much, but since the policy capability still only lives in the v4.11-rcX kernels I'd prefer to see this code wrapped with the policy capability ... even if all it really does is give me that warm fuzzy feeling.

Quoted 27 lines
Quoted 27 lines

Also, how goes the testing?

Quoted 24 lines
security/selinux/hooks.c +2 -1
index 9a8f12f..5a3138e 100644
@@ -808,6 +808,8 @@ static int selinux_set_mnt_opts(struct
 super_block *sb,
 
        if (!strcmp(sb->s_type->name, "debugfs") ||
            !strcmp(sb->s_type->name, "sysfs") ||
+           !strcmp(sb->s_type->name, "cgroup") ||
+           !strcmp(sb->s_type->name, "cgroup2") ||
            !strcmp(sb->s_type->name, "pstore"))
                sbsec->flags |= SE_SBGENFS;
 
--

2.9.3

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected] To get help, send an email containing "help" to Selinux-request@tyc ho.nsa.gov.

Signature · 2 lines
paul moore
www.paul-moore.com
maintainer
#4 lore raw
Quoted 26 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 13 lines · Paul Moore

On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <[email protected]

Quoted 11 lines

wrote:

This patch allows genfscon per-file labeling for cgroupfs. For instance,
this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

Now that the merge window is behind us, let's get this merged, but could you update it to use the selinux_policycap_cgroupseclabel policy
capability? See 2651225b5ebcdde ("selinux: wrap cgroup seclabel support with its own policy capability") for more information.

Quoted 4 lines

I don't think that is necessary. This change unlike the other one should not yield any difference in behavior with existing policy; it just allows one to specify fine-grained labeling for cgroup nodes in future policy. It doesn't affect any userspace interface.

Quoted 5 lines

Yes, I thought about that, and if the policy capability was already present in a released kernel then I wouldn't worry about it much, but since the policy capability still only lives in the v4.11-rcX kernels I'd prefer to see this code wrapped with the policy capability ... even if all it really does is give me that warm fuzzy feeling.

FWIW, I just decided I didn't care that much about the policy capability restriction for this patch and went ahead and merged it into selinux/next.

Signature · 2 lines
paul moore
www.paul-moore.com

A message that is not in the archive (sent off-list or not yet received): CAHC9VhRiTnsPNoPZNi2aAQfN4va3Kg81QZgxoed6S-8iAFFvPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Thanks

Quoted 42 lines · Paul Moore
Quoted 1 line · Paul Moore

On Fri, Mar 10, 2017 at 3:17 PM, Stephen Smalley <[email protected]>

Quoted 25 lines · wrote:
Quoted 20 lines · Paul Moore
Quoted 13 lines

On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <[email protected]

Quoted 11 lines

wrote:

This patch allows genfscon per-file labeling for cgroupfs. For instance,
this allows to label the "release_agent" file within each cgroup mount and limit writes to it.

---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

Now that the merge window is behind us, let's get this merged, but could you update it to use the selinux_policycap_cgroupseclabel policy
capability? See 2651225b5ebcdde ("selinux: wrap cgroup seclabel support with its own policy capability") for more information.

Quoted 4 lines

I don't think that is necessary. This change unlike the other one should not yield any difference in behavior with existing policy; it just allows one to specify fine-grained labeling for cgroup nodes in future policy. It doesn't affect any userspace interface.

Quoted 5 lines

Yes, I thought about that, and if the policy capability was already present in a released kernel then I wouldn't worry about it much, but since the policy capability still only lives in the v4.11-rcX kernels I'd prefer to see this code wrapped with the policy capability ... even if all it really does is give me that warm fuzzy feeling.

FWIW, I just decided I didn't care that much about the policy capability restriction for this patch and went ahead and merged it into selinux/next.

--
paul moore
www.paul-moore.com