From 569af34cbb761f0507546457ffe376f4454c87ea Mon Sep 17 00:00:00 2001 From: Jose Fernandez Date: Wed, 26 Feb 2025 14:26:42 -0700 Subject: [PATCH] Prefer runtime options for PluginInfo request Previously, PluginInfo was called with task options as the primary value, resulting in opts.BinaryName being omitted. Consequently, the containerd-shim-runc-v2 fell back to the system's runc binary in the PATH rather than the explicitly specified one. This change inverts the option fallback by preferring runtime options over task options, ensuring the correct binary is used for the PluginInfo request. Closes: https://github.com/containerd/containerd/issues/11169 Signed-off-by: Jose Fernandez Reviewed-by: Erikson Tung --- core/runtime/v2/task_manager.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/runtime/v2/task_manager.go b/core/runtime/v2/task_manager.go index f396ced52..844070b71 100644 --- a/core/runtime/v2/task_manager.go +++ b/core/runtime/v2/task_manager.go @@ -266,12 +266,12 @@ func (m *TaskManager) validateRuntimeFeatures(ctx context.Context, opts runtime. return nil } - topts := opts.TaskOptions - if topts == nil || topts.GetValue() == nil { - topts = opts.RuntimeOptions + ropts := opts.RuntimeOptions + if ropts == nil || ropts.GetValue() == nil { + ropts = opts.TaskOptions } - pInfo, err := m.PluginInfo(ctx, &apitypes.RuntimeRequest{RuntimePath: opts.Runtime, Options: typeurl.MarshalProto(topts)}) + pInfo, err := m.PluginInfo(ctx, &apitypes.RuntimeRequest{RuntimePath: opts.Runtime, Options: typeurl.MarshalProto(ropts)}) if err != nil { return fmt.Errorf("runtime info: %w", err) }