-
Notifications
You must be signed in to change notification settings - Fork 45
Ensure that filemode is set for device nodes #275
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
base: main
Are you sure you want to change the base?
Conversation
@zvonkok for the Kata use case the rust implementation must also be updated. |
This change ensures that the filemode for a CDI device is properly set from the host device node when adding devices to the CDI spec. Without this the device node permissions are 000 in the container under certain conditions (such as Kata). Signed-off-by: Evan Lezar <[email protected]>
4120810
to
8288672
Compare
@@ -65,22 +86,31 @@ func (d *DeviceNode) fillMissingInfo() error { | |||
return nil |
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.
Should we also set d.FileMode here?
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.
What would you set it to in this case?
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.
The same as below?
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.
This logic is an early return meaning that we don't query the device node. I can make things a bit more consistent though. Let me see what I can come up with.
d.FileMode = &di.fileMode | ||
} | ||
|
||
if d.Type == "p" { |
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.
if d.Type == "p" { | |
if d.Type == fifoDevice { |
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 use "p"
elsewhere in this function. I don't mind changing this to a constant, but would do so consistently across this function.
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.
Yes, please do.
This change ensures that the filemode for a CDI device is properly set from the host device node when adding devices to the CDI spec.
Without this the device node permissions are 000 in the container under certain conditions (such as Kata).
See also NVIDIA/nvidia-container-toolkit#960