Open
Description
clone()
has a few issues when used with CLONE_VM
, unless it is used together with CLONE_VFORK
.
- it takes a
Box<FnMut>
by value, which will be moved, dropped, and destroyed when the function returns back to the caller.- essentially means it will unconditionally segfault when passed
CLONE_VM
- essentially means it will unconditionally segfault when passed
- Even if it did work, the mutable borrow of the stack will end once the
clone()
call returns, even if the cloned process is still running, meaning you can modify the child process' stack as it runs. - There's no way to provide the thread/TLS/etc. parameters for the thread-related flags.
I was actually going to suggest that its prototype be changed to an unboxed FnOnce
, since the caller's stack will never fall out from under you unless CLONE_VM
is used... but I think it also needs to disallow the CLONE_VM
flag entirely (unless CLONE_VM | CLONE_VFORK
). Perhaps offer a second unsafe version for that use.