| Summary: | SELinux is preventing nvidia-modprobe from 'create' accesses on the chr_file nvidiactl. | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Dmitry Shishkin <dmitry> |
| Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> |
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | 23 | CC: | dmitry, dominick.grift, dwalsh, ferdnyc, lvrabec, mathew.alexander, mgrepl, plautrba |
| Target Milestone: | --- | Flags: | lvrabec:
needinfo?
(dmitry) |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Unspecified | ||
| Whiteboard: | abrt_hash:27db5c271ad7bf260aedfed8cb997592bb098ff5b3f2913f95c073ef87f14b13;VARIANT_ID=workstation; | ||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-12-20 19:52:33 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Hi, Where is 'nvidia-modprobe' stored? I would say nvidia-modprobe should have xserver_t domain instead of xdm_t. (In reply to Lukas Vrabec from comment #1) > Hi, > Where is 'nvidia-modprobe' stored? > I would say nvidia-modprobe should have xserver_t domain instead of xdm_t. Thanks for looking at this, Lukas. I recently hit a similar SELinux denial on my F22 machine with xorg-x11-drv-nvidia-340xx-340.96-1.fc22.x86_64 (and friends) installed from rpmfusion. nvidia-modprobe itself actually lives in the xorg-x11-drv-nvidia-340xx-cuda-340.96-1.fc22.x86_64 RPM, not the main driver RPM, and it's not entirely clear to me whether it's even part of the normal GPU driver operation. It may be something CUDA-specific that isn't really necessary. (I don't do anything with CUDA.) But the CUDA RPM is a dependency for xorg-x11-drv-nvidia-340xx-devel, and that one I'd rather not remove. The exact denial in my case was a write access request on /dev. My /dev/nvidiactl has the context system_u:object_r:xserver_misc_device_t:s0 which differs from the original report and may explain the difference. Regardless, the details on nvidia-modprobe match. I'll do my best to answer your questions, at least from my perspective (which hopefully is close enough to Dmitry's to be applicable.) 1. nvidia-modprobe (at least in the rpmfusion install) lives in /usr/bin/, it's setuid root and has the context system_u:object_r:bin_t:s0. 2. The source context from the report may be explained by one additional piece of information from my report, which doesn't appear in the original. Note this syscall log: type=SYSCALL msg=audit(1461818353.699:745): arch=x86_64 syscall=mknod success=no exit=EACCES a0=7fffd95d1f00 a1=21b6 a2=c3ff a3=1999999999999999 items=0 ppid=1829 pid=1841 auid=4294967295 uid=42 gid=42 euid=0 suid=0 fsuid=0 egid=42 sgid=42 fsgid=42 tty=tty1 ses=4294967295 comm=nvidia-modprobe exe=/usr/bin/nvidia-modprobe subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null) nvidia-modprobe is being executed by the gdm user (42), not by the logged-in user. AFAICT all of gdm's processes run under the system_u:system_r:xdm_t:s0-s0:c0.c1023 context, which I assume would then be propagated to /usr/bin/nvidia-modprobe when it's executed? As for what nvidia-modprobe does, the one-line summary from its man page is, "Load the NVIDIA kernel module and create NVIDIA character device files." And the Description section reads (in part): ======== The nvidia-modprobe utility is used by user-space NVIDIA driver components to make sure the NVIDIA kernel module is loaded and that the NVIDIA character device files are present. These facilities are normally provided by Linux distribution configuration systems such as udev. When possible, it is recommended to use your Linux distribution's native mechanisms for managing kernel module loading and device file creation. This utility is provided as a fallback to work out-of-the-box in a distribution-independent way. When installed by nvidia-installer , nvidia-modprobe is installed setuid root. Users should not normally need to run nvidia-modprobe by hand: the NVIDIA user-space driver components will fork(2)/exec(3) it when needed. ======== In my case, the SELinux alerts came AFTER a system error that involved a lengthy gnome-shell and/or Xorg freeze, followed by an eventual crash. The denials came AFTER this occurred; nvidia-modprobe definitely didn't cause it (nor did the denials), and in fact they appear to have been part of "the user-space driver components" attempting some sort of automated recovery. An unsuccessful one, since as I recall I ended up just rebooting the machine. Problem still exists:
Fedora 24
Nvidia 960
SELinux Policy version 3.13.1-191.19.fc24
output of SEtroubleshoot:
SELinux is preventing nvidia-modprobe from create access on the chr_file nvidiactl.
***** Plugin device (91.4 confidence) suggests ****************************
If you want to allow nvidia-modprobe to have create access on the nvidiactl chr_file
Then you need to change the label on nvidiactl to a type of a similar device.
Do
# semanage fcontext -a -t SIMILAR_TYPE 'nvidiactl'
# restorecon -v 'nvidiactl'
***** Plugin catchall (9.59 confidence) suggests **************************
If you believe that nvidia-modprobe should be allowed create access on the nvidiactl 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:
# ausearch -c 'nvidia-modprobe' --raw | audit2allow -M my-nvidiamodprobe
# semodule -X 300 -i my-nvidiamodprobe.pp
Additional Information:
Source Context system_u:system_r:xdm_t:s0-s0:c0.c1023
Target Context system_u:object_r:device_t:s0
Target Objects nvidiactl [ chr_file ]
Source nvidia-modprobe
Source Path nvidia-modprobe
Port <Unknown>
Host kerberos.fixitbear.com
Source RPM Packages
Target RPM Packages
Policy RPM selinux-policy-3.13.1-191.19.fc24.noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name kerberos.fixitbear.com
Platform Linux kerberos.fixitbear.com 4.8.4-200.fc24.x86_64
#1 SMP Tue Oct 25 13:06:04 UTC 2016 x86_64 x86_64
Alert Count 252
First Seen 2016-10-07 16:28:06 PDT
Last Seen 2016-11-06 06:49:09 PST
Local ID 93edcacc-ea99-43b9-b9f6-4fe38cb0ed44
Raw Audit Messages
type=AVC msg=audit(1478443749.356:208): avc: denied { create } for pid=1298 comm="nvidia-modprobe" name="nvidiactl" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=0
Hash: nvidia-modprobe,xdm_t,device_t,chr_file,create
(In reply to Mathew Alexander from comment #3) > Problem still exists: > > Fedora 24 > Nvidia 960 > SELinux Policy version 3.13.1-191.19.fc24 > > output of SEtroubleshoot: > > SELinux is preventing nvidia-modprobe from create access on the chr_file > nvidiactl. > > ***** Plugin device (91.4 confidence) suggests > **************************** > > If you want to allow nvidia-modprobe to have create access on the nvidiactl > chr_file > Then you need to change the label on nvidiactl to a type of a similar device. > Do > # semanage fcontext -a -t SIMILAR_TYPE 'nvidiactl' > # restorecon -v 'nvidiactl' > > ***** Plugin catchall (9.59 confidence) suggests > ************************** > > If you believe that nvidia-modprobe should be allowed create access on the > nvidiactl 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: > # ausearch -c 'nvidia-modprobe' --raw | audit2allow -M my-nvidiamodprobe > # semodule -X 300 -i my-nvidiamodprobe.pp > > Additional Information: > Source Context system_u:system_r:xdm_t:s0-s0:c0.c1023 > Target Context system_u:object_r:device_t:s0 > Target Objects nvidiactl [ chr_file ] > Source nvidia-modprobe > Source Path nvidia-modprobe > Port <Unknown> > Host kerberos.fixitbear.com > Source RPM Packages > Target RPM Packages > Policy RPM selinux-policy-3.13.1-191.19.fc24.noarch > Selinux Enabled True > Policy Type targeted > Enforcing Mode Enforcing > Host Name kerberos.fixitbear.com > Platform Linux kerberos.fixitbear.com > 4.8.4-200.fc24.x86_64 > #1 SMP Tue Oct 25 13:06:04 UTC 2016 x86_64 > x86_64 > Alert Count 252 > First Seen 2016-10-07 16:28:06 PDT > Last Seen 2016-11-06 06:49:09 PST > Local ID 93edcacc-ea99-43b9-b9f6-4fe38cb0ed44 > > Raw Audit Messages > type=AVC msg=audit(1478443749.356:208): avc: denied { create } for > pid=1298 comm="nvidia-modprobe" name="nvidiactl" > scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 > tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=0 > > > Hash: nvidia-modprobe,xdm_t,device_t,chr_file,create Actually, may be an issue with the way the Nvidia drivers were installed, used the .bin file from Nvidia, not the repository. This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. 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 '23'. 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 23 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. Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 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. |
Description of problem: SELinux is preventing nvidia-modprobe from 'create' accesses on the chr_file nvidiactl. ***** Plugin device (91.4 confidence) suggests **************************** If you want to allow nvidia-modprobe to have create access on the nvidiactl chr_file Then необходимо изменить метку для nvidiactl на тип аналогичного устройства. Do # semanage fcontext -a -t SIMILAR_TYPE 'nvidiactl' # restorecon -v 'nvidiactl' ***** Plugin catchall (9.59 confidence) suggests ************************** If вы считаете, что nvidia-modprobe следует разрешить доступ create к nvidiactl chr_file по умолчанию. Then рекомендуется создать отчет об ошибке. Чтобы разрешить доступ, можно создать локальный модуль политики. Do чтобы разрешить доступ, выполните: # grep nvidia-modprobe /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Additional Information: Source Context system_u:system_r:xdm_t:s0-s0:c0.c1023 Target Context system_u:object_r:device_t:s0 Target Objects nvidiactl [ chr_file ] Source nvidia-modprobe Source Path nvidia-modprobe Port <Unknown> Host (removed) Source RPM Packages Target RPM Packages Policy RPM selinux-policy-3.13.1-158.12.fc23.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name (removed) Platform Linux (removed) 4.4.6-300.fc23.x86_64 #1 SMP Wed Mar 16 22:10:37 UTC 2016 x86_64 x86_64 Alert Count 4 First Seen 2016-04-08 16:58:46 MSK Last Seen 2016-04-08 16:58:46 MSK Local ID 061829a5-79dc-410c-a891-41ebb8aaca5f Raw Audit Messages type=AVC msg=audit(1460123926.715:293): avc: denied { create } for pid=1471 comm="nvidia-modprobe" name="nvidiactl" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file permissive=0 Hash: nvidia-modprobe,xdm_t,device_t,chr_file,create Version-Release number of selected component: selinux-policy-3.13.1-158.12.fc23.noarch Additional info: reporter: libreport-2.6.4 hashmarkername: setroubleshoot kernel: 4.4.6-300.fc23.x86_64 type: libreport