Bug 1667656

Summary: SELinux is preventing x86_energy_perf from 'getattr' accesses on the chr_file /dev/cpu/1/msr.
Product: [Fedora] Fedora Reporter: smitna
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: dwalsh, lvrabec, mgrepl, plautrba, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:43887384d6eb3acf2169e783f2d1fb96d8c73a4d892e44f0f26c3e6d37d1693a;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-20 17:58:52 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 smitna 2019-01-19 13:42:03 UTC
Description of problem:
Seems to happen when waking from sleep.  I suspect this might be triggered by package "tlp-rdw".
SELinux is preventing x86_energy_perf from 'getattr' accesses on the chr_file /dev/cpu/1/msr.

*****  Plugin restorecon (90.5 confidence) suggests   ************************

If you want to fix the label. 
/dev/cpu/1/msr default label should be cpu_device_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /dev/cpu/1/msr

*****  Plugin device (9.50 confidence) suggests   ****************************

If you want to allow x86_energy_perf to have getattr access on the msr chr_file
Then you need to change the label on /dev/cpu/1/msr to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE '/dev/cpu/1/msr'
# restorecon -v '/dev/cpu/1/msr'

*****  Plugin catchall (1.40 confidence) suggests   **************************

If you believe that x86_energy_perf should be allowed getattr access on the msr 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 'x86_energy_perf' --raw | audit2allow -M my-x86energyperf
# semodule -X 300 -i my-x86energyperf.pp

Additional Information:
Source Context                system_u:system_r:tlp_t:s0
Target Context                system_u:object_r:device_t:s0
Target Objects                /dev/cpu/1/msr [ chr_file ]
Source                        x86_energy_perf
Source Path                   x86_energy_perf
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.2-44.fc29.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.19.13-300.fc29.x86_64 #1 SMP Sat
                              Dec 29 22:54:28 UTC 2018 x86_64 x86_64
Alert Count                   2
First Seen                    2018-10-27 14:52:54 EDT
Last Seen                     2019-01-16 07:44:30 EST
Local ID                      ee59d2d3-b581-47c6-9322-de33ff0f7eea

Raw Audit Messages
type=AVC msg=audit(1547642670.582:345): avc:  denied  { getattr } for  pid=10345 comm="x86_energy_perf" path="/dev/cpu/1/msr" dev="devtmpfs" ino=298171 scontext=system_u:system_r:tlp_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=0


Hash: x86_energy_perf,tlp_t,device_t,chr_file,getattr

Version-Release number of selected component:
selinux-policy-3.14.2-44.fc29.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.7
hashmarkername: setroubleshoot
kernel:         4.19.15-300.fc29.x86_64
type:           libreport

Potential duplicate: bug 1562513

Comment 1 Lukas Vrabec 2019-01-20 17:58:52 UTC

*** This bug has been marked as a duplicate of bug 1562513 ***