Description
Linux 5.3 added a new system call, clone3()
, which provides a superset of the functionality of the older clone()
. In particular, it adds a way for a child to be spawned in a different cgroup, which solves a number of issues (see CLONE_INTO_CGROUP
flag in clone3(2) man page for details).
It would be great for some software written in Go to benefit from this new functionality. Obviously, calling clone3()
syscall directly won't work since Go runtime needs to perform specific steps around fork and exec.
So, the support for clone3 needs to be in the syscall package, where clone()
is called.
Looks like this can be implemented by amending linux SysProcAttr
structure with a pointer to CloneArgs
(a new structure that mirrors that of C.clone_args
). Then, forkAndExecInChild
would use clone3
instead of clone
if this pointer is non-nil. This can be used from e.g. os/exec
can set cmd.SysProcArgs.CloneArgs
.
Metadata
Metadata
Assignees
Type
Projects
Status