Skip to content

Commit 147cabc

Browse files
ekzhanggvisor-bot
authored andcommitted
Follow symlinks in MkdirAllAt
See #11910 for details — this potentially fixes a divergence between gVisor and runc behavior where having the `cwd` of the OCI container spec set to a symlink to a folder causes gVisor to exit with this error: ``` running container: starting container: starting root container: starting sandbox: failed to create process working directory "/cwd-folder-name-here": not a directory ``` FUTURE_COPYBARA_INTEGRATE_REVIEW=#11911 from ekzhang:patch-1 57017a5 PiperOrigin-RevId: 781612832
1 parent 7323f1d commit 147cabc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/sentry/vfs/vfs.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,9 +874,10 @@ func (vfs *VirtualFilesystem) getFilesystems() map[*Filesystem]struct{} {
874874
// (including the last component).
875875
func (vfs *VirtualFilesystem) MkdirAllAt(ctx context.Context, currentPath string, root VirtualDentry, creds *auth.Credentials, mkdirOpts *MkdirOptions, mustBeDir bool) error {
876876
pop := &PathOperation{
877-
Root: root,
878-
Start: root,
879-
Path: fspath.Parse(currentPath),
877+
Root: root,
878+
Start: root,
879+
Path: fspath.Parse(currentPath),
880+
FollowFinalSymlink: true,
880881
}
881882
stat, err := vfs.StatAt(ctx, creds, pop, &StatOptions{Mask: linux.STATX_TYPE})
882883
switch {

0 commit comments

Comments
 (0)