summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-01-17 14:20:00 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-17 14:21:27 -0800
commitf1a5178c589dbd9a1fe4f1b9fb943fbe64791b58 (patch)
tree4e2e48a2d42256c93139499cf9be3a33561a1606 /pkg/sentry
parent9073521098ee52cdda74a193565b7bbe75d8c35a (diff)
Fix data race in MountNamespace.resolve.
We must hold fs.renameMu to access Dirent.parent. PiperOrigin-RevId: 290340804
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fs/mounts.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/sentry/fs/mounts.go b/pkg/sentry/fs/mounts.go
index db3dfd096..a9627a9d1 100644
--- a/pkg/sentry/fs/mounts.go
+++ b/pkg/sentry/fs/mounts.go
@@ -609,8 +609,11 @@ func (mns *MountNamespace) resolve(ctx context.Context, root, node *Dirent, rema
}
// Find the node; we resolve relative to the current symlink's parent.
+ renameMu.RLock()
+ parent := node.parent
+ renameMu.RUnlock()
*remainingTraversals--
- d, err := mns.FindInode(ctx, root, node.parent, targetPath, remainingTraversals)
+ d, err := mns.FindInode(ctx, root, parent, targetPath, remainingTraversals)
if err != nil {
return nil, err
}