Skip to content
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

change new pid namespace description #1006

Merged
merged 1 commit into from
Apr 8, 2019

Conversation

lifubang
Copy link
Member

@lifubang lifubang commented Apr 8, 2019

If container b joins container a's pid namespace, processes inside container b can be able to see other processes in container a, not only inside it's own container..

For example:

Use busybox image as rootfs, with start arg ["sleep", "100000"]:

For container a: use new pid namesapce without path: "namespaces": [{"type": "pid"}

root@demo:/opt/busybox# ../runc/runc run -d a
root@demo:/opt/busybox# ../runc/runc list
ID          PID         STATUS      BUNDLE                                            CREATED                          OWNER
a           3162        running     /opt/busybox   2019-04-08T11:34:02.449638033Z   root
root@demo:/opt/busybox# ../runc/runc exec -t a ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 sleep 100000
    6 root      0:00 ps -ef

For container b: use new pid namesapce with path: "namespaces": [{"type": "pid", "path": "/proc/3162/ns/pid"}

root@demo:/opt/busybox# ../runc/runc run -d b
root@demo:/opt/busybox# ../runc/runc list
ID          PID         STATUS      BUNDLE                                            CREATED                          OWNER
a           3162        running     /opt/busybox   2019-04-08T11:34:02.449638033Z   root
b           3581        running     /opt/busybox   2019-04-08T11:35:05.241568752Z   root
# now they can see each other
root@demo:/opt/busybox# ../runc/runc exec -t a ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 sleep 100000
   11 root      0:00 sleep 100000
   16 root      0:00 ps -ef
root@demo:/opt/busybox# ../runc/runc exec -t b ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 sleep 100000
   11 root      0:00 sleep 100000
   24 root      0:00 ps -ef

Signed-off-by: Lifubang lifubang@acmcoder.com

Signed-off-by: Lifubang <lifubang@acmcoder.com>
@tianon
Copy link
Member

tianon commented Apr 8, 2019

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Member

crosbymichael commented Apr 8, 2019

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit a1b50f6 into opencontainers:master Apr 8, 2019
@vbatts vbatts mentioned this pull request Jan 9, 2020
@lifubang lifubang deleted the pidnamespace branch October 6, 2023 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants