]> Cypherpunks repositories - gostls13.git/commit
syscall: use rawSyscall6 to call ptrace in forkAndExecInChild
authorqmuntal <quimmuntal@gmail.com>
Thu, 2 Oct 2025 13:12:30 +0000 (15:12 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Tue, 21 Oct 2025 17:45:23 +0000 (10:45 -0700)
commit8a6c64f4fe726c956ea876cea0fed9494290130f
tree9f4e8e2385684ec81b94cf2c84e9fd5342e5cfc6
parent4620db72d273097a1c5fd11e44ce688618559579
syscall: use rawSyscall6 to call ptrace in forkAndExecInChild

On darwin and openbsd, the autogenerated ptrace wrapper is
nosplit because it is called from forkAndExecInChild.

This makes it difficult to modify and improve the underlying
syscall mechanism, as ptrace is almost over the nosplit limit.

We better call ptrace directly using rawSyscall6 in
forkAndExecInChild so that we can lift the ptrace nosplit
restriction to.

Doing so also fixes a long-standing inconsistency:
forkAndExecInChild is documented to only allow rawSyscall, but
the ptrace wrapper is using non-raw syscalls.

Updates #64113

Change-Id: Ibbbb218511561c1a5cb5b6d288a691f9738b14a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/708575
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/syscall/exec_libc2.go
src/syscall/mksyscall.pl
src/syscall/zsyscall_darwin_amd64.go
src/syscall/zsyscall_darwin_arm64.go
src/syscall/zsyscall_openbsd_386.go
src/syscall/zsyscall_openbsd_amd64.go
src/syscall/zsyscall_openbsd_arm.go
src/syscall/zsyscall_openbsd_arm64.go
src/syscall/zsyscall_openbsd_ppc64.go
src/syscall/zsyscall_openbsd_riscv64.go