Fix mount promise path resolution.

It should build a path starting from the task root, not rp.root. This was a
problem in the case of reading from /proc/mountinfo before starting the daemon.
In this case, the procfs issues a StatAt call through vfs with the rp starting
at the root of the cloudsql mount. This issued a request to start the daemon
with the path "/" instead of "/cloudsql".

PiperOrigin-RevId: 572713014
This commit is contained in:
Lucas Manning
2023-10-11 16:02:33 -07:00
committed by gVisor bot
parent a8bc2e1466
commit 1f04a514e8
+3 -1
View File
@@ -947,7 +947,9 @@ func (vfs *VirtualFilesystem) maybeBlockOnMountPromise(ctx context.Context, rp *
return
}
path, err := vfs.PathnameReachable(ctx, rp.root, vd)
root := RootFromContext(ctx)
defer root.DecRef(ctx)
path, err := vfs.PathnameReachable(ctx, root, vd)
if err != nil {
panic(fmt.Sprintf("could not reach %v from root", rp.Component()))
}