From 0a0de0fc4241c7531860e3c1a03ab4a4643ec37f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 4 Jan 2023 09:18:02 -0500 Subject: runtime: revert use of __fork to work around Apple atfork bugs An Apple engineer suggests that since __fork is not public API, it would be better to use a different fix. With the benefit of source code, they suggest using xpc_date_create_from_current instead of xpc_atfork_child. The latter sets some flags that disable certain functionality for the remainder of the process lifetime (expecting exec), while the former should do the necessary setup. Reverting the __fork fix in order to prepare a clean fix based on CL 451735 using xpc_date_create_from_current. This reverts commit c61d322d5f9e3fcffa4c523892af432dca030c12. Change-Id: I2da293ff537237ffd2d40ad756d827c95c84635b Reviewed-on: https://go-review.googlesource.com/c/go/+/460475 Auto-Submit: Russ Cox TryBot-Result: Gopher Robot Run-TryBot: Russ Cox Reviewed-by: Cherry Mui --- src/syscall/exec_libc2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/syscall/exec_libc2.go') diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go index 6e3c2bf9d7..41bc79a721 100644 --- a/src/syscall/exec_libc2.go +++ b/src/syscall/exec_libc2.go @@ -78,7 +78,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // About to call fork. // No more allocation or calls of non-assembly functions. runtime_BeforeFork() - r1, _, err1 = rawSyscall(forkTrampoline, 0, 0, 0) + r1, _, err1 = rawSyscall(abi.FuncPCABI0(libc_fork_trampoline), 0, 0, 0) if err1 != 0 { runtime_AfterFork() return 0, err1 @@ -276,6 +276,6 @@ childerror: // send error code on pipe rawSyscall(abi.FuncPCABI0(libc_write_trampoline), uintptr(pipe), uintptr(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) for { - rawSyscall(exitTrampoline, 253, 0, 0) + rawSyscall(abi.FuncPCABI0(libc_exit_trampoline), 253, 0, 0) } } -- cgit v1.3-6-g1900