From d703340bc04a4269f420fdf24d946abcbc6a620b Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 22 Jun 2021 10:47:37 -0700 Subject: runsc: don't kill sandbox, let it stop properly The typical sequence of calls to start a container looks like this ct, err := container.New(conf, containerArgs) defer ct.Destroy() ct.Start(conf) ws, err := ct.Wait() For the root container, ct.Destroy() kills the sandbox process. This doesn't look like a right wait to stop it. For example, all ongoing rpc calls are aborted in this case. If everything is going alright, we can just wait and it will exit itself. Reported-by: syzbot+084fca334720887441e7@syzkaller.appspotmail.com Signed-off-by: Andrei Vagin --- runsc/boot/controller.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runsc/boot/controller.go') diff --git a/runsc/boot/controller.go b/runsc/boot/controller.go index d52cf5a00..b605aa40a 100644 --- a/runsc/boot/controller.go +++ b/runsc/boot/controller.go @@ -15,6 +15,7 @@ package boot import ( + "context" "errors" "fmt" "os" @@ -165,8 +166,8 @@ func newController(fd int, l *Loader) (*controller, error) { return ctrl, nil } -func (c *controller) stop() { - c.srv.Stop() +func (c *controller) stop(ctx context.Context) { + c.srv.Stop(ctx) } // containerManager manages sandbox containers. -- cgit v1.2.3