From 1f04a514e8e8f9ff234743b956291f39d666768f Mon Sep 17 00:00:00 2001 From: Lucas Manning Date: Wed, 11 Oct 2023 15:59:32 -0700 Subject: [PATCH] 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 --- pkg/sentry/vfs/vfs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index 555bc7141..9834460ab 100644 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -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())) }