Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
v2: Prevent killing all container processes when exec is failed
Browse files Browse the repository at this point in the history
If an exec is failed(such as executable file not found in $PATH), the
`execs.id` will be empty. This leads to all the container processes
being killed when calling `Kill` on such exec id.

Fixes: #2001
Signed-off-by: Li Yuxuan <[email protected]>
  • Loading branch information
darfux authored and Eric Ernst committed Aug 29, 2019
1 parent 7e77b75 commit 179485f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,14 @@ func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (_ *ptypes.E
return nil, err
}
processID = execs.id
if processID == "" {
logrus.WithFields(logrus.Fields{
"sandbox": s.sandbox.ID(),
"Container": c.id,
"ExecID": r.ExecID,
}).Debug("Id of exec process to be signalled is empty")
return empty, errors.New("The exec process does not exist")
}
}

return empty, s.sandbox.SignalProcess(c.id, processID, signum, r.All)
Expand Down

0 comments on commit 179485f

Please sign in to comment.