Skip to content

Commit 1074ebe

Browse files
committed
Add ignore-imex-channels-requests feature flag
This allows the NVIDIA Container Toolkit to ignore IMEX channel requests through the NVIDIA_IMEX_CHANNELS envvar or volume mounts and ensures that the NVIDIA Container Toolkit cannot be used to provide out-of-band access to an IMEX channel by simply specifying an environment variable, possibly bypassing other checks by an orchestration system such as kubernetes. Signed-off-by: Evan Lezar <[email protected]>
1 parent 65b575f commit 1074ebe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
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.IgnoreNvidiaImexChannelsEnvvar.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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ type features struct {
2828
// DisableImexChannelCreation ensures that the implicit creation of
2929
// requested IMEX channels is skipped when invoking the nvidia-container-cli.
3030
DisableImexChannelCreation *feature `toml:"disable-imex-channel-creation,omitempty"`
31+
// IgnoreNvidiaImexChannelsEnvvar ignores the contents of the NVIDIA_IMEX_CHANNELS envvar.
32+
// This ensures that the NVIDIA Container Toolkit cannot be used to provide
33+
// access to an IMEX channel by simply specifying an environment variable,
34+
// possibly bypassing other checks by an orchestration system such as
35+
// kubernetes.
36+
IgnoreNvidiaImexChannelsEnvvar *feature `toml:"ignore-imex-channel-envvar,omitempty"`
3137
}
3238

3339
type feature bool

0 commit comments

Comments
 (0)