You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to use nsjail in STANDALONE_EXECVE mode along with --execute_fd since the binary to be executed doesn't exist in the chroot. Unfortunately, I'm finding that the same set of steps works on some systems but not others. Currently the only commonality between the failing systems has been the fact that they're running Debian. The following script attempts to reproduce the issue (requires nsjail, xz, curl, which and mktemp):
#!/usr/bin/env bash
set -eu
CHROOT="/tmp/nsjail-ubuntu-focal"
if ! [ -d "${CHROOT}" ]; then
UNPACK_DIR=$(mktemp -p /tmp -d)
trap "rm -rf \"${UNPACK_DIR}\"" EXIT HUP INT TERM
curl -s https://cloud-images.ubuntu.com/minimal/releases/focal/release-20210720/ubuntu-20.04-minimal-cloudimg-amd64-root.tar.xz | tar -xJ --exclude="dev/*" -C "${UNPACK_DIR}"
mv "${UNPACK_DIR}" "${CHROOT}"
fi
echo "Environment: "
env
echo -n "System: "
uname -a
echo -n "nsjail location: "
which nsjail
nsjail -Me -c "${CHROOT}" --execute_fd -- "${CHROOT}/bin/echo" "Hello world!"
In the working case, this would be expected to print Hello world!. On failing systems, output is as follows (I've removed the environment variable dump). This run is on a x86_64 system running Debian testing running a 5.10.46 kernel.
Meanwhile, I've seen successful runs on Ubuntu, Arch and WSL2 Ubuntu systems. Things also execute correctly on a failing system if I pass --disable_clone_newns to nsjail. My own attempt to add debugging information to nsjail suggests that the file descriptor being passed to execveat is valid. The issue also occurs if the binary is statically linked (I tried using a statically linked busybox as the process to execute).
I'm aware that in the early days, Debian added some patches that meant certain namespacing functionality could only be enabled by a kernel option (https://lwn.net/Articles/673597/), however I do not believe that any such "hardening" exists now. I'm somewhat at a loss, and am unsure if this behaviour is due to a kernel, or some other environmental factor.
The text was updated successfully, but these errors were encountered:
I've been trying to use
nsjail
inSTANDALONE_EXECVE
mode along with--execute_fd
since the binary to be executed doesn't exist in the chroot. Unfortunately, I'm finding that the same set of steps works on some systems but not others. Currently the only commonality between the failing systems has been the fact that they're running Debian. The following script attempts to reproduce the issue (requires nsjail, xz, curl, which and mktemp):In the working case, this would be expected to print
Hello world!
. On failing systems, output is as follows (I've removed the environment variable dump). This run is on a x86_64 system running Debian testing running a 5.10.46 kernel.Meanwhile, I've seen successful runs on Ubuntu, Arch and WSL2 Ubuntu systems. Things also execute correctly on a failing system if I pass
--disable_clone_newns
to nsjail. My own attempt to add debugging information to nsjail suggests that the file descriptor being passed toexecveat
is valid. The issue also occurs if the binary is statically linked (I tried using a statically linked busybox as the process to execute).I'm aware that in the early days, Debian added some patches that meant certain namespacing functionality could only be enabled by a kernel option (https://lwn.net/Articles/673597/), however I do not believe that any such "hardening" exists now. I'm somewhat at a loss, and am unsure if this behaviour is due to a kernel, or some other environmental factor.
The text was updated successfully, but these errors were encountered: