New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dev nvidia with nv #1358
Add dev nvidia with nv #1358
Conversation
…/dev/nvidia* when necessary
@ctmadison and @paulo7777 this should be ready for testing. |
Confirm this is working for me. GPU visible with
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested (see comment), and looks good to me.
On the C front - only thing I see would be if singularity_registry_get("NVDEV")
could return an incorrectly terminated string, but I don't believe that's the case.
Thanks for merging the CHANGELOG.md @dctrud ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must ensure SINGULARITY_NVDEV contains only paths starting with /dev/
Edit: or just use opendir/readdir directly in C code when --nv flag requested and match for nvidia entries
src/lib/runtime/mounts/dev/dev.c
Outdated
char *nvdev = strtok(nvdevs, ","); | ||
while ( nvdev != NULL ) { | ||
singularity_message(2, "Binding device %s\n", nvdev); | ||
bind_dev(sessiondir, nvdev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GodloveD That's introduce a security issue, SINGULARITY_NVDEV is fully controlled by user so he could bind anything he want into container without sanity checks
Thanks for the review @cclerget. And thanks for the suggestion to use opendir and readdir. I think it makes the code cleaner and hopefully it makes the code safer as well. |
As far as I know, @paulo7777 has tested this and it seems to be working for him. @paulo7777 can you verify? |
@paulo7777 confirmed - also working for me here and @cclerget has approved from a security standpoint. Merging this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm this is working for me with the further changes, and Paulo has confirmed okay too.
Yay! |
Description of the Pull Request (PR):
Several users noted that the
--nv
option does not work in conjunction with the--contain
option. This is because/dev/nvidia*
devices are not bind mounted into the container if--contain
is used. This PR fixes this issue by bind mounting/dev/nvidia*
if the--nv
option is passed along with the--contain
option.I'm not sure why the commit history includes all of the other commits. It could be because that history was inadvertently lost in the release-2.4 branch when bug fixes were backported by cherry-picking merges. If that is the case it will actually be a good thing to add this history back into the release-2.4 branch where it belongs.
Note that this PR is slated for 2.4.4. So it should not be merged into release-2.4 until the 2.4.3 release has been tagged.
This fixes or addresses the following GitHub issues:
Checkoff for all PRs:
make test
Attn: @singularityware-admin