DescriptionAdd a ForkWithFlags wrapper using the libc clone wrapper.
sys_clone directly invokes the syscall, which does not update
libc's PID cache in the child. Although the libc wrapper function
updates the PID cache, it unfortunately requires that the child run on a
different stack, even if CLONE_VM is not specified. We work around this
by briefly switching stacks in the child, then using longjmp to switch
back. This gives us a version of clone with fork-like behavior, which is
what we need for starting processes in new namespaces.
This is a 2nd attempt at crrev.com/801033002, which caused failures
under valgrind and FORTIFY_SOURCE.
BUG=312380, 442817, 442912
Committed: https://crrev.com/9eb564175dbd452196f782da2b28e3e8e79c49a5
Cr-Commit-Position: refs/heads/master@{#308744}
Patch Set 1 #
Total comments: 11
Patch Set 2 : Respond to comments. #
Messages
Total messages: 8 (2 generated)
|