Bug 1038791

Summary: SELinux is preventing /usr/sbin/setfiles from 'associate' accesses on the filesystem /sys.
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dominick.grift, dwalsh, ignatenko, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:31763356a9dbd9a1950a671e9be592b72111ba4ba24b341d2be28832e3a7d7ba
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-21 12:48:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Igor Gnatenko 2013-12-05 20:06:03 UTC
Description of problem:
SELinux is preventing /usr/sbin/setfiles from 'associate' accesses on the filesystem /sys.

*****  Plugin filesystem_associate (99.5 confidence) suggests   **************

If you believe setfiles should be allowed to create sys files
Then you need to use a different command. You are not allowed to preserve the SELinux context on the target file system.
Do
use a command like "cp -p" to preserve all permissions except SELinux context.

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that setfiles should be allowed associate access on the sys filesystem 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 restorecon /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:object_r:mock_var_lib_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                /sys [ filesystem ]
Source                        restorecon
Source Path                   /usr/sbin/setfiles
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           policycoreutils-2.2.2-2.fc20.x86_64
                              policycoreutils-2.2.2-3.fc20.x86_64
Target RPM Packages           filesystem-3.2-19.fc20.x86_64
Policy RPM                    selinux-policy-3.12.1-90.fc20.noarch selinux-
                              policy-3.12.1-106.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.10-300.fc20.x86_64 #1 SMP Fri
                              Nov 29 19:16:48 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-12-06 00:04:09 MSK
Last Seen                     2013-12-06 00:04:09 MSK
Local ID                      7074e56c-999f-4aa2-89c7-e74d45b7fd4f

Raw Audit Messages
type=AVC msg=audit(1386273849.480:607): avc:  denied  { associate } for  pid=9907 comm="restorecon" name="/" dev="sysfs" ino=1 scontext=system_u:object_r:mock_var_lib_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=filesystem


type=SYSCALL msg=audit(1386273849.480:607): arch=x86_64 syscall=lsetxattr success=no exit=EACCES a0=7f9e63c67c50 a1=7f9e62c37d3e a2=7f9e63c68de0 a3=24 items=0 ppid=8460 pid=9907 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=1 tty=pts1 comm=restorecon exe=/usr/sbin/setfiles subj=unconfined_u:system_r:setfiles_t:s0-s0:c0.c1023 key=(null)

Hash: restorecon,mock_var_lib_t,sysfs_t,filesystem,associate

Additional info:
reporter:       libreport-2.1.9
hashmarkername: setroubleshoot
kernel:         3.11.10-300.fc20.x86_64
type:           libreport

Potential duplicate: bug 665304

Comment 1 Daniel Walsh 2013-12-05 20:29:21 UTC
DId you run a restorecon on /var/lib while a mock session was running?

Comment 2 Igor Gnatenko 2013-12-05 20:37:03 UTC
(In reply to Daniel Walsh from comment #1)
> DId you run a restorecon on /var/lib while a mock session was running?

almost. I have started update my system while did mock build. was updating selinux

Comment 3 Daniel Walsh 2013-12-05 20:55:36 UTC
Well SELinux blocked this correclty, but really restorecon should not have tried.

Comment 4 Miroslav Grepl 2013-12-06 10:05:20 UTC
*** Bug 1038790 has been marked as a duplicate of this bug. ***