Bug 712714

Summary: SELinux is preventing /usr/bin/boinc_client from read, write access on the chr_file nvidia0.
Product: [Fedora] Fedora Reporter: Peter Clark <pclark>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: dominick.grift, dwalsh, germano.massullo, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:362dbfb3a109912f64a24fd855b38553e53f9c2c1bb27fa6cffd4c30848cbb83
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-13 20:20:31 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 Peter Clark 2011-06-12 16:24:39 UTC
SELinux is preventing /usr/bin/boinc_client from read, write access on the chr_file nvidia0.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that boinc_client should be allowed read write access on the nvidia0 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                unconfined_u:system_r:boinc_t:s0
Target Context                system_u:object_r:xserver_misc_device_t:s0
Target Objects                nvidia0 [ chr_file ]
Source                        boinc_client
Source Path                   /usr/bin/boinc_client
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           boinc-client-6.10.58-3.r22930svn.fc14
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.7-42.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.13-92.fc14.x86_64 #1
                              SMP Sat May 21 17:26:25 UTC 2011 x86_64 x86_64
Alert Count                   1
First Seen                    Sun 12 Jun 2011 12:19:32 PM EDT
Last Seen                     Sun 12 Jun 2011 12:19:32 PM EDT
Local ID                      d31bb53b-b734-42de-9589-b52644d379a0

Raw Audit Messages
type=AVC msg=audit(1307895572.373:529): avc:  denied  { read write } for  pid=21637 comm="boinc_client" name="nvidia0" dev=devtmpfs ino=16807 scontext=unconfined_u:system_r:boinc_t:s0 tcontext=system_u:object_r:xserver_misc_device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1307895572.373:529): arch=x86_64 syscall=open success=no exit=EACCES a0=7fff869cd800 a1=2 a2=7fff869cd80c a3=0 items=0 ppid=1 pid=21637 auid=500 uid=483 gid=473 euid=483 suid=483 fsuid=483 egid=473 sgid=473 fsgid=473 tty=(none) ses=9 comm=boinc_client exe=/usr/bin/boinc_client subj=unconfined_u:system_r:boinc_t:s0 key=(null)

Hash: boinc_client,boinc_t,xserver_misc_device_t,chr_file,read,write

audit2allow

#============= boinc_t ==============
#!!!! This avc is allowed in the current policy

allow boinc_t xserver_misc_device_t:chr_file { read write };

audit2allow -R

#============= boinc_t ==============
#!!!! This avc is allowed in the current policy

allow boinc_t xserver_misc_device_t:chr_file { read write };

Comment 1 Miroslav Grepl 2011-06-13 05:57:49 UTC
Peter,
how are labeled /var/lib/boinc/projects and /var/lib/boinc/slots directories

# ls -lZ /var/lib/boinc/

Comment 2 Peter Clark 2011-06-13 20:14:22 UTC
Greetings,

As requested:

[pclark@c3po ~]$ ls -lZ /var/lib/boinc/
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 account_einstein.phys.uwm.edu.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 account_setiathome.berkeley.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 acct_mgr_login.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 acct_mgr_reply.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 acct_mgr_request.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 acct_mgr_url.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 all_projects_list.xml
-rw-r--r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 binstall.sh
-rwxr-xr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boinc
-rwxr-xr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boinccmd
-rwxr-xr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boincmgr
-rw-r--r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boincmgr.16x16.png
-rw-r--r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boincmgr.32x32.png
-rw-r--r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 boincmgr.48x48.png
-rw-r--r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 ca-bundle.crt
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 client_state_prev.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 client_state.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 create_account.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 daily_xfer_history.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 get_current_version.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 get_project_config.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 global_prefs_override.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 global_prefs.xml
-rw-------. boinc boinc system_u:object_r:boinc_var_lib_t:s0 gui_rpc_auth.cfg
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 job_log_einstein.phys.uwm.edu.txt
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 job_log_setiathome.berkeley.edu.txt
-rwxr-xr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 libcudart.so
drwxr-xr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 locale
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 lockfile
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 lookup_account.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 lookup_website.html
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 master_einstein.phys.uwm.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 master_setiathome.berkeley.edu.xml
drwxrwx--x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 notices
drwxrwx--x. boinc boinc system_u:object_r:boinc_project_var_lib_t:s0 projects
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 remote_hosts.cfg
-rwxrwxr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 run_client
-rwxrwxr-x. boinc boinc system_u:object_r:boinc_var_lib_t:s0 run_manager
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 sched_reply_einstein.phys.uwm.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 sched_reply_setiathome.berkeley.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 sched_request_einstein.phys.uwm.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 sched_request_setiathome.berkeley.edu.xml
drwxrwx--x. boinc boinc system_u:object_r:boinc_project_var_lib_t:s0 slots
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 statistics_einstein.phys.uwm.edu.xml
-rw-r--r--. boinc boinc unconfined_u:object_r:boinc_var_lib_t:s0 statistics_setiathome.berkeley.edu.xml
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 stderrdae.txt
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 stdoutdae.txt
-rw-rw-r--. boinc boinc system_u:object_r:boinc_var_lib_t:s0 time_stats_log
[pclark@c3po ~]$


After creating the exception with audit2allow it also needed access to the /dev/nvidiactl file before boinc could detect the GPU, which is what it's attempting to do when accessing these files at startup.

P

Comment 3 Miroslav Grepl 2011-06-13 20:20:31 UTC
Ok,
could you run 

# restorecon -R -v /var/lib/boinc/

will fix. Thank you.

Comment 4 Germano Massullo 2011-08-08 11:30:48 UTC
Hi, is my problem identical to the one of the bug reporter?





SELinux is preventing /var/lib/boinc/projects/einstein.phys.uwm.edu/einsteinbinary_BRP4_1.00_i686-pc-linux-gnu__BRP3cuda32nv270 from ioctl access on the chr_file /dev/nvidia0.

***** Plugin restorecon (90.5 confidence) suggests *************************

If you want to fix the label.
/dev/nvidia0 default label should be xserver_misc_device_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /dev/nvidia0

***** Plugin device (9.50 confidence) suggests *****************************

If you want to allow einsteinbinary_BRP4_1.00_i686-pc-linux-gnu__BRP3cuda32nv270 to have ioctl access on the nvidia0 chr_file
Then you need to change the label on /dev/nvidia0 to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE '/dev/nvidia0'
# restorecon -v '/dev/nvidia0'

***** Plugin catchall (1.40 confidence) suggests ***************************

If you believe that einsteinbinary_BRP4_1.00_i686-pc-linux-gnu__BRP3cuda32nv270 should be allowed ioctl access on the nvidia0 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 einsteinbinary_ /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Contesto della sorgente system_u:system_r:boinc_project_t:s0
Contesto target system_u:object_r:device_t:s0
Oggetti target /dev/nvidia0 [ chr_file ]
Sorgente einsteinbinary_
Percorso della sorgente /var/lib/boinc/projects/einstein.phys.uwm.edu/eins
teinbinary_BRP4_1.00_i686-pc-linux-
gnu__BRP3cuda32nv270
Porta <Sconosciuto>
Host Magic-4
Sorgente Pacchetti RPM
Pacchetti RPM target
RPM della policy selinux-policy-3.9.16-35.fc15
Selinux abilitato True
Tipo di policy targeted
Modalità Enforcing Permissive
Host Name Magic-4
Piattaforma Linux Magic-4 2.6.40-4.fc15.x86_64 #1 SMP Fri Jul
29 18:46:53 UTC 2011 x86_64 x86_64
Conteggio avvisi 1
Primo visto lun 08 ago 2011 13:22:23 CEST
Ultimo visto lun 08 ago 2011 13:22:23 CEST
ID locale 999a0435-5d82-47f6-a73a-4891c70d71b7

Messaggi Raw Audit
type=AVC msg=audit(1312802543.879:93): avc: denied { ioctl } for pid=2929 comm="einsteinbinary_" path="/dev/nvidia0" dev=devtmpfs ino=19404 scontext=system_u:system_r:boinc_project_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1312802543.879:93): arch=i386 syscall=setsockopt success=yes exit=0 a0=d a1=c0304627 a2=ffd608d8 a3=c1d00071 items=0 ppid=2249 pid=2929 auid=4294967295 uid=494 gid=491 euid=494 suid=494 fsuid=494 egid=491 sgid=491 fsgid=491 tty=(none) ses=4294967295 comm=einsteinbinary_ exe=/var/lib/boinc/projects/einstein.phys.uwm.edu/einsteinbinary_BRP4_1.00_i686-pc-linux-gnu__BRP3cuda32nv270 subj=system_u:system_r:boinc_project_t:s0 key=(null)

Hash: einsteinbinary_,boinc_project_t,device_t,chr_file,ioctl

audit2allow

#============= boinc_project_t ==============
allow boinc_project_t device_t:chr_file ioctl;

audit2allow -R

#============= boinc_project_t ==============
allow boinc_project_t device_t:chr_file ioctl;