-
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
fix permission denied #2086
fix permission denied #2086
Conversation
when exec as root and config.Cwd is not owned by root, exec will fail because root doesn't have the caps. So, Chdir should be done before setting the caps. Signed-off-by: Kurnia D Win <kurnia.d.win@gmail.com>
ping! |
Does this introduce a regression? |
I believe this is incorrect as @Random-Liu suggests; I am unsure why you accepted a PR with a repro just from |
@justincormack I can reproduce this just with old version of runc |
I can see the argument for this new behaviour being wrong (in theory you could bypass some DAC controls in very odd setups by setting your working directory to be inside a path which is world- I'm okay with reverting this, but I don't really feel that either behaviour is necessarily wrong. After all, we've always said that being able to run custom container configurations is equivalent to running as root (not that anyone listens...). |
OK here is the test case which fails before and passes after this PR. @test "runc exec --user with no access to cwd" {
requires root
chown 42 rootfs/root
chmod 700 rootfs/root
update_config ' .process.cwd = "/root"
| .process.user.uid = 42
| .process.args |= ["sleep", "1h"]'
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
[ "$status" -eq 0 ]
runc exec --user 0 test_busybox true
[ "$status" -eq 0 ]
} |
Commit 5e0e67d ("fix permission denied") modified some code but did not provide a test case. This is a test case that was tested to fail before and succeed after the above commit. For more details, see opencontainers#2086 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Commit 5e0e67d ("fix permission denied") modified some code but did not provide a test case. This is a test case that was tested to fail before and succeed after the above commit. For more details, see opencontainers/runc#2086 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Commit 5e0e67d ("fix permission denied") modified some code but did not provide a test case. This is a test case that was tested to fail before and succeed after the above commit. For more details, see opencontainers#2086 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
when exec as root and
config.Cwd
is not owned by root, exec will failbecause root doesn't have the caps.
So, Chdir should be done before setting the caps.
to reproduce this error