Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Commit

Permalink
kvm: partial fix for mounting symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
jellonek committed Mar 30, 2016
1 parent d462906 commit 9510971
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stage1/init/common/kvm_mount.go
Expand Up @@ -81,13 +81,14 @@ func MountSharedVolumes(root string, appName types.ACName, volumes []types.Volum
}

destination := filepath.Join(appRootfs, mntPath)
// TODO: verify if rkt should do this, or it should be some outer responsibility
// to ensure if such patch exists
if err := ensureDestinationExists(source, destination); err != nil {
// TODO: check if symlinked source tries to escape root
// TODO: verify if rkt should ensure existance of destination there, or it should be some
// outer responsibility to ensure if such path exists
if cleanedSource, err := filepath.EvalSymlinks(source); err != nil {
return errwrap.Wrap(fmt.Errorf("could not resolve symlink for source: %v", source), err)
} else if err := ensureDestinationExists(cleanedSource, destination); err != nil {
return errwrap.Wrap(fmt.Errorf("could not create destination mount point: %v", destination), err)
}

if err := doBindMount(source, destination, readOnly); err != nil {
} else if err := doBindMount(cleanedSource, destination, readOnly); err != nil {
return errwrap.Wrap(fmt.Errorf("could not bind mount path %v (s: %v, d: %v)", m.Path, source, destination), err)
}
}
Expand Down

0 comments on commit 9510971

Please sign in to comment.