Description of problem: Normal usage of ThinkPad (browsing the Internet) SELinux is preventing sensord from 'getattr' accesses on the file /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon2/fan1_input. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that sensord should be allowed getattr access on the fan1_input 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 'sensord' --raw | audit2allow -M my-sensord # semodule -X 300 -i my-sensord.pp Additional Information: Source Context system_u:system_r:lsmd_t:s0 Target Context system_u:object_r:sysfs_t:s0 Target Objects /sys/devices/platform/thinkpad_hwmon/hwmon/hwmon2/ fan1_input [ file ] Source sensord Source Path sensord 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 Permissive Host Name (removed) Platform Linux (removed) 4.19.9-300.fc29.x86_64 #1 SMP Thu Dec 13 17:25:01 UTC 2018 x86_64 x86_64 Alert Count 8 First Seen 2019-01-02 10:40:03 CET Last Seen 2019-01-02 13:20:03 CET Local ID 18f856b0-5b6f-46fe-834a-5b0a57d6490a Raw Audit Messages type=AVC msg=audit(1546431603.637:435): avc: denied { getattr } for pid=1411 comm="sensord" path="/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon2/fan1_input" dev="sysfs" ino=29631 scontext=system_u:system_r:lsmd_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=1 Hash: sensord,lsmd_t,sysfs_t,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.9-300.fc29.x86_64 type: libreport
The sensord process should not run as lsmd_t, but it does, because SELinux policy contains an incorrect file context pattern: # semanage fcontext -l | grep sensord-service /usr/libexec/lm_sensors/sensord-service-wrapper regular file system_u:object_r:lsmd_exec_t:s0 # The file context pattern should look this way: # semanage fcontext -l | grep sensord-service /usr/libexec/lm_sensors/sensord-service-wrapper regular file system_u:object_r:sensord_exec_t:s0 # Because lsmd_t is dedicated to lib storage management processes and it has nothing to do with sensord.
If it helps, system was originally setup at Fedora 25, upgraded to 27 and now 29. How would I change the SE context of the system service?
# semanage fcontext -a -t sensord_exec_t /usr/libexec/lm_sensors/sensord-service-wrapper Unfortunately, above-mentioned file context pattern does not solve the problem completely. Following SELinux rules are needed too: # cat mypolicy.cil ( allow sensord_t passwd_file_t ( file ( getattr open read ))) ( allow sensord_t sensord_exec_t ( file ( execute_no_trans ))) ( allow sensord_t shell_exec_t ( file ( map execute ))) ( allow sensord_t sssd_public_t ( dir ( search ))) ( allow sensord_t sssd_public_t ( file ( getattr open read map ))) ( allow sensord_t sssd_t ( unix_stream_socket ( connectto ))) ( allow sensord_t sssd_var_lib_t ( dir ( search ))) ( allow sensord_t sssd_var_lib_t ( sock_file ( write ))) # semodule -i mypolicy.cil # I'm using this ^^^ until an official fix becomes available.
commit 8e8625f44d6144fe70c2c3a335ef622b4052c16a (HEAD -> rawhide) Author: Lukas Vrabec <lvrabec> Date: Wed Jan 9 13:28:28 2019 +0100 Change label of /usr/libexec/lm_sensors/sensord-service-wrapper from lsmd_exec_t to sensord_exec_t BZ(1662922)
selinux-policy-3.14.2-46.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-6a20cfef61
selinux-policy-3.14.2-46.fc29 has been pushed to the Fedora 29 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-2019-6a20cfef61
selinux-policy-3.14.2-46.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.