1
0
mirror of https://github.com/golang/go synced 2024-09-23 17:10:13 -06:00

syscall: don't generate ptrace on iOS

May fix #43302.

Change-Id: I6b7ddf94495c4fa80cf8a50a38eef5f8b2872669
Reviewed-on: https://go-review.googlesource.com/c/go/+/279481
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Cherry Zhang 2020-12-21 13:14:41 -05:00
parent 6cff874c47
commit bc7e4d9257
7 changed files with 31 additions and 5 deletions

View File

@ -125,7 +125,7 @@ while(<>) {
# without reading the header.
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
if ($darwin && $func eq "ptrace") {
if ($darwin && $func eq "ptrace1") {
# The ptrace function is called from forkAndExecInChild where stack
# growth is forbidden.
$text .= "//go:nosplit\n"

View File

@ -0,0 +1,14 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !ios
package syscall
// Nosplit because it is called from forkAndExecInChild.
//
//go:nosplit
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
return ptrace1(request, pid, addr, data)
}

12
src/syscall/ptrace_ios.go Normal file
View File

@ -0,0 +1,12 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package syscall
// Nosplit because it is called from forkAndExecInChild.
//
//go:nosplit
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
panic("unimplemented")
}

View File

@ -21,7 +21,7 @@ func setTimeval(sec, usec int64) Timeval {
//sys Stat(path string, stat *Stat_t) (err error) = SYS_stat64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_statfs64
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_fstatat64
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)

View File

@ -21,7 +21,7 @@ func setTimeval(sec, usec int64) Timeval {
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, stat *Statfs_t) (err error)
//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)

View File

@ -2091,7 +2091,7 @@ func libc_fstatat64_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
//go:nosplit
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)

View File

@ -2091,7 +2091,7 @@ func libc_fstatat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
//go:nosplit
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)