may kill other process when container has been stopped
@@ -374,11 +374,19 @@ func (c *linuxContainer) Signal(s os.Signal, all bool) error {
if all {
return signalAllProcesses(c.cgroupManager, s)
}
+ status, err := c.currentStatus()
+ if err != nil {
+ return err
+ }
+ // to avoid a PID reuse attack
+ if status == Running || status == Created {
if err := c.initProcess.signal(s); err != nil {
return newSystemErrorWithCause(err, "signaling init process")
}
return nil
}
+ return newGenericError(fmt.Errorf("container not running"), ContainerNotRunning)
+}
func (c *linuxContainer) createExecFifo() error {
rootuid, err := c.Config().HostRootUID()
