Bug 2321924 - SELinux is preventing power-profiles- from write access on the file energy_performance_preference.
Summary: SELinux is preventing power-profiles- from write access on the file energy_pe...
Keywords:
Status: CLOSED DUPLICATE of bug 2334965
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-10-26 13:36 UTC by Gurenko Alex
Modified: 2025-01-27 14:08 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-01-27 14:08:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Gurenko Alex 2024-10-26 13:36:17 UTC
My Lenovo P1 gen2 laptop is showing selinux alert every time I'm plugging or unplugging the power supply.

I'm currently on Fedora 41 KDE Spin

$ uname -r
6.11.5-300.fc41.x86_64

$ rpm -qa | grep power
power-profiles-daemon-0.23-1.fc41.x86_64
upower-libs-1.90.6-3.fc41.x86_64
upower-1.90.6-3.fc41.x86_64
powerdevil-6.2.2-1.fc41.x86_64


Reproducible: Always

Steps to Reproduce:
1. Plugin power cable or unplug power cable
Actual Results:  
SELinux is preventing power-profiles- from write access on the file energy_performance_preference.

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

If you believe that power-profiles- should be allowed write access on the energy_performance_preference 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 'power-profiles-' --raw | audit2allow -M my-powerprofiles
# semodule -X 300 -i my-powerprofiles.pp

Additional Information:
Source Context                system_u:system_r:powerprofiles_t:s0
Target Context                system_u:object_r:sysfs_t:s0
Target Objects                energy_performance_preference [ file ]
Source                        power-profiles-
Source Path                   power-profiles-
Port                          <Unknown>
Host                          <redacted>
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-41.23-1.fc41.noarch
Local Policy RPM              selinux-policy-targeted-41.23-1.fc41.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     <redacted>
Platform                      Linux <redacted>
                              6.11.5-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Tue
                              Oct 22 20:11:15 UTC 2024 x86_64
Alert Count                   27
First Seen                    2024-10-17 12:49:22 CEST
Last Seen                     2024-10-26 15:23:07 CEST
Local ID                      bbf2ddd2-5f96-4b2c-bf74-0b2aaff45178

Raw Audit Messages
type=AVC msg=audit(1729948987.109:402): avc:  denied  { write } for  pid=1816 comm="power-profiles-" name="energy_performance_preference" dev="sysfs" ino=22728 scontext=system_u:system_r:powerprofiles_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=1


Hash: power-profiles-,powerprofiles_t,sysfs_t,file,write

Expected Results:  
No SElinux alert should be observed

`power-profiles-` (with a dash at the end) looks a little suspicious, maybe a typo in policy or in a power-related packages (upower, powerdevil..?), I'm not sure what provides said capabilities.

Comment 1 Steve 2024-10-26 20:14:42 UTC
> (In reply to Gurenko Alex from comment #0)
...
> `power-profiles-` (with a dash at the end) looks a little suspicious, maybe a typo in policy or in a power-related packages (upower, powerdevil..?), I'm not sure what provides said capabilities.

AVCs frequently have incomplete or truncated filesystem names. The "locate" command can sometimes help find the full name:

$ sudo systemctl start plocate-updatedb.service

$ locate power-profiles-
/usr/lib/systemd/system/power-profiles-daemon.service
/usr/libexec/power-profiles-daemon
/usr/share/doc/power-profiles-daemon
/usr/share/doc/power-profiles-daemon/README.md
/usr/share/licenses/power-profiles-daemon
/usr/share/licenses/power-profiles-daemon/COPYING
/usr/share/polkit-1/actions/power-profiles-daemon.policy
/var/lib/power-profiles-daemon

$ rpm -qf /usr/libexec/power-profiles-daemon
power-profiles-daemon-0.23-1.fc41.x86_64

Comment 2 Zdenek Pytela 2025-01-27 14:08:48 UTC

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


Note You need to log in before you can comment on or make changes to this bug.