Bug 1645313 - SELinux is preventing tlp from 'getattr' accesses on the file /run/tlp/last_pwr.
Summary: SELinux is preventing tlp from 'getattr' accesses on the file /run/tlp/last_pwr.
Keywords:
Status: CLOSED DUPLICATE of bug 1705246
Alias: None
Product: Fedora
Classification: Fedora
Component: tlp
Version: 29
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeremy Newton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:7d05830bafa69a0eac17b71d8b9...
: 1636576 1639237 1640261 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-01 22:35 UTC by Ryan
Modified: 2019-05-07 13:22 UTC (History)
22 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-07 13:22:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Ryan 2018-11-01 22:35:19 UTC
Description of problem:
Wake up from sleep while on battery power.
SELinux is preventing tlp from 'getattr' accesses on the file /run/tlp/last_pwr.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/tlp/last_pwr default label should be tlp_var_run_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 /run/tlp/last_pwr

*****  Plugin catchall (1.49 confidence) suggests   **************************

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

Additional Information:
Source Context                system_u:system_r:tlp_t:s0
Target Context                system_u:object_r:var_run_t:s0
Target Objects                /run/tlp/last_pwr [ file ]
Source                        tlp
Source Path                   tlp
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.2-40.fc29.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.18.16-300.fc29.x86_64 #1 SMP Sat
                              Oct 20 23:24:08 UTC 2018 x86_64 x86_64
Alert Count                   1
First Seen                    2018-11-01 15:33:13 PDT
Last Seen                     2018-11-01 15:33:13 PDT
Local ID                      f5d42e74-b87f-41fb-b715-48542bbcb237

Raw Audit Messages
type=AVC msg=audit(1541111593.495:250): avc:  denied  { getattr } for  pid=6745 comm="tlp" path="/run/tlp/last_pwr" dev="tmpfs" ino=73217 scontext=system_u:system_r:tlp_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file permissive=0


Hash: tlp,tlp_t,var_run_t,file,getattr

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

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

Comment 1 Lukas Vrabec 2018-11-04 16:19:29 UTC
*** Bug 1639237 has been marked as a duplicate of this bug. ***

Comment 2 Lukas Vrabec 2018-11-04 16:19:34 UTC
*** Bug 1636576 has been marked as a duplicate of this bug. ***

Comment 3 Lukas Vrabec 2018-11-04 16:22:45 UTC
*** Bug 1640261 has been marked as a duplicate of this bug. ***

Comment 4 Lukas Vrabec 2018-11-04 17:01:24 UTC
Hi tlp folks, 

I need to create proper file transition here, however I don't know which process (or multiple processes) creating /run/tlp/last_pwr. 

Could you please help here?

Comment 5 Peter Andreasen 2018-11-17 10:50:33 UTC
Description of problem:
I get this message when I log on and it seems to take two tries for my pc to connect to wifi


Additional info:
reporter:       libreport-2.9.6
hashmarkername: setroubleshoot
kernel:         4.18.18-300.fc29.x86_64
type:           libreport

Comment 6 Jeremy Newton 2018-11-19 16:17:12 UTC
Hi Lukas, I skimmed the source code and it seems like the two binaries referencing this file is /usr/share/tlp/tlp-functions and /usr/bin/tlp-stat, both shell scripts.

Neither of these actually make this file, they only read them. Perhaps the upstream maintainer can answer this (I've CC-ed him to this bug)

Comment 7 Thomas Koch 2018-11-19 17:22:56 UTC
Hi @all,

upstream (me) says:

*** /usr/sbin/tlp ***

Reads, Creates and Writes /run/tlp/last_pwr

Contexts:

1. Manually in a user shell (root or sudo) (tlp start)
2. Power supply events: udevd --> /lib/udev/rules.d/85-tlp.rules (tlp auto)
3. System startup/shutdown: systemd --> /lib/systemd/system/tlp.service (tlp init start|stop)
4. System suspend/resume: systemd --> /lib/systemd/system/tlp-sleep.service (tlp suspend|resume)

*** /usr/bin/tlp-stat ***

Reads /run/tlp/last_pwr

Context:
1. manually in a user shell (root or sudo) (tlp-stat)

Hope it helps.

Comment 8 Zdeněk Zikán 2018-12-02 09:24:05 UTC
Description of problem:
This happens regularly when waking up laptop from suspend-to-ram.

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

Additional info:
reporter:       libreport-2.9.6
hashmarkername: setroubleshoot
kernel:         4.19.4-300.fc29.x86_64
type:           libreport

Comment 9 Zdeněk Zikán 2018-12-02 09:36:30 UTC
Description of problem:
this happens regularly when waking up laptop from sleep (suspend-to-ram)

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

Additional info:
reporter:       libreport-2.9.6
hashmarkername: setroubleshoot
kernel:         4.19.4-300.fc29.x86_64
type:           libreport

Comment 10 Michael 2018-12-23 15:59:09 UTC
Description of problem:
Wake up from sleep

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

Additional info:
reporter:       libreport-2.9.7
hashmarkername: setroubleshoot
kernel:         4.19.10-300.fc29.x86_64
type:           libreport

Comment 11 Mai Ling 2018-12-28 17:27:30 UTC
Description of problem:
sudo systemctl start tlp

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

Additional info:
reporter:       libreport-2.9.7
hashmarkername: setroubleshoot
kernel:         4.20.0-0.rc7.git2.2.fc30.x86_64
type:           libreport

Comment 12 Per Thomas Jahr 2019-02-17 09:14:45 UTC
Description of problem:
I see this error from SELinux when my laptop (Lenovo ThinkPad X250) wakes up from hibernate. I hibernate the laptop by holding down the power button from 1-2 seconds.

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

Additional info:
reporter:       libreport-2.9.7
hashmarkername: setroubleshoot
kernel:         4.19.14-300.fc29.x86_64
type:           libreport

Comment 13 Markus Schulze 2019-03-23 08:35:28 UTC
Description of problem:
Woke up Laptop from suspend

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         4.20.16-200.fc29.x86_64
type:           libreport

Comment 14 Markus Schulze 2019-03-23 08:36:23 UTC
Description of problem:
woke up laptop from suspend

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         4.20.16-200.fc29.x86_64
type:           libreport

Comment 15 Michael 2019-03-26 21:30:07 UTC
Description of problem:
Wakeup from sleep

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         4.20.16-200.fc29.x86_64
type:           libreport

Comment 16 Doncho Gunchev 2019-04-02 08:16:50 UTC
Description of problem:
Just updated the kernel and rebooted... I ran 'restorecon -Rv /' and rebooted again - same problem.

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         5.0.3-200.fc29.x86_64
type:           libreport

Comment 17 Dan Taylor 2019-05-04 00:48:19 UTC
Description of problem:
installed tlp, started getting this error.

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         5.0.9-200.fc29.x86_64
type:           libreport

Comment 18 Dan Taylor 2019-05-04 13:15:39 UTC
Description of problem:
Installed tlp, started getting this error.

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

Additional info:
reporter:       libreport-2.10.0
hashmarkername: setroubleshoot
kernel:         5.0.9-200.fc29.x86_64
type:           libreport

Comment 19 Zdenek Pytela 2019-05-07 13:22:43 UTC

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


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