Bug 1268865 - SELinux is preventing sge_execd from using the sys_ptrace capability
SELinux is preventing sge_execd from using the sys_ptrace capability
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2015-10-05 09:26 EDT by Mike Grant
Modified: 2015-12-02 13:19 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-12-02 10:35:24 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Grant 2015-10-05 09:26:41 EDT
Description of problem:

Grid engine jobs seem to annoy SELinux when running.  The ptrace capability is blocked, which doesn't appear to stop the jobs completely successfully, but does spend a lot of CPU filling logs with warnings.

Version-Release number of selected component (if applicable):
 - Tested with the latest gridengine and selinux policy packages on F21.  I haven't got access to a grid engine running on a newer Fedora yet (probably moving straight to F23 after its release).

How reproducible:

Steps to Reproduce:
1. install gridengine (execd component only, if you have a working cluster)
2. submit some jobs
(can provide a detailed reproduction if needed, but I suspect the info below is enough)

Actual results:

Jobs appear to complete normally.  SELinux logs have a lot of activity relating to ptrace (maybe 5 messages a second in the example I looked at).  setroubleshootd spends a lot of CPU parsing them nicely.

Expected results:
I think ptrace is probably a reasonable capability for the sge_execd execution daemon to want to use, in order to monitor its child processes, but I'm no expert on it.  Either way, it would be nice not to have the SELinux logs hammered!

Additional info:
SELinux is preventing sge_execd from using the sys_ptrace capability.

*****  Plugin catchall (100. confidence) suggests   **************************

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

Additional Information:
Source Context                system_u:system_r:sge_execd_t:s0
Target Context                system_u:system_r:sge_execd_t:s0
Target Objects                Unknown [ capability ]
Source                        sge_execd
Source Path                   sge_execd
Port                          <Unknown>
Host                          pmpc1326.npm.ac.uk
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-105.20.fc21.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     pmpc1326.npm.ac.uk
Platform                      Linux pmpc1326.npm.ac.uk 4.1.6-100.fc21.x86_64 #1
                              SMP Mon Aug 17 22:20:37 UTC 2015 x86_64 x86_64
Alert Count                   428218
First Seen                    2015-09-28 20:06:27 BST
Last Seen                     2015-10-05 14:17:56 BST
Local ID                      18f96ae3-cb8e-405f-ab18-117cf1de8253

Raw Audit Messages
type=AVC msg=audit(1444051076.898:1853204): avc:  denied  { sys_ptrace } for  pid=1288 comm="sge_execd" capability=19  scontext=system_u:system_r:sge_execd_t:s0 tcontext=system_u:system_r:sge_execd_t:s0 tclass=capability permissive=0

Hash: sge_execd,sge_execd_t,sge_execd_t,capability,sys_ptrace
Comment 1 Mike Grant 2015-10-14 05:03:49 EDT
Here's a policy dump from audit2allow capturing a few more denials:

[root@pmpc1294 ~]# ausearch -m avc -c sge_execd | audit2allow -m sge_execd_policy -o sge_execd_policy.te
[root@pmpc1294 ~]# cat sge_execd_policy.te 
module sge_execd_policy 1.0;

require {
        type sge_shepherd_t;
        type sge_execd_t;
        type sge_job_t;
        type sge_tmp_t;
        class process setsched;
        class capability { sys_nice sys_ptrace };
        class lnk_file { getattr unlink };

#============= sge_execd_t ==============
allow sge_execd_t self:capability { sys_nice sys_ptrace };
allow sge_execd_t sge_job_t:process setsched;
allow sge_execd_t sge_shepherd_t:process setsched;
allow sge_execd_t sge_tmp_t:lnk_file { getattr unlink };

(loaded and apparently working well)
Comment 2 Fedora End Of Life 2015-11-04 05:11:29 EST
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 3 Fedora End Of Life 2015-12-02 10:35:34 EST
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

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

Note You need to log in before you can comment on or make changes to this bug.