克隆系统调用 - 我可以在父进程中取消分配堆栈内存吗?

clone syscall - can i deallocate stack memory in parent process?

clone returns 之后释放传递给 clonechild_stack 参数的堆栈缓冲区是否安全(如果 CLONE_VM 不是指定)?

引用clone man page

If CLONE_VM is not set, the child process runs in a separate copy of the memory space of the calling process at the time of clone(). Memory writes or file mappings/unmappings performed by one of the processes do not affect the other, as with fork(2).

这也包括 child_stack,它只是像其他所有内容一样被复制了。

所以是的,parent 可以释放它,child 使用副本,不再是原来的。