From 771f0e013469345c49397d78e048395978f6e2d6 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 26 Mar 2026 13:36:06 +0100 Subject: [PATCH] fix: Additional GIDs are dropped due to file mode mask The filemode returned from DeviceFromPath clears the bits that are track whether the device is a character device. This means that the check that ensures that the mode includes the character device bits always fails and no additional GIDs are detected. This change removes the check. In practice this should have no effect since we only ever detect char devices. Signed-off-by: Evan Lezar --- internal/edits/device.go | 3 --- pkg/nvcdi/lib-csv_test.go | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/edits/device.go b/internal/edits/device.go index 8ce05c00b..2b12e0492 100644 --- a/internal/edits/device.go +++ b/internal/edits/device.go @@ -130,9 +130,6 @@ func (d *device) getAdditionalGIDs(dn *specs.DeviceNode) []uint32 { if dn.FileMode == nil { return nil } - if dn.FileMode.Type()&os.ModeCharDevice == 0 { - return nil - } if permission := dn.FileMode.Perm(); isWorldReadable(permission) && isWorldWriteable(permission) { return nil } diff --git a/pkg/nvcdi/lib-csv_test.go b/pkg/nvcdi/lib-csv_test.go index 8a9e17f9d..3b8507362 100644 --- a/pkg/nvcdi/lib-csv_test.go +++ b/pkg/nvcdi/lib-csv_test.go @@ -182,6 +182,7 @@ func TestDeviceSpecGenerators(t *testing.T) { { Name: "0", ContainerEdits: specs.ContainerEdits{ + AdditionalGIDs: []uint32{44}, DeviceNodes: []*specs.DeviceNode{ {Path: "/dev/nvidia0", HostPath: "/dev/nvidia0"}, {Path: "/dev/nvidiactl", HostPath: "/dev/nvidiactl"}, @@ -193,6 +194,7 @@ func TestDeviceSpecGenerators(t *testing.T) { { Name: "1", ContainerEdits: specs.ContainerEdits{ + AdditionalGIDs: []uint32{44}, DeviceNodes: []*specs.DeviceNode{ {Path: "/dev/nvidia1", HostPath: "/dev/nvidia1"}, {Path: "/dev/nvidiactl", HostPath: "/dev/nvidiactl"},