-
Notifications
You must be signed in to change notification settings - Fork 18.8k
ptrace(ltrace/strace) does not work on non-privileged mode even apparmor is disabled and SYS_PTRACE is enabled. #21051
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
Comments
Looks like you got this issue answered in #7276 (comment). Is it ok to close this? |
@thaJeztah: ping |
@sanmai-NL were you trying to ping @yoshiokatsuneo, or have a question? I think this question is answered in the linked issue, so probably should be closed, but let me know if there's something left to do 👍 |
@thaJeztah: I saw this issue still open. |
@sanmai-NL alright! Let me close this issue as I think it's answered (see my earlier link) |
This was fixed in 1.12. You need to disable seccomp in earlier versions. On 23 Oct 2016 12:52 p.m., "Sander Maijers" notifications@github.com
|
The answer is here: You should add this as a flag to the container --security-opt seccomp:unconfined |
@avindra see @justincormack's comment above; with docker 1.12 and up it should not be needed to set that option. |
@thaJeztah I'm running Docker for Mac |
I can confirm this is still an issue on Windows as well:
To reproduce it, please use: docker build -t webinar:debug .
docker run --rm --name=webinar-debug -p 8000:8000 -p 40000:40000 webinar:debug as for the Dockerfile / repo, you can use this https://github.com/dlsniper/webinar Docker info: |
@dlsniper the issue discussed here is not that ptrace doesn't work on non-privileged container, but that ptrace doesn't work on a non-privileged container with If you did not specify those, it's probably expected it doesn't work because additional capabilities are always needed (they're blocked by default) |
wow, thank you for the quick reply. I apologize, I've misunderstood this comment:
Running with
does indeed solve the problem. Thank you. |
Is it possible to do it with docker-compose? |
@itcreator Adding the following to the relevant container in my
|
Thanks. I'll try it |
I tried with the options above and setting 0 in /proc/sys/kernel/yama, it didn't say it could not attach to process, but it said "target:[path-to-my-app]/[app-executable]": could not open as an executable file: Operation not permitted. which ended in termination and process detachment in some time. what could I do ? Thanks! |
Without the capability:
With the capability:
As you see above, the process was running without the capability and it could still attach to the target process (which was running as the same unprivileged user). Due to adding the SYS_PTRACE capability on the command line, Docker configured seccomp without blocking the related syscalls (see the ptrace related section in the default seccomp profile: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json) |
Adding both "--cap-add=SYS_PTRACE" and "--security-opt=apparmor:unconfined" does not allow container to run programs like strace/ltrace using the ptrace (PTRACE_TRACEME).
Only "--privileded" option allow the container to use ptrace.
Is there any way to allow ptrace without using "privileged" flag ?
Output of
docker version
:Output of
docker info
:Provide additional environment details (AWS, VirtualBox, physical, etc.):
Ubuntu14.04
List the steps to reproduce the issue:
Describe the results you received:
strace: test_ptrace_setoptions_for_all: PTRACE_TRACEME doesn't work: Operation not permitted
Describe the results you expected:
strike result
Provide additional info you think is important:
The text was updated successfully, but these errors were encountered: