Skip to contentSkip to conversation

RFC: kernel_t exec rights on cgroup_t files

refpolicy aranea at aixah.de 2 participants 8 messages Feb 12, 2013 – Feb 15, 2013

lore
Share & tools
lore
#0 lore raw

Hi, I made a mistake while debugging.

allow kernel_t cgroup_t:file exec_file_perms;
allow kernel_t cgroup_t:dir list_dir_perms;

(which I originally tried) doesn't solve the problem, and neither does the proposed

dontaudit kernel_t cgroup_t:file execute;
allow kernel_t cgroup_t:file audit_access;

Regards,
Luis Ressel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20130212/fdc465a5/attachment.bin

#1 lore raw
Quoted 9 lines · aranea at aixah.de

Hi, I made a mistake while debugging.

allow kernel_t cgroup_t:file exec_file_perms;
allow kernel_t cgroup_t:dir list_dir_perms;

(which I originally tried) doesn't solve the problem, and neither does the proposed

So what does solve the problem and what AVC denials are you seeing? (can you enclose the AVC denials?)

Quoted 10 lines

dontaudit kernel_t cgroup_t:file execute;
allow kernel_t cgroup_t:file audit_access;

Regards,
Luis Ressel
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

#2 lore raw
Quoted 7 lines · On Tue, 12 Feb 2013 21:34:59 +0100 Dominick Grift <[email protected]>…
Quoted 6 lines · aranea at aixah.de

Hi, I made a mistake while debugging.

allow kernel_t cgroup_t:file exec_file_perms;
allow kernel_t cgroup_t:dir list_dir_perms;

Quoted 7 lines
Quoted 3 lines

(which I originally tried) doesn't solve the problem, and neither does the proposed

So what does solve the problem and what AVC denials are you seeing? (can you enclose the AVC denials?)

I haven't solved the problem until now. The errors which the OP mentioned appear in a early boot phase, most probably while executing this script:

        local agent="/lib64/rc/sh/cgroup-release-agent.sh"
        mkdir /sys/fs/cgroup/openrc
        mount -n -t cgroup \
                -o none,nodev,noexec,nosuid,name=openrc,release_agent="$agent" \
		openrc /sys/fs/cgroup/openrc echo 1 > /sys/fs/cgroup/openrc/notify_on_release

The problem is that there are no denial messages, even if I disable the dontaudit rules. But I'm absolutely sure SELinux is causing the problem, as everything works in permissive mode.

Regards, Luis Ressel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20130212/d94af650/attachment.bin

#3 lore raw
Quoted 4 lines · aranea at aixah.de

The problem is that there are no denial messages, even if I disable the dontaudit rules. But I'm absolutely sure SELinux is causing the problem, as everything works in permissive mode.

Did you also look for them in dmesg? But yes with these early boot things logging may be an issue.

Kind of hard to troubleshoot without any AVC denials

Is that script in initramfs? Maybe there is a way for whatever runs it to be more verbose.

Quoted 6 lines

Regards, Luis Ressel
_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

#4 lore raw
Quoted 7 lines · On Tue, 12 Feb 2013 22:12:54 +0100 Dominick Grift <[email protected]>…
Quoted 5 lines · aranea at aixah.de

The problem is that there are no denial messages, even if I disable the dontaudit rules. But I'm absolutely sure SELinux is causing the problem, as everything works in permissive mode.

Quoted 7 lines

Did you also look for them in dmesg? But yes with these early boot things logging may be an issue.

Kind of hard to troubleshoot without any AVC denials

Is that script in initramfs? Maybe there is a way for whatever runs it to be more verbose.

No, it isn't in an initramfs. It's part of OpenRC (Gentoo Linux' default init system) and is located on the root partition.

Also I know logging theoretically works at the point it runs, as the
first logged avc denials (dontaudit ones) start 5 secs after booting
and these errors occur at 7 secs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20130212/084dc84c/attachment.bin

#5 lore raw

Here's another interesting thing: The file in question (/sys/fs/cgroup/openrc/notify_on_release) does not even exist! In fact, this directory doesn't include any files (but some directories) when booting in enforcing mode.

In permissive mode however, there are some files (cgroup.clone_children, cgroup.event_control, cgroup.procs, notify_on_release, release_agent, tasks) there.

This could mean that the error messages at 7 secs are only reactions to something which happens even earlier, when there's really no logging
taking place.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20130212/6f638489/attachment.bin

#6 lore raw
Quoted 5 lines · On Tue, 12 Feb 2013 22:32:07 +0100 <[email protected]> wrote:

Here's another interesting thing: The file in question (/sys/fs/cgroup/openrc/notify_on_release) does not even exist! In fact, this directory doesn't include any files (but some directories) when booting in enforcing mode.

Quoted 7 lines

In permissive mode however, there are some files (cgroup.clone_children, cgroup.event_control, cgroup.procs, notify_on_release, release_agent, tasks) there.

This could mean that the error messages at 7 secs are only reactions to something which happens even earlier, when there's really no logging taking place.

Sorry, looks like I had one of these attacks of extreme dumbness you sometimes have when the uptime is > 10h. Clearly these files don't exist, as that's exactly what the error messages are complaining
about: It was for some reason not possible to create them.

I'll continue to debug this tommorow.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20130212/d30ff030/attachment-0001.bin