-
Notifications
You must be signed in to change notification settings - Fork 38
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
sheltie: use /proc to find the bash binary #8
Conversation
@bcressey suggested using |
I've tested both the current changes and @bcressey's suggestions in a Bottlerocket instance with the admin container enabled and I'm able to reach the host root shell without problems:
|
I'll update this to use @bcressey suggestion, since that works and fits the set of supported use-cases today. I am still concerned about ensuring that
|
Because we have a shared pid namespace, /proc inside the container matches /proc outside the container. The special directory 'root' inside a given process directory in /proc contains that process's view of the filesystem. We can thus locate the container's root filesystem by taking advantage of the interpreter's /proc directory. In order to make this work, we rely on the parent process existing in the container's mount namespace, so that the path we construct maps properly to the container's filesystem. Signed-off-by: Samuel Karp <[email protected]>
d5d7c27
to
62ffb01
Compare
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.
🐤
Issue number:
Fixes #7
Description of changes:
Because we have a shared pid namespace, /proc inside the container matches /proc outside the container. The special directory 'root' inside a given process directory in /proc contains that process's view of the filesystem.
We can thus locate the container's root filesystem by taking advantage of the interpreter's /proc directory.
In order to make this work, we rely on the parent process existing in the container's mount namespace, so that the path we construct maps properly to the container's filesystem.
Testing done:
Tested locally with
docker run -it --rm --privileged --pid=host
. @etungsten tested it with Bottlerocket.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.