Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
cmd/snap-confine: don't crash if nvidia module is loaded but drivers are not available #2881
Conversation
zyga
added some commits
Feb 17, 2017
| + } | ||
| + // Bind mount the binary nvidia driver into /var/lib/snapd/lib/gl. | ||
| + debug("bind mounting nvidia driver %s -> %s", src, dst); | ||
| + if (mount(src, dst, NULL, MS_BIND, NULL) != 0) { |
zyga
Feb 21, 2017
•
Contributor
Maybe this should be MS_BIND | MS_RDONLY? Apparmor is there anyway but this would not hurt.
| - dst); | ||
| - } | ||
| + | ||
| + // If there's driver in the kernel then don't mount userspace. |
| + // Construct the paths for the driver userspace libraries | ||
| + // and for the gl directory. | ||
| + char src[PATH_MAX], dst[PATH_MAX]; | ||
| + sc_must_snprintf(src, sizeof src, "/usr/lib/nvidia-%d", |
| + } | ||
| + // Bind mount the binary nvidia driver into /var/lib/snapd/lib/gl. | ||
| + debug("bind mounting nvidia driver %s -> %s", src, dst); | ||
| + if (mount(src, dst, NULL, MS_BIND, NULL) != 0) { |
zyga
Feb 21, 2017
•
Contributor
Maybe this should be MS_BIND | MS_RDONLY? Apparmor is there anyway but this would not hurt.
jdstrand
approved these changes
Feb 21, 2017
This looks fine to me, it is simply changing code to return early if major version is 0 and doing an access() check. I do wonder if the sc_mount_nvidia_driver_arch() function shouldn't also be changed....
zyga
merged commit f24888f
into
snapcore:master
Feb 22, 2017
6 checks passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
xenial-amd64
autopkgtest finished (success)
Details
xenial-i386
autopkgtest finished (success)
Details
xenial-ppc64el
autopkgtest finished (success)
Details
yakkety-amd64
autopkgtest finished (success)
Details
zesty-amd64
autopkgtest finished (success)
Details
zyga
deleted the
zyga:optional-nvidia
branch
Feb 22, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zyga commentedFeb 17, 2017
This fixes an issue where the running kernel has the nvidia module inserted but the root filesystem we are executing in does not have the userspace of the driver. This can happen when running in a LXD container.