From 697d3d52eb9494cee096eeb5d831c9767e02d15e Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Fri, 11 Feb 2022 11:12:48 -0800 Subject: [PATCH] Fix walking to attach path logic in lisafs. The attach path (if one exists) is always absolute. This is checked while setting that option. strings.Split(aname, "/") creates an extra empty string in the beginning of the slice. Exclude that while making Walk RPC. PiperOrigin-RevId: 428046171 --- pkg/sentry/fsimpl/gofer/gofer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go index 310bcd5d6..a758f49ab 100644 --- a/pkg/sentry/fsimpl/gofer/gofer.go +++ b/pkg/sentry/fsimpl/gofer/gofer.go @@ -541,9 +541,9 @@ func (fs *filesystem) initClientLisa(ctx context.Context) (lisafs.Inode, error) return rootInode, nil } - // Walk to the attach point from root inode. + // Walk to the attach point from root inode. aname is always absolute. rootFD := fs.clientLisa.NewFD(rootInode.ControlFD) - status, inodes, err := rootFD.WalkMultiple(ctx, strings.Split(fs.opts.aname, "/")) + status, inodes, err := rootFD.WalkMultiple(ctx, strings.Split(fs.opts.aname, "/")[1:]) rootFD.CloseBatched(ctx) if err != nil { return lisafs.Inode{}, err