Bug 702548

Summary: SELinux is preventing /usr/sbin/modem-manager from read, write access on the chr_file ttyS1.
Product: [Fedora] Fedora Reporter: cgrim <cgrim>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: dwalsh, mgrepl
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:ca3e8362219697d91f9d8220987020d9e7065c909f9b10ff61cd89893e82d1d0
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-07 14:13:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description cgrim 2011-05-06 06:01:46 UTC
SELinux is preventing /usr/sbin/modem-manager from read, write access on the chr_file ttyS1.

*****  Plugin device (91.4 confidence) suggests  *****************************

If you want to allow modem-manager to have read write access on the ttyS1 chr_file
Then you need to change the label on ttyS1 to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE 'ttyS1'
# restorecon -v 'ttyS1'

*****  Plugin catchall (9.59 confidence) suggests  ***************************

If you believe that modem-manager should be allowed read write access on the ttyS1 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 modem-manager /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:modemmanager_t:s0-s0:c0.c1023
Target Context                system_u:object_r:device_t:s0
Target Objects                ttyS1 [ chr_file ]
Source                        modem-manager
Source Path                   /usr/sbin/modem-manager
Port                          <Neznámé>
Host                          (removed)
Source RPM Packages           ModemManager-0.4-8.git20110427.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-21.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.5-22.fc15.x86_64 #1 SMP Mon May
                              2 19:28:55 UTC 2011 x86_64 x86_64
Alert Count                   1
First Seen                    Pá 6. květen 2011, 07:53:38 CEST
Last Seen                     Pá 6. květen 2011, 07:53:38 CEST
Local ID                      45fde0ec-a328-4a46-96d6-fc7ea85f1089

Raw Audit Messages
type=AVC msg=audit(1304661218.712:101): avc:  denied  { read write } for  pid=1094 comm="modem-manager" name="ttyS1" dev=devtmpfs ino=29177 scontext=system_u:system_r:modemmanager_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1304661218.712:101): arch=x86_64 syscall=open success=no exit=EACCES a0=1e5c300 a1=982 a2=0 a3=1 items=0 ppid=1 pid=1094 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=modem-manager exe=/usr/sbin/modem-manager subj=system_u:system_r:modemmanager_t:s0-s0:c0.c1023 key=(null)

Hash: modem-manager,modemmanager_t,device_t,chr_file,read,write

audit2allow

#============= modemmanager_t ==============
allow modemmanager_t device_t:chr_file { read write };

audit2allow -R

#============= modemmanager_t ==============
allow modemmanager_t device_t:chr_file { read write };

Comment 1 Miroslav Grepl 2011-05-06 11:54:54 UTC
ls -Z /dev/ttyS1 
crw-rw----. root dialout system_u:object_r:tty_device_t:s0 /dev/ttyS1

Execute

# restorecon -R -v /dev/ttyS1


Reopen if this happens again.

Comment 2 cgrim 2011-05-06 16:35:08 UTC
I tried it before posting this bug report but it did nothing.

Tried it again and still the same:

# ls -Z /dev/ttyS1 
crw-rw----. root dialout system_u:object_r:tty_device_t:s0 /dev/ttyS1

I have installed selinux-policy-targeted-3.9.16-21.fc15

Comment 3 Daniel Walsh 2011-05-06 18:55:03 UTC
Looks like a race condition on the creation of the tty before udev realizes and fixes the label.