Skip to content

Commit bc9ec77

Browse files
authored
Merge pull request #943 from elezar/add-disable-imex-channels-feature
Add ignore-imex-channel-requests feature flag
2 parents 82f2eb7 + 352b55c commit bc9ec77

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cmd/nvidia-container-runtime-hook/container_config.go

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func getMigDevices(image image.CUDA, envvar string) *string {
198198
}
199199

200200
func (hookConfig *hookConfig) getImexChannels(image image.CUDA, privileged bool) []string {
201+
if hookConfig.Features.IgnoreImexChannelRequests.IsEnabled() {
202+
return nil
203+
}
204+
201205
// If enabled, try and get the device list from volume mounts first
202206
if hookConfig.AcceptDeviceListAsVolumeMounts {
203207
devices := image.ImexChannelsFromMounts()

internal/config/features.go

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ type features struct {
3434
// DisableImexChannelCreation ensures that the implicit creation of
3535
// requested IMEX channels is skipped when invoking the nvidia-container-cli.
3636
DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"`
37+
// IgnoreImexChannelRequests configures the NVIDIA Container Toolkit to
38+
// ignore IMEX channel requests through the NVIDIA_IMEX_CHANNELS envvar or
39+
// volume mounts.
40+
// This ensures that the NVIDIA Container Toolkit cannot be used to provide
41+
// access to an IMEX channel by simply specifying an environment variable,
42+
// possibly bypassing other checks by an orchestration system such as
43+
// kubernetes.
44+
IgnoreImexChannelRequests *feature `toml:"ignore-imex-channel-requests,omitempty"`
3745
}
3846

3947
type feature bool

0 commit comments

Comments
 (0)