Skip to content

Commit 7c758c9

Browse files
committed
Add ignore-imex-channel-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 91a983a commit 7c758c9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-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.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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ 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+
// Note that this is not enabled by default to maintain backward compatibility
45+
// with the existing behaviour when the NVIDIA Container Toolkit is used in
46+
// non-kubernetes environments.
47+
IgnoreImexChannelRequests *feature `toml:"ignore-imex-channel-requests,omitempty"`
3748
}
3849

3950
type feature bool

0 commit comments

Comments
 (0)