Bug 11561 - Argument parsing in nsenter incorrect
Summary: Argument parsing in nsenter incorrect
Status: RESOLVED INVALID
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.28.x
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-11 14:58 UTC by hackintosh
Modified: 2018-12-11 15:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hackintosh 2018-12-11 14:58:41 UTC
The correct syntax for nsenter is

    BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3) multi-call binary.

    Usage: nsenter [OPTIONS] [PROG [ARGS]]

        -t,--target PID         Target process to get namespaces from
        -m,--mount[=FILE]       Enter mount namespace
        -u,--uts[=FILE]         Enter UTS namespace (hostname etc)
        -i,--ipc[=FILE]         Enter System V IPC namespace
        -n,--net[=FILE]         Enter network namespace
        -p,--pid[=FILE]         Enter pid namespace
        -U,--user[=FILE]        Enter user namespace
        -S,--setuid UID         Set uid in entered namespace
        -G,--setgid GID         Set gid in entered namespace
        --preserve-credentials  Don't touch uids or gids
        -r,--root[=DIR]         Set root directory
        -w,--wd[=DIR]           Set working directory
        -F,--no-fork            Don't fork before exec'ing PROG

However, running `busybox nsenter -t` opens a shell in the current namespace and `busybox nsenter -t $$` says `nsenter: can't execute '(my pid)': No such file or directory`.
On the util-linux of my ubuntu system, `busybox nsenter -t` fails with incorrect arguments and the latter command succeeds and changes namespace, as expected.
I have checked this and it exists both on arm64 Android and amd64 (both precompiled binaries from busybox.net). This makes it impossible to use nsenter, as arguments cannot be passed correctly.