Bug#888952: nvidia-driver and opencl

Andreas Beckmann anbe at debian.org
Mon Feb 5 08:45:00 UTC 2018


I've prepared a small program to help debugging whether setuid binaries
work on your system:

===== test-setuid.c =====
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>

int main()
{
        printf("getuid()  = %ld\n", (long)getuid());
        printf("geteuid() = %ld\n", (long)geteuid());
        printf("getgid()  = %ld\n", (long)getgid());
        printf("getegid() = %ld\n", (long)getegid());
}
=========================

1) compile

$ gcc -o test-setuid test-setuid.c

2) try it as user:

$ ./test-setuid

getuid()  = 1000
geteuid() = 1000
getgid()  = 1000
getegid() = 1000

Your UID/GID could be different ...

3) try it as root:

$ sudo ./test-setuid

getuid()  = 0
geteuid() = 0
getgid()  = 0
getegid() = 0

4) install it as setuid root binary to /usr/bin
   (to be at the same location as nvidia-modprobe)

$ sudo cp test-setuid /usr/bin/test-setuid
$ sudo chown root:root /usr/bin/test-setuid
$ sudo chmod u+s /usr/bin/test-setuid
$ ls -la /usr/bin/test-setuid

-rwsr-xr-x 1 root root 8848 Feb  5 09:13 /usr/bin/test-setuid

5) run as user

$ /usr/bin/test-setuid

getuid()  = 1000
geteuid() = 0
getgid()  = 1000
getegid() = 1000

If this works, geteuid() should return 0

6) cleanup

$ sudo rm /usr/bin/test-setuid


You could repeat steps 4-6 with different locations (e.g. on different
filesystems). For example /run/user/<YOURUID> which should be a tmpfs
mounted with option nosuid - there it shouldn't work.



Andreas



More information about the pkg-nvidia-devel mailing list