Bug 118372

Summary: VUL-0: wrong permissions on /dev/nvidia*
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Robert Simai <robert.simai>
Component: X11 3rd PartyAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P2 - High CC: aritger, forgotten_--EoyBps8f, security-team
Version: RC 4   
Target Milestone: ---   
Hardware: i686   
OS: Linux   
Whiteboard: CVE-2007-3532: CVSS v2 Base Score: 7.2 (AV:L/AC:L/Au:N/C:C/I:C/A:C)
Found By: SUSE Technical Services Services Priority: 1000
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: static_devices.txt from /etc/udev
right after booting
after running makedevices.sh

Description Robert Simai 2005-09-22 09:17:07 UTC
After update 9.3 -> 10.0 the permissions for the nvidia devs look like this:

theano:~ # l /dev/nvidia*
crw-rw-rw-  1 root root 195,   0 2005-09-22 10:05 /dev/nvidia0
crw-rw-rw-  1 root root 195, 255 2005-09-22 10:05 /dev/nvidiactl

I'm quite sure this is not intended. Let me know if you need further information.
Comment 1 Dr. Werner Fink 2005-09-22 09:55:34 UTC
What is used: static devs or dynamic udev/devfs
Comment 2 Robert Simai 2005-09-22 10:13:19 UTC
How can I find this out?
Comment 3 Hubert Mantel 2005-09-27 11:11:16 UTC
Default is udev nowadays.
Comment 4 Hannes Reinecke 2005-09-29 07:38:03 UTC
Correct.
Comment 5 Kay Sievers 2005-10-21 02:57:01 UTC
Does this issue still exist?
Comment 6 Robert Simai 2005-10-21 06:36:32 UTC
Well, since nothing has changed till now, yes, the issue persists and exists. If you need more information from my side please tell me what exactly you want and I will try to provide it.
Comment 7 Kay Sievers 2005-10-21 11:54:29 UTC
What does:
  find /sys -name "nvidia0"
print?

And what does:
  udevtest /class/<whatever>/nvidia0 <whatever>
print?

Here is an example for a joystick:
  find /sys -name "js*"
  /sys/class/input/js0

  udevtest /class/input/js0 input
  udev_rules_get_name: rule applied, 'js0' becomes 'input/js0'
  create_node: creating device node '/dev/input/js0', mode = '0644', uid = '0'
Comment 8 Robert Simai 2005-10-21 14:39:16 UTC
theano:~ # find /sys -name "nvidia0"
theano:~ #
(no output)

theano:~ # find /sys -name "nvidia*"
/sys/module/nvidia
/sys/bus/pci/drivers/nvidia

theano:~ # udevtest /sys/module/nvidia module
main: looking at device '/module/nvidia' from subsystem 'module'
main: opened class_dev->name='nvidia'
main: only char and block devices with a dev-file are supported by this test program

theano:~ # udevtest /sys/bus/pci/drivers/nvidia bus
main: looking at device '/bus/pci/drivers/nvidia' from subsystem 'bus'
main: opened class_dev->name='nvidia'
main: only char and block devices with a dev-file are supported by this test program

Comment 9 Kay Sievers 2005-10-21 15:00:53 UTC
Ok, these nodes don't come from udev. Please find out which init-script creates
them and try to add the right permission settings to the init script.
Comment 10 Robert Simai 2005-10-21 15:13:44 UTC
Sorry, but I'm not the one to fix this. I'm just the reporter of this update problem. Please set needinfo to someone in R&D. Thanks.
Comment 11 Kay Sievers 2005-10-21 15:35:58 UTC
No idea, who creates the nodes, it's not udev. I expect a init-script or similar.
Reassign to default.
Comment 12 Dr. Werner Fink 2005-10-21 15:44:52 UTC
Ahmmm ... should I use a cristal ball?  There is NO such script.
Comment 13 Robert Simai 2005-10-21 16:12:50 UTC
Don't know if it's a script or not. But for sure something happens to the nodes during boot. The last boot was on exactly the date/time the nodes show with ls -l.
Comment 14 Stefan Dirsch 2005-10-21 16:20:29 UTC
You're usnig the nvidia driver, who creates these nodes. Where's the problem?
Comment 15 Robert Simai 2005-10-21 16:31:21 UTC
The 666 permissions are the problem and I consider this as a high security risk. You should forward this information to the guys that are developing the driver to let them know that this is nonsense. IMO it's our responsibility to take care about this since we offer the possibility to install the driver automatically via YOU without the warning that the system is now insecure because of the carelessness of some (Nvidia)developers.

However, you surely will know the right thing to do here ;-)
Comment 16 Stefan Dirsch 2005-10-21 16:39:11 UTC
Andy, is it possible to configure ownership and permissions of /dev/nvidia* devices for the driver?

BTW, specifying ownership with /etc/udev/static_devices.txt is not possible as well. Hope that this gets fixed for the future.
Comment 17 andy ritger 2005-10-21 17:19:05 UTC
From the FAQ of the NVIDIA driver README (ftp://download.nvidia.com/XFree86/Linux-x86/1.0-7676/README.txt):


Q. How and when are the the NVIDIA device files created?

A. Depending on the target system's configuration, the NVIDIA device files
   used to be created in one of three different ways:
   
       at installation time, using mknod
   
       at module load time, via devfs (Linux device file system)
    
       at module load time, via hotplug/udev
   
   With currrent NVIDIA driver releases, device files are created or modified
   by the X driver when the X server is started.

   By default, the NVIDIA driver will attempt to create device files with the
   following attributes:

         UID:  0     - 'root'
         GID:  0     - 'root'
         Mode: 0666  - 'rw-rw-rw-'

   Existing device files are changed if their attributes don't match these
   defaults. If you wish for the NVIDIA driver to create the device files with
   different attributes, you can specify them with the "NVreg_DeviceFileUID"
   (user), "NVreg_DeviceFileGID" (group) and "NVreg_DeviceFileMode" NVIDIA
   Linux kernel module parameters.

   For example, the NVIDIA driver can be instructed to create device files
   with UID=0 (root), GID=44 (video) and Mode=0660 by passing the following
   module parameters to the NVIDIA Linux kernel module:
    
         NVreg_DeviceFileUID=0 
         NVreg_DeviceFileGID=44 
         NVreg_DeviceFileMode=0660

   The "NVreg_ModifyDeviceFiles" NVIDIA kernel module parameter will disable
   dynamic device file management, if set to 0.


I hope that helps,
- Andy
Comment 18 Stefan Dirsch 2005-10-21 17:36:41 UTC
Oops. Didn't know that is configurable and even documented. :-) We'll need

NVreg_DeviceFileUID=0 
NVreg_DeviceFileGID=33
NVreg_DeviceFileMode=0660

So an enty

options nvidia \
  NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=33 NVreg_DeviceFileMode=0660

in /etc/modprobe.conf should help.
Comment 19 Stefan Dirsch 2005-10-22 11:09:39 UTC
Something like /etc/modprobe.d/nvidia should be used instead. I'll add this
to package "tiny-nvidia-installer" for 10.1.
Comment 21 Stefan Dirsch 2005-10-23 09:12:49 UTC
fixed for 10.1
Comment 24 Ludwig Nussel 2005-11-02 14:04:13 UTC
updates released
Comment 25 Thomas Biege 2005-11-04 11:01:12 UTC
On my SL 9.3 x86 I got the same problem:

spiral:~ # l /dev/nvidia*
crw-rw-rw-  1 root root  195,   0 Jul 28 16:52 /dev/nvidia0
crw-rw----  1 root video 195,   0 Mar 19  2005 /dev/nvidia00
crw-rw----  1 root video 195,   1 Mar 19  2005 /dev/nvidia01
crw-rw----  1 root video 195,   2 Mar 19  2005 /dev/nvidia02
crw-rw----  1 root video 195,   3 Mar 19  2005 /dev/nvidia03
crw-rw-rw-  1 root root  195,   1 Jul 28 16:52 /dev/nvidia1
crw-rw-rw-  1 root root  195,   2 Jul 28 16:52 /dev/nvidia2
crw-rw-rw-  1 root root  195,   3 Jul 28 16:52 /dev/nvidia3
crw-rw-rw-  1 root root  195,   4 Jul 28 16:52 /dev/nvidia4
crw-rw-rw-  1 root root  195,   5 Jul 28 16:52 /dev/nvidia5
crw-rw-rw-  1 root root  195,   6 Jul 28 16:52 /dev/nvidia6
crw-rw-rw-  1 root root  195,   7 Jul 28 16:52 /dev/nvidia7
crw-rw-rw-  1 root root  195, 255 Jul 28 16:52 /dev/nvidiactl
Comment 26 Stefan Dirsch 2005-11-04 11:18:57 UTC
Which nvidia driver is this? I don't think this can happen with the driver version we provide via YOU (1.0-7167).
Comment 27 Thomas Biege 2005-11-04 11:26:25 UTC
NVRM: loading NVIDIA Linux x86 NVIDIA Kernel Module  1.0-7167  Fri Feb 25 09:08:22 PST 2005
Comment 28 Thomas Biege 2005-11-04 11:27:02 UTC
it is the same
Comment 29 Stefan Dirsch 2005-11-04 11:33:27 UTC
Strange, so does it help to add a file to /etc/modprobe.d with the contents of comment #18? Make sure to unload the nvidia kernel module first and remove the
devices with root.root ownership.
Comment 30 Thomas Biege 2005-11-04 11:48:11 UTC
It's my workstation, I'll test is later.

On another 9.3 workstation it's the same.
Comment 31 Thomas Biege 2005-11-04 12:03:38 UTC
i put "options nvidia NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=33 NVreg_DeviceFileMode=0660" in /etc/modprobe.conf, removed the device files and rebooted. 

result: unable to open display :0
Comment 32 Thomas Biege 2005-11-04 12:18:01 UTC
i fiddled arround a bit, screen stays blank with 0660 root.video and modprobe.conf entry
Comment 33 Stefan Dirsch 2005-11-04 13:21:01 UTC
The 1.0-7167 does not know these options yet, since at this time dynamic udev was not widely used yet. Probably the kernel module no longer can be loaded with these options applied. I have no idea who created the "root.root 660" nvidia devices. This nvidia driver version is likely not the reason.

I close this bugreport therefore again. In case you want to reopen this bugreport again, it would help a *lot* to provide access to a freshly installed system with the nvidia driver YOU patch applied. It's always
time consuming for me to reinstall SUSE 9.3 on one of my test machine.
Comment 34 Forgotten User --EoyBps8f 2005-11-10 22:43:19 UTC
I have a SuSE 10 that cannot load the module for legacy cards anymore (7174). I tried to add the devices to static_devices.txt as metioned in the SuSE HOWTO for nvidia, it did not help.

Every time I try to inser the module I get:
nvidia: module not supported by Novell, setting U taint flag.
nvidia: Unknown parameter `NVreg_DeviceFileUID'

I have to use this driver and cannot use the most recent, because I got a GeForce2. What can I do to get rid of that option that seems to prevent all users of legacy cards from using the nvidia-binary-driver?

I habe all YOU patches installed, not the NVIDIA one, as that works only for > GeForce 2.
Comment 35 Stefan Dirsch 2005-11-10 22:58:39 UTC
I've updated my HOWTO now. Please consult it again.

Comment 36 Forgotten User --EoyBps8f 2005-11-12 00:42:55 UTC
I think that the current "solution" is neither user-friendly nor satisfying.

1. Not everybody can read English and thus consult the HOWTO.
2. Even if they can read English, most people do not know what "legacy cards" are and will not scroll down to the bottom of the document to discover by chance that their card is one.

There should be a way to not force people to remove some file from /etc and the HOWTO should at least put GeForce2 and the other types in brackets in the TOC, so that people might spot it by chance. Further people might have to run modules-update.dep.

Although it might be useless to mention, but why not make 2 instead of 1 script available via YOU? One for legacy cards and one for recent ones. Users could easily distinguish them by their description.
In 9.3 I have tons of useless YOU entries with OO-translations and other things. If there is room for those, a second script for legacy cards should have room too and would be useful as a side-effect. Users would not have to care about anything like this bug or putting some lines into the static_devices.txt, as it would be handled by script.
Comment 37 Stefan Dirsch 2005-11-12 08:14:54 UTC
Thanks. I've added "(GeForce2 and older)" to TOC. It's not an option to support several NVIDIA driver versions for us.
Comment 38 Forgotten User --EoyBps8f 2005-11-14 02:44:24 UTC
SuSE does not support any nvidia-driver, as it cannot solve any bugs within the driver anyway. All it can do is forward bug-reports and all it does is to supply a script to d/l and install the module. As I stated before, multiple versionen of OO were supported for 9.3 and the translation packages spammed YOU. To not let users go through all this hassel would just mean another script and one more entry.

But anyway, I put the lines into static_devices.txt but it still did not work. So is it me, or the HOWTO that got it wrong? Does the HOWTO work for you?

I booted and X could not start. However, after running makedevices.sh from the nvidia-driver-package it did work. If I am not the only one that the static-thingy does not solve the problem for, it might be a good idea to add the following hints to the HOWTO:

1. Extract the the nvidia-package with --extract-only
2. Copy makedevices.sh from the created NVIDIA...-dir/usr/src/ to /usr/local
3. Add a line to you boot.local /usr/local/makedevices.sh

However IMHO, all this extracting, copying and editing is not really an option for normal users and a very high price to pay in terms of user-friendliness just in order to keep the one driver-version policy. I do not understand why nvidia has dropped legacy cards from its driver, but I also do not understand, why SuSE forces users to do all this just because one does not want to add another script.
Comment 39 Forgotten User --EoyBps8f 2005-11-14 10:05:30 UTC
I have to correct myself:

2. Copy makedevices.sh from the created NVIDIA...-dir/usr/src/nv to /usr/local

The nv was missing after /usr/src/
Comment 40 Stefan Dirsch 2005-11-14 10:53:12 UTC
1) It's still not correct that providing a second nvidia download script
   would be enough.
   a) We would need to add a second prebuilt nvidia kernel interface to
      our kernel package
   b) The users would not chose the correct download script, no matter how
      you describe the patch. Users usually even install the nivdia patch, 
      if they don't own a nvidia board at all!
2) There was an error in the HOWTO about the device nodes, which have been
   fixed. I'm sorry. This information should definitely help.

-nvidia c 195 0 666
-nvidia c 195 1 666
-nvidia c 195 2 666
-nvidia c 195 3 666
-nvidia c 195 4 666
-nvidia c 195 5 666
-nvidia c 195 6 666
-nvidia c 195 7 666
+nvidia0 c 195 0 666
+nvidia1 c 195 1 666
+nvidia2 c 195 2 666
+nvidia3 c 195 3 666
+nvidia4 c 195 4 666
+nvidia5 c 195 5 666
+nvidia6 c 195 6 666
+nvidia7 c 195 7 666
 nvidiactl c 195 255 666
Comment 41 Forgotten User --EoyBps8f 2005-11-14 16:21:22 UTC
It still does not work without the help of makedevices.sh. I'll attach my static_devices.txt for you to compare the lines.
Comment 42 Forgotten User --EoyBps8f 2005-11-14 16:23:54 UTC
Created attachment 57286 [details]
static_devices.txt from /etc/udev

Entries from the nvidia-HOWTO are at the bottom, of the file.
Comment 43 Stefan Dirsch 2005-11-14 16:31:22 UTC
The entries look correct. The devices should exist after a reboot.
Comment 44 Forgotten User --EoyBps8f 2005-11-14 19:55:59 UTC
It does not work, because nvidiactl is not created, the others are present in /dev after booting.
Comment 45 Forgotten User --EoyBps8f 2005-11-16 16:50:49 UTC
Created attachment 57542 [details]
right after booting
Comment 46 Forgotten User --EoyBps8f 2005-11-16 16:52:09 UTC
Created attachment 57543 [details]
after running makedevices.sh
Comment 47 Forgotten User --EoyBps8f 2005-11-27 10:01:58 UTC
Is the device created on your system? I still have to use the makedevices.sh.
Comment 48 Marcus Meissner 2007-11-28 15:38:25 UTC
closest match_: CVE-2007-3532
Comment 49 Thomas Biege 2009-10-13 23:09:47 UTC
CVE-2007-3532: CVSS v2 Base Score: 7.2 (AV:L/AC:L/Au:N/C:C/I:C/A:C)