From b520428b5a4f6815bb66f6eb538e203ec2597935 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Wed, 11 Nov 2020 21:37:39 -0800 Subject: [PATCH] Fix CRIU - process.Init#io could be nil - Make sure CreateTaskRequest#Options is not empty before unmarshaling Signed-off-by: Kazuyoshi Kato --- pkg/process/init.go | 6 +++++- runtime/v2/runc/container.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/process/init.go b/pkg/process/init.go index 28ca5ac6a..1bf5e7e45 100644 --- a/pkg/process/init.go +++ b/pkg/process/init.go @@ -193,11 +193,15 @@ func (p *Init) createCheckpointedState(r *CreateConfig, pidFile *pidFile) error ParentPath: r.ParentCheckpoint, }, PidFile: pidFile.Path(), - IO: p.io.IO(), NoPivot: p.NoPivotRoot, Detach: true, NoSubreaper: true, } + + if p.io != nil { + opts.IO = p.io.IO() + } + p.initState = &createdCheckpointState{ p: p, opts: opts, diff --git a/runtime/v2/runc/container.go b/runtime/v2/runc/container.go index 27d434a29..9b65e44c8 100644 --- a/runtime/v2/runc/container.go +++ b/runtime/v2/runc/container.go @@ -49,7 +49,7 @@ func NewContainer(ctx context.Context, platform stdio.Platform, r *task.CreateTa } var opts options.Options - if r.Options != nil { + if r.Options != nil && r.Options.GetTypeUrl() != "" { v, err := typeurl.UnmarshalAny(r.Options) if err != nil { return nil, err