Bug 1140257 - SELinux is preventing /usr/bin/boinc_client from 'ioctl' accesses on the chr_file .
Summary: SELinux is preventing /usr/bin/boinc_client from 'ioctl' accesses on the chr_...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:3a49a05e32929442134112c4f5a...
: 1140253 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-10 15:18 UTC by GuL
Modified: 2015-06-29 22:28 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-06-29 22:28:11 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
grep 1412356 /var/log/audit/audit.log | grep boinc | grep AVC > boinc-AVC.log (5.09 KB, text/plain)
2014-10-03 17:33 UTC, GuL
no flags Details

Description GuL 2014-09-10 15:18:33 UTC
Description of problem:
Hello,
When starting boinc-client (Berkeley Open Infrastructure for Network Computing), the service check if there is a usable gpu. In my case, I have a Nvidia 8400 GS card, cuda compatible.

Cuda 6.5 has been installed following http://www.r-tutor.com/gpu-computing/cuda-installation/cuda6.5-fc20. I am using boinc-client.x86_64-7.2.42-1.gitdd0d630.fc20, kmod-nvidia.x86_64-1:340.29-2.fc20 and selinux-policy.noarch-3.12.1-183.fc20.

Additionnal access are needed to compute using a nvidia gpu :
allow boinc_t sysctl_modprobe_t:file read;
allow boinc_t device_t:chr_file ioctl;
allow boinc_t device_t:chr_file { read write getattr open };

Thanks
SELinux is preventing /usr/bin/boinc_client from 'ioctl' accesses on the chr_file .

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

If you want to allow boinc_client to have ioctl access on the  chr_file
Then vous devez modifier l'étiquette sur  en un type de périphérique similaire.
Do
# semanage fcontext -a -t SIMILAR_TYPE '$FIX_TARGET_PATH'
# restorecon -v '$FIX_TARGET_PATH'

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

If vous pensez que boinc_client devrait être autorisé à accéder ioctl sur  chr_file par défaut.
Then vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Do
autoriser cet accès pour le moment en exécutant :
# 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                 [ chr_file ]
Source                        boinc_client
Source Path                   /usr/bin/boinc_client
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           boinc-client-7.2.42-1.gitdd0d630.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-183.fc20.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 3.15.10-201.fc20.x86_64 #1 SMP Wed
                              Aug 27 21:10:06 UTC 2014 x86_64 x86_64
Alert Count                   3
First Seen                    2014-09-10 16:25:15 CEST
Last Seen                     2014-09-10 16:25:39 CEST
Local ID                      26ae0397-9439-4604-a1a6-1eec4e46fa7a

Raw Audit Messages
type=AVC msg=audit(1410359139.467:1081): avc:  denied  { ioctl } for  pid=1863 comm="boinc_client" path="/dev/nvidia-uvm" dev="devtmpfs" ino=29387 scontext=system_u:system_r:boinc_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1410359139.467:1081): arch=x86_64 syscall=ioctl success=yes exit=0 a0=8 a1=30000001 a2=0 a3=0 items=0 ppid=1857 pid=1863 auid=4294967295 uid=987 gid=984 euid=987 suid=987 fsuid=987 egid=984 sgid=984 fsgid=984 tty=(none) ses=4294967295 comm=boinc_client exe=/usr/bin/boinc_client subj=system_u:system_r:boinc_t:s0 key=(null)

Hash: boinc_client,boinc_t,device_t,chr_file,ioctl

Additional info:
reporter:       libreport-2.2.3
hashmarkername: setroubleshoot
kernel:         3.15.10-201.fc20.x86_64
type:           libreport

Comment 1 Daniel Walsh 2014-09-13 11:00:58 UTC
restorecon /dev/nvidia-uvm

Should fix the problem.  This is a race condition between boinc and udev as far as fixing the label on this nvidia device.

Comment 2 GuL 2014-09-15 12:36:10 UTC
Indeed,
here is the output of restorecon -v /dev/nvidia-uvm.
restorecon reset /dev/nvidia-uvm context system_u:object_r:device_t:s0->system_u:object_r:xserver_misc_device_t:s0

That's strange since I have done a touch /.autorelabel a few days ago.

Restart of the service seems to work without error messages after removing first post custom rules with semodule -r boinc-gul

Thanks

Comment 3 GuL 2014-09-17 13:28:44 UTC
Hi Daniel,
Here is some additional information. 

Despite the local policy I have added, boinc was still unable to see the gpu when rebooting. BUT it works fine after restarting boinc-client.service.

So I have reinstalled selinux-policy and selinux-policy-targeted 3.12.1-183.fc20 and put selinux to permissive mode. 

After a reboot, /dev/nvidia-uvm has again the wrong context.
Here are audit2allow found rules for boinc:
allow boinc_t device_t:chr_file { write getattr setattr read create open ioctl }
;
allow boinc_t device_t:dir { write add_name };
allow boinc_t modules_conf_t:dir read;
allow boinc_t modules_conf_t:file { read open };
allow boinc_t modules_object_t:file { read open };
allow boinc_t self:capability { mknod chown };
allow boinc_t sysctl_modprobe_t:file { read getattr open };

Nevertheless, it is NOT working with selinux set to enforced mode.

Cheers,
GuL

Comment 4 GuL 2014-09-17 13:30:28 UTC
*** Bug 1140253 has been marked as a duplicate of this bug. ***

Comment 5 GuL 2014-10-03 17:33:40 UTC
Created attachment 943764 [details]
grep 1412356 /var/log/audit/audit.log | grep boinc | grep AVC > boinc-AVC.log

Hi, after updating to selinux-policy-3.12.1-188.fc20, full selinux relabel and reboot, I still have the following errors concerning boinc.

#============= boinc_t ==============
allow boinc_t device_t:chr_file { write getattr setattr read create open ioctl }
;
allow boinc_t device_t:dir { write add_name };
allow boinc_t modules_conf_t:dir read;
allow boinc_t modules_conf_t:file { read open };
allow boinc_t modules_object_t:file { read open };
allow boinc_t self:capability { mknod chown };
allow boinc_t sysctl_modprobe_t:file { read getattr open };

audit.log has been restricted to the relevant date.

Cheers

Comment 6 Fedora End Of Life 2015-05-29 12:50:34 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-06-29 22:28:11 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.