Bug 808999

Summary: SELinux is preventing /bin/cp from 'relabelfrom' accesses on the file /var/lib/prelink/quick
Product: [Fedora] Fedora Reporter: Massimiliano <massi.ergosum>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-05 13:08:33 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 Massimiliano 2012-04-02 07:54:43 UTC
Sometimes I get this warning from SETroubleshoot.
Here the report suggested from SETroubleshoot:

SELinux is preventing /bin/cp from 'relabelfrom' accesses on the file /var/lib/prelink/quick.

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

If you believe that cp should be allowed relabelfrom access on the quick 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:
# grep cp /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:prelink_cron_system_t:s0-s0:c0.c
                              1023
Target Context                unconfined_u:object_r:prelink_var_lib_t:s0
Target Objects                /var/lib/prelink/quick [ file ]
Source                        cp
Source Path                   /bin/cp
Port                          <Sconosciuto>
Host                          (removed)
Source RPM Packages           coreutils-8.12-6.fc16.x86_64
Target RPM Packages           prelink-0.4.6-3.fc16.x86_64
Policy RPM                    selinux-policy-3.10.0-80.fc16.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux XXXXX 3.3.0-4.fc16.x86_64
                              #1 SMP Tue Mar 20 18:05:40 UTC 2012 x86_64 x86_64
Alert Count                   1
First Seen                    lun 02 apr 2012 09:27:00 CEST
Last Seen                     lun 02 apr 2012 09:27:00 CEST
Local ID                      XXXXX

Raw Audit Messages
type=AVC msg=audit(1333351620.530:91): avc:  denied  { relabelfrom } for  pid=2582 comm="cp" name="quick" dev="sda6" ino=78480 scontext=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:prelink_var_lib_t:s0 tclass=file


type=SYSCALL msg=audit(1333351620.530:91): arch=x86_64 syscall=fsetxattr success=no exit=EACCES a0=4 a1=7fff15888f20 a2=119a930 a3=2b items=0 ppid=2575 pid=2582 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=3 comm=cp exe=/bin/cp subj=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023 key=(null)

Hash: cp,prelink_cron_system_t,prelink_var_lib_t,file,relabelfrom

audit2allow

#============= prelink_cron_system_t ==============
#!!!! This avc is a constraint violation.  You will need to add an attribute to either the source or target type to make it work.
#Constraint rule: 
allow prelink_cron_system_t prelink_var_lib_t:file relabelfrom;

audit2allow -R

#============= prelink_cron_system_t ==============
#!!!! This avc is a constraint violation.  You will need to add an attribute to either the source or target type to make it work.
#Constraint rule: 
allow prelink_cron_system_t prelink_var_lib_t:file relabelfrom;

Comment 1 Miroslav Grepl 2012-04-05 13:08:33 UTC
Please execute

restorecon -R -v -F /var/lib

Should fix this problem.

Comment 2 Massimiliano 2012-04-06 13:00:09 UTC
I've run the command: let's see what happens.