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

[RFC] auxstr: show namespaces when -e namespace=switch is given #300

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

masatake
Copy link
Contributor

@masatake masatake commented May 7, 2024

While analyzing how a container engine works with strace, I want to have a feature printing namespace IDs. The prototype works like this:

    $ src/strace -qq -e signal=none -e unshare -e namespace=switch unshare --user --net /bin/true
    unshare(CLONE_NEWUSER|CLONE_NEWNET)     = 0 (net:[4026537408], user:[4026537407])
    $ src/strace -qq -f -e signal=none -e unshare,clone -e namespace=switch \
      		 podman run --rm -ti registry.access.redhat.com/ubi7/ubi:latest /bin/true
    [pid 1089104] clone(child_stack=NULL, flags=CLONE_NEWNS|CLONE_NEWUSER|SIGCHLD) = 1089110 (mnt:[4026531841], user:[4026531837])
    [pid 1089104] clone(child_stack=NULL, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 1089111
    ERRO[0000] running `/usr/bin/newuidmap 1089110 0 1000 1 1 100000 65536`: newuidmap: write to uid_map failed: Operation not permitted
    Error: cannot set up namespace using "/usr/bin/newuidmap": exit status 1

If this one is an acceptable idea, I want to get the comment about the name of the option: -e namespace=switch.

TODO

  • update the --help message
  • add a test case for the option syntax
  • add a test case for unshare(2)
  • add a test case for setns(2)
  • add a test case for clone(2)
  • add a test case for clone3(2)
  • write commit logs in ChangeLog style
  • update the man page

@ldv-alt
Copy link
Member

ldv-alt commented May 8, 2024

Interesting. What's the idea behind the name namespace=switch?

@masatake
Copy link
Contributor Author

masatake commented May 8, 2024

Interesting. What's the idea behind the name namespace=switch?

With the option, strace reports namespaces when processes switch them.

Anyway, I'll continue developing this feature.

    $ src/strace -qq -e signal=none -e unshare -e namespace=switch unshare --user --net /bin/true
    unshare(CLONE_NEWUSER|CLONE_NEWNET)     = 0 (net:[4026537408], user:[4026537407])
    $ src/strace -qq -f -e signal=none -e unshare,clone -e namespace=switch \
      		 podman run --rm -ti registry.access.redhat.com/ubi7/ubi:latest /bin/true
    [pid 1089104] clone(child_stack=NULL, flags=CLONE_NEWNS|CLONE_NEWUSER|SIGCHLD) = 1089110 (mnt:[4026531841], user:[4026531837])
    [pid 1089104] clone(child_stack=NULL, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 1089111
    ERRO[0000] running `/usr/bin/newuidmap 1089110 0 1000 1 1 100000 65536`: newuidmap: write to uid_map failed: Operation not permitted
    Error: cannot set up namespace using "/usr/bin/newuidmap": exit status 1

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants