diff --git a/pkg/sentry/kernel/sessions.go b/pkg/sentry/kernel/sessions.go index c217707ef..47536213b 100644 --- a/pkg/sentry/kernel/sessions.go +++ b/pkg/sentry/kernel/sessions.go @@ -440,6 +440,11 @@ func (tg *ThreadGroup) JoinProcessGroup(pidns *PIDNamespace, pgid ProcessGroupID pidns.owner.mu.Lock() defer pidns.owner.mu.Unlock() + // Check whether the process still exists or not. + if _, ok := pidns.tgids[tg]; !ok { + return linuxerr.ESRCH + } + // Lookup the ProcessGroup. pg := pidns.processGroups[pgid] if pg == nil {