linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] security: selinux: allow per-file labeling for cgroupfs
@ 2017-02-09 15:58 Antonio Murdaca
  2017-03-10 20:01 ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Antonio Murdaca @ 2017-02-09 15:58 UTC (permalink / raw)
  To: selinux; +Cc: gary.tierney, linux-kernel, dwalsh, pmoore, vgoyal, cgroups

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.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9a8f12f..5a3138e 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-02-09 15:58 [PATCH] security: selinux: allow per-file labeling for cgroupfs Antonio Murdaca
@ 2017-03-10 20:01 ` Paul Moore
  2017-03-10 20:17   ` Stephen Smalley
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2017-03-10 20:01 UTC (permalink / raw)
  To: Antonio Murdaca; +Cc: selinux, linux-kernel, cgroups, vgoyal

On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <amurdaca@redhat.com> 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.
>
> Signed-off-by: Antonio Murdaca <runcom@redhat.com>
> ---
>  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?

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 9a8f12f..5a3138e 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -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
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-03-10 20:01 ` Paul Moore
@ 2017-03-10 20:17   ` Stephen Smalley
  2017-03-10 20:21     ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Smalley @ 2017-03-10 20:17 UTC (permalink / raw)
  To: Paul Moore, Antonio Murdaca; +Cc: cgroups, linux-kernel, selinux, vgoyal

On Fri, 2017-03-10 at 15:01 -0500, Paul Moore wrote:
> On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <amurdaca@redhat.com
> > 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.
> > 
> > Signed-off-by: Antonio Murdaca <runcom@redhat.com>
> > ---
> >  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.

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.


> Also, how goes the testing?
> 
> > 
> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> > index 9a8f12f..5a3138e 100644
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -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
> > Selinux@tycho.nsa.gov
> > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> > To get help, send an email containing "help" to Selinux-request@tyc
> > ho.nsa.gov.
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-03-10 20:17   ` Stephen Smalley
@ 2017-03-10 20:21     ` Paul Moore
  2017-08-22 19:47       ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2017-03-10 20:21 UTC (permalink / raw)
  To: Stephen Smalley, Antonio Murdaca; +Cc: cgroups, linux-kernel, selinux, vgoyal

On Fri, Mar 10, 2017 at 3:17 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On Fri, 2017-03-10 at 15:01 -0500, Paul Moore wrote:
>> On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <amurdaca@redhat.com
>> > 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.
>> >
>> > Signed-off-by: Antonio Murdaca <runcom@redhat.com>
>> > ---
>> >  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.
>
> 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.

>> Also, how goes the testing?
>>
>> >
>> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
>> > index 9a8f12f..5a3138e 100644
>> > --- a/security/selinux/hooks.c
>> > +++ b/security/selinux/hooks.c
>> > @@ -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
>> > Selinux@tycho.nsa.gov
>> > To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
>> > To get help, send an email containing "help" to Selinux-request@tyc
>> > ho.nsa.gov.
>>



-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-03-10 20:21     ` Paul Moore
@ 2017-08-22 19:47       ` Paul Moore
  0 siblings, 0 replies; 10+ messages in thread
From: Paul Moore @ 2017-08-22 19:47 UTC (permalink / raw)
  To: Stephen Smalley, Antonio Murdaca; +Cc: cgroups, linux-kernel, selinux, vgoyal

On Fri, Mar 10, 2017 at 3:21 PM, Paul Moore <paul@paul-moore.com> wrote:
> On Fri, Mar 10, 2017 at 3:17 PM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> On Fri, 2017-03-10 at 15:01 -0500, Paul Moore wrote:
>>> On Thu, Feb 9, 2017 at 10:58 AM, Antonio Murdaca <amurdaca@redhat.com
>>> > 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.
>>> >
>>> > Signed-off-by: Antonio Murdaca <runcom@redhat.com>
>>> > ---
>>> >  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.
>>
>> 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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-02-09 23:04         ` Paul Moore
@ 2017-02-10 23:05           ` Daniel J Walsh
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel J Walsh @ 2017-02-10 23:05 UTC (permalink / raw)
  To: Paul Moore, Antonio Murdaca
  Cc: linux-kernel, cgroups, Antonio Murdaca, selinux, Vivek Goyal



On 02/09/2017 06:04 PM, Paul Moore wrote:
> On Thu, Feb 9, 2017 at 5:32 PM, Antonio Murdaca <amurdaca@redhat.com> wrote:
>>
>> On Feb 9, 2017 20:23, "Paul Moore" <paul@paul-moore.com> wrote:
>>
>> On Thu, Feb 9, 2017 at 12:39 PM, Antonio Murdaca <amurdaca@redhat.com>
>> wrote:
>>> On Feb 9, 2017 17:14, "Paul Moore" <paul@paul-moore.com> wrote:
>>> On Thu, Feb 9, 2017 at 11:02 AM, Antonio Murdaca <amurdaca@redhat.com>
>>> wrote:
>>>> From: Antonio Murdaca <runcom@redhat.com>
>>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
>>>> ---
>>>>  security/selinux/hooks.c | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>> This was already merged ... ?
>>>
>>>
>>> This is adding cgroup and cgroup2 to the other whitelist (afaict).
>> Yes, my apologies, I read this patch too quickly and confused it with
>> the previous cgroups patch.
>>
>> Just to set expectations, this patch is too late for the upcoming
>> merge window, we can consider it in a few weeks once the merge window
>> has closed.  This should give you some time to do some further testing
>> (hint, hint).
>>
>>
>> Sure, I'm going to test this and add tests in selinux-testsuite as well
> Great, thank you.
>
No problem on waiting for this patch.  Stephen asked for this, but this is
not something we are currently planning on using with containers.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
       [not found]       ` <CALKLTGTjpBYd5-M9RiO-Q4H_SokEiPJYptbxktg_aPccws59Jw@mail.gmail.com>
@ 2017-02-09 23:04         ` Paul Moore
  2017-02-10 23:05           ` Daniel J Walsh
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2017-02-09 23:04 UTC (permalink / raw)
  To: Antonio Murdaca
  Cc: selinux, Antonio Murdaca, Vivek Goyal, linux-kernel, cgroups

On Thu, Feb 9, 2017 at 5:32 PM, Antonio Murdaca <amurdaca@redhat.com> wrote:
>
>
> On Feb 9, 2017 20:23, "Paul Moore" <paul@paul-moore.com> wrote:
>
> On Thu, Feb 9, 2017 at 12:39 PM, Antonio Murdaca <amurdaca@redhat.com>
> wrote:
>> On Feb 9, 2017 17:14, "Paul Moore" <paul@paul-moore.com> wrote:
>> On Thu, Feb 9, 2017 at 11:02 AM, Antonio Murdaca <amurdaca@redhat.com>
>> wrote:
>>> From: Antonio Murdaca <runcom@redhat.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
>>> ---
>>>  security/selinux/hooks.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>
>> This was already merged ... ?
>>
>>
>> This is adding cgroup and cgroup2 to the other whitelist (afaict).
>
> Yes, my apologies, I read this patch too quickly and confused it with
> the previous cgroups patch.
>
> Just to set expectations, this patch is too late for the upcoming
> merge window, we can consider it in a few weeks once the merge window
> has closed.  This should give you some time to do some further testing
> (hint, hint).
>
>
> Sure, I'm going to test this and add tests in selinux-testsuite as well

Great, thank you.

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
       [not found]   ` <CALKLTGTc7U7ohxd44MHOuzVomW-oUsumqUqr0MKaUohw1NpSsg@mail.gmail.com>
@ 2017-02-09 19:23     ` Paul Moore
       [not found]       ` <CALKLTGTjpBYd5-M9RiO-Q4H_SokEiPJYptbxktg_aPccws59Jw@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2017-02-09 19:23 UTC (permalink / raw)
  To: Antonio Murdaca
  Cc: Vivek Goyal, Antonio Murdaca, selinux, linux-kernel, cgroups

On Thu, Feb 9, 2017 at 12:39 PM, Antonio Murdaca <amurdaca@redhat.com> wrote:
> On Feb 9, 2017 17:14, "Paul Moore" <paul@paul-moore.com> wrote:
> On Thu, Feb 9, 2017 at 11:02 AM, Antonio Murdaca <amurdaca@redhat.com>
> wrote:
>> From: Antonio Murdaca <runcom@redhat.com>
>>
>> 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.
>>
>> Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
>> ---
>>  security/selinux/hooks.c | 2 ++
>>  1 file changed, 2 insertions(+)
>
> This was already merged ... ?
>
>
> This is adding cgroup and cgroup2 to the other whitelist (afaict).

Yes, my apologies, I read this patch too quickly and confused it with
the previous cgroups patch.

Just to set expectations, this patch is too late for the upcoming
merge window, we can consider it in a few weeks once the merge window
has closed.  This should give you some time to do some further testing
(hint, hint).

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] security: selinux: allow per-file labeling for cgroupfs
  2017-02-09 16:02 Antonio Murdaca
@ 2017-02-09 16:14 ` Paul Moore
       [not found]   ` <CALKLTGTc7U7ohxd44MHOuzVomW-oUsumqUqr0MKaUohw1NpSsg@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Moore @ 2017-02-09 16:14 UTC (permalink / raw)
  To: Antonio Murdaca; +Cc: selinux, Antonio Murdaca, linux-kernel, cgroups, vgoyal

On Thu, Feb 9, 2017 at 11:02 AM, Antonio Murdaca <amurdaca@redhat.com> wrote:
> From: Antonio Murdaca <runcom@redhat.com>
>
> 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.
>
> Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
> ---
>  security/selinux/hooks.c | 2 ++
>  1 file changed, 2 insertions(+)

This was already merged ... ?

* https://marc.info/?l=selinux&m=148652458620202&w=2

> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index 9a8f12f..5a3138e 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -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

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] security: selinux: allow per-file labeling for cgroupfs
@ 2017-02-09 16:02 Antonio Murdaca
  2017-02-09 16:14 ` Paul Moore
  0 siblings, 1 reply; 10+ messages in thread
From: Antonio Murdaca @ 2017-02-09 16:02 UTC (permalink / raw)
  To: selinux
  Cc: gary.tierney, linux-kernel, dwalsh, pmoore, vgoyal, cgroups,
	Antonio Murdaca

From: Antonio Murdaca <runcom@redhat.com>

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.

Signed-off-by: Antonio Murdaca <amurdaca@redhat.com>
---
 security/selinux/hooks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9a8f12f..5a3138e 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-08-22 19:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-09 15:58 [PATCH] security: selinux: allow per-file labeling for cgroupfs Antonio Murdaca
2017-03-10 20:01 ` Paul Moore
2017-03-10 20:17   ` Stephen Smalley
2017-03-10 20:21     ` Paul Moore
2017-08-22 19:47       ` Paul Moore
2017-02-09 16:02 Antonio Murdaca
2017-02-09 16:14 ` Paul Moore
     [not found]   ` <CALKLTGTc7U7ohxd44MHOuzVomW-oUsumqUqr0MKaUohw1NpSsg@mail.gmail.com>
2017-02-09 19:23     ` Paul Moore
     [not found]       ` <CALKLTGTjpBYd5-M9RiO-Q4H_SokEiPJYptbxktg_aPccws59Jw@mail.gmail.com>
2017-02-09 23:04         ` Paul Moore
2017-02-10 23:05           ` Daniel J Walsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).