mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Clarify comment about copying Task.image in Task.Clone().
PiperOrigin-RevId: 510829046
This commit is contained in:
committed by
gVisor bot
parent
c020e2de83
commit
028cf757bb
@@ -136,8 +136,9 @@ func (t *Task) Clone(args *linux.CloneArgs) (ThreadID, *SyscallControl, error) {
|
||||
})
|
||||
}
|
||||
|
||||
// We must hold t.mu to access t.image, but want to avoid holding the lock
|
||||
// during Fork() call, so we make a copy.
|
||||
// We must hold t.mu to access t.image, but we can't hold it during Fork(),
|
||||
// since TaskImage.Fork()=>mm.Fork() takes mm.addressSpaceMu, which is ordered
|
||||
// above Task.mu. So we copy t.image with t.mu held and call Fork() on the copy.
|
||||
t.mu.Lock()
|
||||
curImage := t.image
|
||||
t.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user