Don't read FSContext.root without holding FSContext.mu

IsChrooted still has the opportunity to race with another thread
entering the FSContext into a chroot, but that is unchanged (and
fine, AFAIK).

PiperOrigin-RevId: 202029117
Change-Id: I38bce763b3a7715fa6ae98aa200a19d51a0235f1
This commit is contained in:
Michael Pratt
2018-06-25 15:22:56 -07:00
committed by Shentubot
parent e8ae2b85e9
commit 478f0ac003
+3 -1
View File
@@ -122,5 +122,7 @@ func (t *Task) AbstractSockets() *AbstractSocketNamespace {
func (t *Task) IsChrooted() bool {
realRoot := t.k.mounts.Root()
defer realRoot.DecRef()
return t.tr.FSContext.root != realRoot
root := t.tr.FSContext.RootDirectory()
defer root.DecRef()
return root != realRoot
}