Documentation
¶
Overview ¶
This program is used when cpud is not available. It takes a mount point environment variable, LC_CPU_FSTAB, and environment specified by -env, and invokes itself several times, as needed, to create a private name space for a user command. This all gets a bit tricky as we must do a few things as root, and setuid back in the end. In an earlier version, we used unshare, but that introduces a dependency we would prefer not to have. The sequence: 1st pass: check if we are uid 0, if not, sudo os.Executable 2nd pass: we are uid 0, check if namespace is private, if not,
execute ourselves with cmd.SysProcattr.Unshareflags set to NS_PRIVATE This will only succeed or fail; it won't start the process with a non-private namespace.
3rd pass: create the proper mounts, and execute the user command.