Bug 849335

Summary: SELinux is preventing /usr/bin/boinc_client from 'getattr' accesses on the chr_file /dev/ttyACM0.
Product: [Fedora] Fedora Reporter: Ladislav Nesnera <nesnera>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:daadbe83333e5ce25fad404970980316ebc649ab08ec681e356bdec905f122a9
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-21 23:58:28 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:
Attachments:
Description Flags
SELinux log none

Description Ladislav Nesnera 2012-08-18 13:10:53 UTC
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.5.1-1.fc17.x86_64
time:           Sat 18 Aug 2012 03:10:48 PM CEST

description:
:SELinux is preventing /usr/bin/boinc_client from 'getattr' accesses on the chr_file /dev/ttyACM0.
:
:*****  Plugin restorecon (90.5 confidence) suggests  *************************
:
:If you want to fix the label. 
:/dev/ttyACM0 default label should be tty_device_t.
:Then you can run restorecon.
:Do
:# /sbin/restorecon -v /dev/ttyACM0
:
:*****  Plugin device (9.50 confidence) suggests  *****************************
:
:If you want to allow boinc_client to have getattr access on the ttyACM0 chr_file
:Then you need to change the label on /dev/ttyACM0 to a type of a similar device.
:Do
:# semanage fcontext -a -t SIMILAR_TYPE '/dev/ttyACM0'
:# restorecon -v '/dev/ttyACM0'
:
:*****  Plugin catchall (1.40 confidence) suggests  ***************************
:
:If you believe that boinc_client should be allowed getattr access on the ttyACM0 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:
:# grep boinc_client /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:boinc_t:s0
:Target Context                system_u:object_r:device_t:s0
:Target Objects                /dev/ttyACM0 [ chr_file ]
:Source                        boinc_client
:Source Path                   /usr/bin/boinc_client
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-145.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.5.1-1.fc17.x86_64 #1 SMP Thu Aug
:                              9 17:50:43 UTC 2012 x86_64 x86_64
:Alert Count                   18
:First Seen                    2012-08-10 09:15:45 CEST
:Last Seen                     2012-08-18 15:05:38 CEST
:Local ID                      8f10bd1f-66b9-4d27-bbc2-e923cdfa8fd2
:
:Raw Audit Messages
:type=AVC msg=audit(1345295138.346:778): avc:  denied  { getattr } for  pid=885 comm="boinc_client" path="/dev/ttyACM0" dev="devtmpfs" ino=1841110 scontext=system_u:system_r:boinc_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file
:
:
:type=SYSCALL msg=audit(1345295138.346:778): arch=x86_64 syscall=stat success=no exit=EACCES a0=176c308 a1=7fffd7e65b40 a2=7fffd7e65b40 a3=0 items=0 ppid=884 pid=885 auid=4294967295 uid=995 gid=992 euid=995 suid=995 fsuid=995 egid=992 sgid=992 fsgid=992 tty=(none) ses=4294967295 comm=boinc_client exe=2F7573722F62696E2F626F696E635F636C69656E74202864656C6574656429 subj=system_u:system_r:boinc_t:s0 key=(null)
:
:Hash: boinc_client,boinc_t,device_t,chr_file,getattr
:
:audit2allow
:
:#============= boinc_t ==============
:allow boinc_t device_t:chr_file getattr;
:
:audit2allow -R
:
:#============= boinc_t ==============
:allow boinc_t device_t:chr_file getattr;
:

Comment 1 Miroslav Grepl 2012-08-20 09:45:45 UTC
/dev/ttyACM0 is mislabeled and it looks like a race condition.

How is /dev/ttyACM0 labeled now?

# ls -lZ /dev/ttyACM0


It should be

matchpathcon /dev/ttyACM0
/dev/ttyACM0	system_u:object_r:tty_device_t:s0


It you see this labeling and you are able to reproduce it, please reopen.

Comment 2 Ladislav Nesnera 2012-08-21 07:56:42 UTC
You are right. The response to the command
     # ls -lZ /dev/ttyACM0
is
     crw-rw----. root dialout system_u:object_r:tty_device_t:s0 /dev/ttyACM0

Comment 3 Miroslav Grepl 2012-08-21 12:44:54 UTC
Ok, I added fixes to prevent this issue.

Comment 4 Ladislav Nesnera 2012-08-21 15:25:55 UTC
Very nice! Thanks a lot, especially for so fast solution

Comment 5 Fedora Update System 2012-09-17 12:12:37 UTC
selinux-policy-3.10.0-149.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-149.fc17

Comment 6 Fedora Update System 2012-09-19 02:54:18 UTC
Package selinux-policy-3.10.0-149.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-149.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-14301/selinux-policy-3.10.0-149.fc17
then log in and leave karma (feedback).

Comment 7 Ladislav Nesnera 2012-09-20 20:29:07 UTC
Created attachment 615114 [details]
SELinux log

SELinux warning occurred again :(
Have a look at attached log and notice that policy prm is xx.146 but console output is 149
yum info selinux-policy
Loaded plugins: langpacks, presto, refresh-packagekit
Installed Packages
Name        : selinux-policy
Arch        : noarch
Version     : 3.10.0
Release     : 149.fc17
Size        : 62  
Repo        : installed
From repo   : updates-testing
Summary     : SELinux policy configuration
URL         : http://oss.tresys.com/repos/refpolicy/
License     : GPLv2+
Description : SELinux Reference Policy - modular.
            : Based off of reference policy: Checked out revision  2.20091117

System was restarted after upgradevb

Comment 8 Miroslav Grepl 2012-09-21 09:31:21 UTC
This is strange. What does

# sesearch -T  |grep \"ttyACM0 |wc -l


for you?

Comment 9 Ladislav Nesnera 2012-09-21 11:46:31 UTC
Well. I have installed setools-console-3.3.7-24.fc17

# sesearch -T  |grep \"ttyACM0 |wc -l
61

That's all ;)

Comment 10 Fedora Update System 2012-09-21 23:58:28 UTC
selinux-policy-3.10.0-149.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.