Synchronize the call to linuxContainer.Signal()

linuxContainer.Signal() can race with another call to say Destroy()
which clears the container's initProcess. This can cause a nil pointer
dereference in Signal().

This patch will synchronize Signal() and Destroy() by grabbing the
container's mutex as part of the Signal() call.

Signed-off-by: Pradyumna Agrawal <pradyumnaa@vmware.com>
This commit is contained in:
Pradyumna Agrawal 2020-03-09 11:08:11 -07:00
parent fc5759cf4f
commit 5b2b138d24
1 changed files with 2 additions and 0 deletions

View File

@ -379,6 +379,8 @@ func (c *linuxContainer) start(process *Process) error {
}
func (c *linuxContainer) Signal(s os.Signal, all bool) error {
c.m.Lock()
defer c.m.Unlock()
if all {
return signalAllProcesses(c.cgroupManager, s)
}