mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
CreateProcessGroup has to check whether a target process stil exists or not
A caller of CreateProcessGroup looks up a thread group without locks, so the target process can exit before CreateProcessGroup will be called. Reported-by: syzbot+6abb7c34663dacbd55a8@syzkaller.appspotmail.com PiperOrigin-RevId: 381351069
This commit is contained in:
@@ -369,6 +369,11 @@ func (tg *ThreadGroup) CreateProcessGroup() error {
|
||||
// Get the ID for this thread in the current namespace.
|
||||
id := tg.pidns.tgids[tg]
|
||||
|
||||
// Check whether a process still exists or not.
|
||||
if id == 0 {
|
||||
return syserror.ESRCH
|
||||
}
|
||||
|
||||
// Per above, check for a Session leader or existing group.
|
||||
for s := tg.pidns.owner.sessions.Front(); s != nil; s = s.Next() {
|
||||
if s.leader.pidns != tg.pidns {
|
||||
|
||||
Reference in New Issue
Block a user