Bug 1442443

Summary: SELinux prevents Lirc from writing to /sys/
Product: [Fedora] Fedora Reporter: Gustavo Maciel Dias Vieira <gustavo>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 25CC: dominick.grift, dwalsh, lvrabec, mgrepl, plautrba, pmoore, ssekidde
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-225.13.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-25 02:23:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gustavo Maciel Dias Vieira 2017-04-14 19:18:28 UTC
Description of problem:
When Lirc is configured to use the "default" driver in /etc/lirc/lirc_options.conf, it disables the kernel internal processing of signals as keystrokes (devinput, I guess). It appears to do this by writing to /sys/class/rc/rc0/protocols.

SELinux blocks Lirc from configuring the kernel protocols and when using the "default" driver I get duplicate keys.


Version-Release number of selected component (if applicable):
lirc-compat-0.9.4c-8.fc25.x86_64
lirc-config-0.9.4c-8.fc25.noarch
lirc-core-0.9.4c-8.fc25.x86_64
lirc-doc-0.9.4c-8.fc25.noarch
lirc-drv-ftdi-0.9.4c-8.fc25.x86_64
lirc-drv-portaudio-0.9.4c-8.fc25.x86_64
lirc-libs-0.9.4c-8.fc25.x86_64
lirc-tools-gui-0.9.4c-8.fc25.x86_64
selinux-policy-3.13.1-225.11.fc25.noarch
selinux-policy-targeted-3.13.1-225.11.fc25.noarch


How reproducible:
Deterministic


Steps to Reproduce:
Configure Lirc to use the "default" driver in /etc/lirc/lirc_options.conf

Try and use an application that both processes Lirc input and keyboard inputs.


Actual results:
Duplicate keys

Expected results:
Only the Lirc input should be processed.


Additional info:

The AVCs I get are:

type=AVC msg=audit(1488155185.855:113): avc:  denied  { write } for  pid=776 comm="lircd" name="protocols" dev="sysfs" ino=20350 scontext=system_u:system_r:lircd_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0
type=AVC msg=audit(1488155185.855:114): avc:  denied  { write } for  pid=776 comm="lircd" name="protocols" dev="sysfs" ino=20350 scontext=system_u:system_r:lircd_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=0


If I create and install the following module, Lirc works as expected:

module lircsysfs 1.0;

require {
	type sysfs_t;
	type lircd_t;
	class file write;
}

#============= lircd_t ==============
allow lircd_t sysfs_t:file write;

Comment 1 Fedora Update System 2017-04-19 20:36:23 UTC
selinux-policy-3.13.1-225.13.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0af0456dcc

Comment 2 Fedora Update System 2017-04-20 18:25:02 UTC
selinux-policy-3.13.1-225.13.fc25 has been pushed to the Fedora 25 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-2017-0af0456dcc

Comment 3 Fedora Update System 2017-04-25 02:23:42 UTC
selinux-policy-3.13.1-225.13.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.