Bug 842889

Summary: SELinux is preventing /usr/bin/bash from 'read' accesses on the directory power_supply.
Product: [Fedora] Fedora Reporter: Gene Snider <genes1122>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:cbe947c4bc5b5b73e42d8d921793f50089414d1bfa39d79bea44b2ca05f960de
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-20 15:58:35 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 Gene Snider 2012-07-24 20:29:10 UTC
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.4.6-2.fc17.x86_64
time:           Tue 24 Jul 2012 01:28:40 PM PDT

description:
:SELinux is preventing /usr/bin/bash from 'read' accesses on the directory power_supply.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that bash should be allowed read access on the power_supply directory 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 on_ac_power /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                system_u:object_r:sysfs_t:s0
:Target Objects                power_supply [ dir ]
:Source                        on_ac_power
:Source Path                   /usr/bin/bash
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           bash-4.2.36-1.fc17.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-140.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.4.6-2.fc17.x86_64 #1 SMP Thu Jul
:                              19 22:54:16 UTC 2012 x86_64 x86_64
:Alert Count                   2
:First Seen                    Fri 20 Jul 2012 01:28:26 PM PDT
:Last Seen                     Tue 24 Jul 2012 01:27:49 PM PDT
:Local ID                      8dad9204-7335-449b-a61b-7bb11436008b
:
:Raw Audit Messages
:type=AVC msg=audit(1343161669.10:288): avc:  denied  { read } for  pid=15405 comm="on_ac_power" name="power_supply" dev="sysfs" ino=2992 scontext=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023 tcontext=system_u:object_r:sysfs_t:s0 tclass=dir
:
:
:type=SYSCALL msg=audit(1343161669.10:288): arch=x86_64 syscall=openat success=no exit=EACCES a0=ffffffffffffff9c a1=267c220 a2=90800 a3=0 items=0 ppid=15403 pid=15405 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=3 comm=on_ac_power exe=/usr/bin/bash subj=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023 key=(null)
:
:Hash: on_ac_power,prelink_cron_system_t,sysfs_t,dir,read
:
:audit2allowunable to open /sys/fs/selinux/policy:  Permission denied
:
:
:audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied
:
:

Comment 1 Daniel Walsh 2012-07-24 20:43:14 UTC
I can not see how this happens, but it makes some sense that you would not want to prelink when you are not on AC Power.

Comment 2 Gene Snider 2012-07-24 21:03:00 UTC
Per a suggestion in the dev mailing list, I added the following lines to /etc/cron.daily/prelink:

#local patch to exit on battery power
on_ac_power || exit

It was suggested that this patch be added to Fedora, and it seems like a good idea.  Should selinux allow the access?

Thanks,
Gene

Comment 3 Gene Snider 2012-07-24 21:29:16 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=840557 by Jan Kratochvil.

Thanks again,
Gene

Comment 4 Daniel Walsh 2012-07-27 11:35:25 UTC
Ok that explains it, yes SELinux should allow it.

Comment 5 Daniel Walsh 2012-07-31 15:15:15 UTC
*** Bug 844489 has been marked as a duplicate of this bug. ***

Comment 6 Daniel Walsh 2012-07-31 15:17:05 UTC
	dev_read_sysfs(prelink_cron_system_t)

Comment 7 Miroslav Grepl 2012-10-17 08:30:47 UTC
Added.

Comment 8 Fedora Update System 2012-10-17 12:33:46 UTC
selinux-policy-3.10.0-156.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-156.fc17

Comment 9 Fedora Update System 2012-10-18 00:24:38 UTC
Package selinux-policy-3.10.0-156.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-156.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-16347/selinux-policy-3.10.0-156.fc17
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2012-12-20 15:58:37 UTC
selinux-policy-3.10.0-156.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.