I'm using this function call to clone()
clone (fun, (char*)stack + 0x500000, SIGCHLD | CLONE_FILES | CLONE_FS, arg);
where fun is a function: int fun(void*), stack = malloc (0x500000), and arg is of type void*.
I'm wondering what are some other possible causes for Invalid Argument perror.
I have checked stack is not NULL.
man clone:
The child_stack argument specifies the location of the stack used by
the child process. Since the child and calling process may share mem‐
ory, it is not possible for the child process to execute in the same
stack as the calling process. The calling process must therefore set
up memory space for the child stack and pass a pointer to this space to
clone(). Stacks grow downward on all processors that run Linux (except
the HP PA processors), so child_stack usually points to the topmost
address of the memory space set up for the child stack.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.