Bug 694918 (nvidida_bad_label)

Summary: SELinux is preventing /usr/libexec/gnome-session-check-accelerated-helper from read, write access on the chr_file nvidiactl.
Product: [Fedora] Fedora Reporter: Bogdan Agica <bogdan.agica>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: agpotter, AppelonD, belegdol, bling.nuke, brad, bugzilla, bulk, chris, daniel, defiant, didierg-divers, dmitryburstein, doctorcito777, dwalsh, edosurina, evfirerob, igeorgex, jjcf89, Lcstyle, leigh123linux, linux, marbolangos, mark, mgrepl, mikhail.v.gavrilov, mkaczma, ms, my_linux, nanochase, nanopqr, old.uncle.z, phdoerfler, phil, pichuginn, robin.bowes, rtmetz92, rvcsaba, sanjay.ankur, scbunn, shakka.by, shnurapet, slawomir.czarko, taviso, ubek1, yoshiosan
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:7095cb86daa476d5032c402a1fd9401d81368e96c834bf1ed17ac95dde23f2ff
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-11 06:07: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:
Embargoed:

Description Bogdan Agica 2011-04-08 21:05:47 UTC
SELinux is preventing /usr/libexec/gnome-session-check-accelerated-helper from read, write access on the chr_file nvidiactl.

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

If you want to allow gnome-session-check-accelerated-helper to have read write 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 gnome-session-check-accelerated-helper should be allowed read write 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:
# grep gnome-session-c /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                        gnome-session-c
Source Path                   /usr/libexec/gnome-session-check-accelerated-
                              helper
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           gnome-session-3.0.0-1.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-12.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.2-9.fc15.i686 #1 SMP
                              Wed Mar 30 16:54:01 UTC 2011 i686 i686
Alert Count                   1
First Seen                    Thu 07 Apr 2011 09:30:49 PM EDT
Last Seen                     Thu 07 Apr 2011 09:30:49 PM EDT
Local ID                      75f02bfa-aea6-45e6-ad02-bc26d2cadf9c

Raw Audit Messages
type=AVC msg=audit(1302226249.368:37): avc:  denied  { read write } for  pid=1277 comm="gnome-session-c" name="nvidiactl" dev=devtmpfs ino=16988 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1302226249.368:37): arch=i386 syscall=open success=no exit=EACCES a0=bff47bd8 a1=8002 a2=0 a3=bff47bd8 items=0 ppid=1262 pid=1277 auid=4294967295 uid=42 gid=42 euid=42 suid=42 fsuid=42 egid=42 sgid=42 fsgid=42 tty=(none) ses=4294967295 comm=gnome-session-c exe=/usr/libexec/gnome-session-check-accelerated-helper subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

Hash: gnome-session-c,xdm_t,device_t,chr_file,read,write

audit2allow

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

audit2allow -R

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

Comment 1 Miroslav Grepl 2011-04-11 06:07:31 UTC
Probably something broken in nvidia module that creates the device rather then
having udev create the device.

Fortunately there are some solutions for this issue.

1. You could add /dev/nvidiactl to /etc/selinux/restorecond.conf and run the
restorecond service.

chkconfig restorecond --add
service restorecond start

2. If  you see in the scripts where nvidiactl is created, you could add a
restorecon right afterwards.

3. Or you can add a local policy module using

# grep gnome-session-c /var/log/audit/audit.log | audit2alllow -M
nvidiaisbroken
# semodule -i nvidiaisbroken.pp

Comment 2 Miroslav Grepl 2011-05-05 05:46:17 UTC
*** Bug 702062 has been marked as a duplicate of this bug. ***

Comment 3 Miroslav Grepl 2011-05-28 13:13:59 UTC
*** Bug 708561 has been marked as a duplicate of this bug. ***

Comment 4 Didier G 2011-06-09 09:42:21 UTC
I get similar problem but with ATI Catalyst driver installed by RPM from RPMfusion :

type=AVC msg=audit(1307320722.977:49): avc:  denied  { open } for  pid=1798 comm="gnome-session-c" name="card0" dev=devtmpfs ino=18240 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=chr_file

type=SYSCALL msg=audit(1307320722.977:49): arch=c000003e syscall=2 success=no exit=-13 a0=7fff68103c70 a1=2 a2=0 a3=7fbc8f98a3ac items=0 ppid=1794 pid=1798 auid=4294967295 uid=42 gid=42 euid=42 suid=42 fsuid=42 egid=42 sgid=42 fsgid=42 tty=(none) ses=4294967295 comm="gnome-session-c" exe="/usr/libexec/gnome-session-check-accelerated-helper" subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

As this problem occurs with both nVidia and ATI drivers, I assume this problem is not a driver problem but a gnome-session-check-accelerated-helper problem.

Comment 5 Miroslav Grepl 2011-06-13 08:58:10 UTC
The problem is /dev/card0 is mislabeled. 

# matchpathcon /dev/card0
/dev/card0	system_u:object_r:xserver_misc_device_t:s0

So 

# restorecon -R -v /dev/card0

will fix and you will see if the label will change back to device_t.

Comment 6 Miroslav Grepl 2011-10-05 06:03:36 UTC
*** Bug 743244 has been marked as a duplicate of this bug. ***