Bug 1189382

Summary: SELinux is preventing /usr/bin/systemctl from using the 'sys_resource' capabilities.
Product: [Fedora] Fedora Reporter: Berend De Schouwer <berend.de.schouwer>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: coffeekingms, dominick.grift, dwalsh, HolyMaster, iorlov89, jmpmcmanus, lvrabec, mgrepl, plautrba, rhbugzilla
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:b5a2fa74b84ec70b67ac8b915d1041e69a45643e4369f8197cb5a64390cb8d0d
Fixed In Version: selinux-policy-3.13.1-105.10.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-02 08:35:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Berend De Schouwer 2015-02-05 07:41:39 UTC
Description of problem:
This particular one was triggered by a shutdown, but there are similar selinux alerts for systemd/sys_resource
SELinux is preventing /usr/bin/systemctl from using the 'sys_resource' capabilities.

*****  Plugin sys_resource (91.4 confidence) suggests   **********************

If you do not want processes to require capabilities to use up all the system resources on your system;
Then you need to diagnose why your system is running out of system resources and fix the problem.  

According to /usr/include/linux/capability.h, sys_resource is required to:

/* Override resource limits. Set resource limits. */
/* Override quota limits. */
/* Override reserved space on ext2 filesystem */
/* Modify data journaling mode on ext3 filesystem (uses journaling
   resources) */
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
   you can override using fsuid too */
/* Override size restrictions on IPC message queues */
/* Allow more than 64hz interrupts from the real-time clock */
/* Override max number of consoles on console allocation */
/* Override max number of keymaps */
/* Override resource limits. Set resource limits. */
/* Override quota limits. */
/* Override reserved space on ext2 filesystem */
/* Modify data journaling mode on ext3 filesystem (uses journaling
   resources) */
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
   you can override using fsuid too */
/* Override size restrictions on IPC message queues */
/* Allow more than 64hz interrupts from the real-time clock */
/* Override max number of consoles on console allocation */
/* Override max number of keymaps */
/* Override resource limits. Set resource limits. */
/* Override quota limits. */
/* Override reserved space on ext2 filesystem */
/* Modify data journaling mode on ext3 filesystem (uses journaling
   resources) */
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
   you can override using fsuid too */
/* Override size restrictions on IPC message queues */
/* Allow more than 64hz interrupts from the real-time clock */
/* Override max number of consoles on console allocation */
/* Override max number of keymaps */

Do
fix the cause of the SYS_RESOURCE on your system.

*****  Plugin catchall (9.59 confidence) suggests   **************************

If you believe that systemctl should have the sys_resource capability by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep shutdown /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:apmd_t:s0
Target Context                system_u:system_r:apmd_t:s0
Target Objects                Unknown [ capability ]
Source                        shutdown
Source Path                   /usr/bin/systemctl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           systemd-216-17.fc21.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-105.fc21.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.18.3-201.fc21.x86_64 #1 SMP Mon
                              Jan 19 15:59:31 UTC 2015 x86_64 x86_64
Alert Count                   32
First Seen                    2015-01-25 13:19:39 SAST
Last Seen                     2015-02-04 19:15:06 SAST
Local ID                      916c1c28-0f20-4fc6-a893-be9d2d7f8b38

Raw Audit Messages
type=AVC msg=audit(1423070106.455:603): avc:  denied  { sys_resource } for  pid=4470 comm="shutdown" capability=24  scontext=system_u:system_r:apmd_t:s0 tcontext=system_u:system_r:apmd_t:s0 tclass=capability permissive=0


type=SYSCALL msg=audit(1423070106.455:603): arch=x86_64 syscall=setrlimit success=no exit=EPERM a0=7 a1=7fff29a73d50 a2=0 a3=2e42475f6e653d47 items=0 ppid=4450 pid=4470 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=shutdown exe=/usr/bin/systemctl subj=system_u:system_r:apmd_t:s0 key=(null)

Hash: shutdown,apmd_t,apmd_t,capability,sys_resource

Version-Release number of selected component:
selinux-policy-3.13.1-105.fc21.noarch

Additional info:
reporter:       libreport-2.3.0
hashmarkername: setroubleshoot
kernel:         3.18.3-201.fc21.x86_64
type:           libreport

Comment 1 Daniel Walsh 2015-02-05 10:49:59 UTC
7acd472363437a767d7efa572b3a53fdfbfdd930 fixes this in git.

Comment 2 Lukas Vrabec 2015-02-05 11:27:33 UTC
commit 6a06d552496e731d64d6397150e7b8d24c35b64b
Author: Dan Walsh <dwalsh>
Date:   Thu Feb 5 11:49:35 2015 +0100

    apmd needs sys_resource when shutting down the machine

Back ported to F21.

Comment 3 Fedora Update System 2015-02-05 13:15:33 UTC
selinux-policy-3.13.1-105.3.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/selinux-policy-3.13.1-105.3.fc21

Comment 4 Fedora Update System 2015-02-06 04:04:08 UTC
Package selinux-policy-3.13.1-105.3.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.13.1-105.3.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-1768/selinux-policy-3.13.1-105.3.fc21
then log in and leave karma (feedback).

Comment 5 Pablo Ganuza 2015-02-10 12:03:08 UTC
Description of problem:
I use Fedora 21. In gnome-tweak-tool, energy section, i set my power button to hibernate the system. Then I pressed it, then i booted again the system and SElinux alerts program started saying there was this problem. 

Version-Release number of selected component:
selinux-policy-3.13.1-105.1.fc21.noarch

Additional info:
reporter:       libreport-2.3.0
hashmarkername: setroubleshoot
kernel:         3.18.5-201.fc21.x86_64
type:           libreport

Comment 6 123 2015-02-11 20:00:49 UTC
Description of problem:
It was after a sleep my a nootebok asus x200ma

Version-Release number of selected component:
selinux-policy-3.13.1-105.1.fc21.noarch

Additional info:
reporter:       libreport-2.3.0
hashmarkername: setroubleshoot
kernel:         3.18.5-201.fc21.x86_64
type:           libreport

Comment 7 Fedora Update System 2015-02-15 03:29:34 UTC
selinux-policy-3.13.1-105.3.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 James McManus 2015-03-18 15:57:44 UTC
Description of problem:
This error occurs when I put my computer in sleep mode. It can be reproduced every time I put my computer in sleep mode by pressing the off button. I have a Dell Inspiron 15 7537, and am running Fedora 21.

Version-Release number of selected component:
selinux-policy-3.13.1-105.3.fc21.noarch

Additional info:
reporter:       libreport-2.3.0
hashmarkername: setroubleshoot
kernel:         3.18.9-200.fc21.x86_64
type:           libreport

Comment 9 kendell clark 2015-03-23 22:50:37 UTC
I seem to be experiencing this bug. Upon putting my machine to sleep I get the following (paraphrased)  in seapplet. Process "shutdown" tried to access the following "sys_resource" The machine still sleeps, so it's just a curiosity.

Comment 10 kendell clark 2015-03-23 23:20:25 UTC
This is the full message from audit.log whenever an avc denial is sent. type=AVC msg=audit(1427108717.258:492): avc:  denied  { sys_resource } for  pid=4692 comm="shutdown" capability=24  scontext=system_u:system_r:apmd_t:s0. I'm stumped but again, my machine does sleep so just wondering what might cause this.

Comment 11 Daniel Walsh 2015-03-24 19:44:59 UTC
Should be dontaudited.

Comment 12 Lukas Vrabec 2015-03-25 00:19:35 UTC
commit 0203872e40d10dfd7ff956cfa514ebc2db923f4e
Author: Lukas Vrabec <lvrabec>
Date:   Wed Mar 25 01:18:30 2015 +0100

    apmd needs sys_resource when shutting down the machine

Comment 13 Scott R. Godin 2015-03-25 16:16:05 UTC
Description of problem:
pressed power button to suspend laptop

Version-Release number of selected component:
selinux-policy-3.13.1-105.6.fc21.noarch

Additional info:
reporter:       libreport-2.3.0
hashmarkername: setroubleshoot
kernel:         3.19.1-201.fc21.x86_64
type:           libreport

Comment 14 Fedora Update System 2015-04-02 11:53:43 UTC
selinux-policy-3.13.1-105.11.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/selinux-policy-3.13.1-105.11.fc21

Comment 15 Fedora Update System 2015-04-04 07:22:40 UTC
Package selinux-policy-3.13.1-105.11.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.13.1-105.11.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-5478/selinux-policy-3.13.1-105.11.fc21
then log in and leave karma (feedback).

Comment 16 Fedora End Of Life 2015-11-04 16:03:01 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 17 Fedora End Of Life 2015-12-02 08:35:35 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.