Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
macos: use posix_spawn instead of fork
Applications running on hardened runtime based on Chromium/Electron create mmap regions using MAP_JIT flag. With macOS Big Sur the fork() calls done by uv_spawn have become slow. This is because fork() seems to physically copy all JIT memory regions (no-copy-on-write). On previous OS, these regions weren't accessible at all in the forked process, explaining the regression. The fix is to use posix_spawn() on macOS. This spawns a new process directly, without copying any memory mappings. Note that fork() is still used on earlier versions of macOS if the necessary posix_spawn() platform-specific extensions are not available. Fixes: libuv#3050 PR-URL: libuv#3064 Reviewed-By: Jameson Nash <vtjnash@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
- Loading branch information