Bug 710928

Summary: SELinux is preventing /sbin/setfiles from 'relabelfrom' accesses on the file pm-powersave.log.
Product: [Fedora] Fedora Reporter: bud <budroz89>
Component: pm-utilsAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dominick.grift, dwalsh, itsme_410, jskarvad, mgrepl, opensource, peter, pknirsch, richard, sepassi.nima
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:998ffbdb9c774ce41db7062a3443426916c7385df0414c46ca8bfc9177f363dd
Fixed In Version: pm-utils-1.4.1-8.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-15 18:38:56 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 bud 2011-06-05 21:24:55 UTC
SELinux is preventing /sbin/setfiles from 'relabelfrom' accesses on the file pm-powersave.log.

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

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

Additional Information:
Source Context                system_u:system_r:hald_t:s0
Target Context                system_u:object_r:hald_log_t:s0
Target Objects                pm-powersave.log [ file ]
Source                        restorecon
Source Path                   /sbin/setfiles
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           policycoreutils-2.0.86-7.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-26.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux Bud 2.6.38.6-27.fc15.i686 #1 SMP Sun May 15
                              17:57:13 UTC 2011 i686 i686
Alert Count                   3
First Seen                    Sun 05 Jun 2011 04:59:56 PM EDT
Last Seen                     Sun 05 Jun 2011 05:14:28 PM EDT
Local ID                      a1bc4641-a988-4049-bf98-6177c199dec5

Raw Audit Messages
type=AVC msg=audit(1307308468.191:154): avc:  denied  { relabelfrom } for  pid=3489 comm="restorecon" name="pm-powersave.log" dev=sda3 ino=6820 scontext=system_u:system_r:hald_t:s0 tcontext=system_u:object_r:hald_log_t:s0 tclass=file


type=SYSCALL msg=audit(1307308468.191:154): arch=i386 syscall=lsetxattr success=no exit=EACCES a0=20a4dce8 a1=dfe107 a2=20a2dcc8 a3=29 items=0 ppid=3478 pid=3489 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=restorecon exe=/sbin/setfiles subj=system_u:system_r:hald_t:s0 key=(null)

Hash: restorecon,hald_t,hald_log_t,file,relabelfrom

audit2allow

#============= hald_t ==============
allow hald_t hald_log_t:file relabelfrom;

audit2allow -R

#============= hald_t ==============
allow hald_t hald_log_t:file relabelfrom;

Comment 1 Miroslav Grepl 2011-06-06 08:01:24 UTC
What were you doing when this happened?

If you execute

# restorecon -R -v /var/log/pm-powersave.log


Can you reproduce it?

Comment 2 Daniel Walsh 2011-06-06 19:14:32 UTC
 matchpathcon  /var/log/pm-powersave.log 
/var/log/pm-powersave.log	system_u:object_r:devicekit_var_log_t:s0


It looks like the file can be created via devicekit or hal?  And we have different labels?

Comment 3 bud 2011-06-07 02:21:42 UTC
All I know is that the bug came up everytime I try to boot from hibernation.
If I executed:

# restorecon -R -v /var/log/pm-powersave.log

it doesn't really do anything. Even when I tried to hibernate after executing it, I still get that same bug again after hibernating.

Comment 4 Miroslav Grepl 2011-06-07 10:49:53 UTC
Ok, the file is re-created

---

        rm -f "$1"
        touch "$1"
        restorecon "$1"
        exec >> "$1" 2>&1

---

I thought we don't use HAL. 


The reporter,
is this a fresh install?

Comment 5 Miroslav Grepl 2011-06-07 10:52:45 UTC
Jaroslav,
I think you should use

-       restorecon "$1"
+       [ -x /sbin/restorecon ] && /sbin/restorecon "$1"

Comment 6 bud 2011-06-07 15:17:30 UTC
Well, I did install Fedora just recently if that's what you mean.

Comment 7 Jaroslav Škarvada 2011-06-07 15:45:07 UTC
Thanks Mirek,

it should be fixed in pm-utils-1.4.1-8. I tested it and I am getting no AVC on suspend/hibernate. Hope it helps the reporter also.

Comment 8 Fedora Update System 2011-06-07 16:05:44 UTC
pm-utils-1.4.1-8.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/pm-utils-1.4.1-8.fc15

Comment 9 Fedora Update System 2011-06-08 23:58:22 UTC
Package pm-utils-1.4.1-8.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pm-utils-1.4.1-8.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/pm-utils-1.4.1-8.fc15
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2011-06-15 18:38:50 UTC
pm-utils-1.4.1-8.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.