-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcontainer: create Cwd when it does not exist #1604
Conversation
libcontainer/rootfs_linux.go
Outdated
@@ -76,6 +77,13 @@ func prepareRootfs(pipe io.ReadWriter, config *configs.Config) (err error) { | |||
} | |||
} | |||
|
|||
// Setup Cwd before running the pre-start hooks, so that hooks can play with Cwd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not do this right before chdir to the cwd when the rootfs is already setup and every other mount is done and we are jailed inside the rootfs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I was about to comment 😉. That way we don't need to use CleanPath
we can just use MkdirAll
and nothing else. If a hook wants to mess with the cwd, they could create it themselves.
The benefit for doing this within runc is that it works well with userns. Actually, runc already does the same thing for mount points. Signed-off-by: Akihiro Suda <[email protected]>
Updated PR. PTAL. @crosbymichael @cyphar However, I didn't do this right before |
@AkihiroSuda That's fine, this should (semantically) be part of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The benefit for doing this within runc is that it works well with
userns.
Actually, runc already does the same thing for mount points.
discussed in containerd/containerd#1585 (cc @crosbymichael @estesp )
If this change is fine, I'll open a PR to runtime-spec correspondingly.
Signed-off-by: Akihiro Suda [email protected]