Bug 1594554

Summary: SELinux is preventing upowerd from 'open' accesses on the chr_file /dev/input/event0.
Product: [Fedora] Fedora Reporter: Alexander Ploumistos <alex.ploumistos>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: dhgutteridge, dwalsh, franco.geller, lslebodn, lvrabec, mgrepl, plautrba, plroskin, pmoore, renault
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:fb27a116959c6b2ccc6622598b19ee8ef0e2563ea87d54935ec4f303939a94e2;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.14.1-36.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-29 03:23:44 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 Alexander Ploumistos 2018-06-24 10:39:55 UTC
Description of problem:
Like rhbz#1593496, this started happening after the update to upower-0.99.8-1.fc28.
SELinux is preventing upowerd from 'open' accesses on the chr_file /dev/input/event0.

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

If you believe that upowerd should be allowed open access on the event0 chr_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 'upowerd' --raw | audit2allow -M my-upowerd
# semodule -X 300 -i my-upowerd.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:object_r:event_device_t:s0
Target Objects                /dev/input/event0 [ chr_file ]
Source                        upowerd
Source Path                   upowerd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.1-32.fc28.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.17.2-200.fc28.x86_64 #1 SMP Mon
                              Jun 18 20:09:31 UTC 2018 x86_64 x86_64
Alert Count                   7
First Seen                    2018-06-21 19:56:16 CEST
Last Seen                     2018-06-24 12:29:34 CEST
Local ID                      af393f40-f507-475d-951d-f435135e162c

Raw Audit Messages
type=AVC msg=audit(1529836174.908:207): avc:  denied  { open } for  pid=1440 comm="upowerd" path="/dev/input/event0" dev="devtmpfs" ino=12665 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:event_device_t:s0 tclass=chr_file permissive=0


Hash: upowerd,init_t,event_device_t,chr_file,open

Version-Release number of selected component:
selinux-policy-3.14.1-32.fc28.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.5
hashmarkername: setroubleshoot
kernel:         4.17.2-200.fc28.x86_64
type:           libreport

Comment 1 Pavel Roskin 2018-06-27 16:52:51 UTC
Description of problem:
I just rebooted the system after updating it from updates-testing.

Version-Release number of selected component:
selinux-policy-3.14.1-32.fc28.noarch

Additional info:
reporter:       libreport-2.9.5
hashmarkername: setroubleshoot
kernel:         4.17.2-200.fc28.x86_64
type:           libreport

Comment 2 Franco Geller 2018-06-27 17:15:46 UTC
Same problem here, since 4.17.2-100.fc27.x86_64 kernel update.
The upower.service throws the following log:

upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-rate-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-charge-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-time-full-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: failed to get data: Failed to open file “/var/lib/upower/history-time-empty-ASUS_Battery-56.dat”: Permission denied
upowerd[1216]: cannot open '/dev/input/event0': Permission denied
systemd[1]: Started Daemon for power management.
upowerd[1216]: Failed to create object manager for BlueZ: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An SELinux policy prevents this sender from sending this message to this recipie
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.YG3MLZ”: Permission denied
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.MUMMLZ”: Permission denied
upowerd[1216]: failed to set data: Failed to create file “/var/lib/upower/history-rate-ASUS_Battery-56.dat.AI59KZ”: Permission denied

Comment 3 David H. Gutteridge 2018-07-17 02:30:27 UTC
(I've experienced these problems on multiple machines. Adding myself to the CC list.)

Comment 4 Fedora Update System 2018-07-25 22:29:38 UTC
selinux-policy-3.14.1-36.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-1050fb248b

Comment 5 Fedora Update System 2018-07-26 16:31:55 UTC
selinux-policy-3.14.1-36.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-1050fb248b

Comment 6 David H. Gutteridge 2018-07-27 21:53:12 UTC
I'm unable to test this update, since it's contingent upon upower-0.99.8-1, which is no longer available as a downloadable build for F28 (it was deleted from Koji). upower-0.99.8-1 is still available for F27, but the latest equivalent update of selinux-policy for F27 (selinux-policy-3.13.1-284.37.fc27) does not list this bug among its fixes, though this issue is applicable to F27 too.

Comment 7 Fedora Update System 2018-07-29 03:23:44 UTC
selinux-policy-3.14.1-36.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.