Bug 1435868

Summary: SELinux is preventing systemd-sysctl from 'write' accesses on the file ptrace_scope.
Product: [Fedora] Fedora Reporter: M. Edward (Ed) Borasky <znmeb>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: dominick.grift, dwalsh, jpazdziora, lvrabec, mgrepl, plautrba, pmoore, ssekidde, znmeb
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:e1b73bba2d85f25dd961c04ec050cfbda4a2bc240075be4fc74cef06aad72295;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-03-27 13:22:22 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 M. Edward (Ed) Borasky 2017-03-25 05:55:22 UTC
Description of problem:
SELinux is preventing systemd-sysctl from 'write' accesses on the file ptrace_scope.

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

If you believe that systemd-sysctl should be allowed write access on the ptrace_scope file 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:
# ausearch -c 'systemd-sysctl' --raw | audit2allow -M my-systemdsysctl
# semodule -X 300 -i my-systemdsysctl.pp

Additional Information:
Source Context                system_u:system_r:container_t:s0:c248,c817
Target Context                system_u:object_r:sysctl_kernel_t:s0
Target Objects                ptrace_scope [ file ]
Source                        systemd-sysctl
Source Path                   systemd-sysctl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-225.11.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.9.14-200.fc25.x86_64 #1 SMP Mon
                              Mar 13 19:26:40 UTC 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-03-24 22:53:43 PDT
Last Seen                     2017-03-24 22:53:43 PDT
Local ID                      2818407c-c1fe-4b4d-8c6b-d61d649dbc78

Raw Audit Messages
type=AVC msg=audit(1490421223.448:1164): avc:  denied  { write } for  pid=20081 comm="systemd-sysctl" name="ptrace_scope" dev="proc" ino=3972199 scontext=system_u:system_r:container_t:s0:c248,c817 tcontext=system_u:object_r:sysctl_kernel_t:s0 tclass=file permissive=0


Hash: systemd-sysctl,container_t,sysctl_kernel_t,file,write

Version-Release number of selected component:
selinux-policy-3.13.1-225.11.fc25.noarch

Additional info:
reporter:       libreport-2.8.0
hashmarkername: setroubleshoot
kernel:         4.9.14-200.fc25.x86_64
type:           libreport

Comment 1 Daniel Walsh 2017-03-27 13:22:22 UTC
What were you trying to do in the container.  Seems to be something that should be blocked?  Allowing a container to modify this is probably required to run a privileged container or at least disable SELinux.

--privileged 
or
--security-opt label=disabled


If you believe a non privileged container should be allowed to modify the ptrace_scope, then please reopen the container.  

Do you know if ptrace_scope is namespaced?

Comment 2 Jan Pazdziora (Red Hat) 2018-07-18 19:53:10 UTC
The issues is present with current Fedora hosts and fedora images when upgrading elfutils-default-yama-scope, bug 1602914.