aboutsummaryrefslogtreecommitdiff
path: root/libgo/go
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2020-09-15 14:18:28 -0500
committerIan Lance Taylor <iant@golang.org>2020-09-17 12:14:09 -0700
commitc560591408440f441b8b327f5b41f9328d20b67b (patch)
treeac39d36225e7d451ca671154c9f424259b3c8702 /libgo/go
parent4839de55e2c98619f4919254abb87e2f393aaead (diff)
downloadgcc-c560591408440f441b8b327f5b41f9328d20b67b.zip
gcc-c560591408440f441b8b327f5b41f9328d20b67b.tar.gz
gcc-c560591408440f441b8b327f5b41f9328d20b67b.tar.bz2
libgo: fix ptrace syscall hooks into glibc
ptrace is actually declared as a variadic function. On ppc64le the ABI requires to the caller to allocate space for the parameters and allows the caller to modify them. On ppc64le, depending on how and what version of GCC is used, it will save to parameter save area. This happened to clobber a saved LR, and caused syscall.TestExecPtrace to fail with a timeout when the tracee segfaults, and waits for the parent process to inspect. Wrap this function to avoid directly calling glibc's ptrace from go. Fixes golang/go#36698 Fixes go/92567 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/254755
Diffstat (limited to 'libgo/go')
-rw-r--r--libgo/go/syscall/libcall_glibc.go2
-rw-r--r--libgo/go/syscall/libcall_linux.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/libgo/go/syscall/libcall_glibc.go b/libgo/go/syscall/libcall_glibc.go
index a90fc9b..823343d 100644
--- a/libgo/go/syscall/libcall_glibc.go
+++ b/libgo/go/syscall/libcall_glibc.go
@@ -32,7 +32,7 @@ func Futimes(fd int, tv []Timeval) (err error) {
}
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
-//ptrace(request _C_int, pid Pid_t, addr *byte, data *byte) _C_long
+//__go_ptrace(request _C_int, pid Pid_t, addr *byte, data *byte) _C_long
//sys accept4(fd int, sa *RawSockaddrAny, len *Socklen_t, flags int) (nfd int, err error)
//accept4(fd _C_int, sa *RawSockaddrAny, len *Socklen_t, flags _C_int) _C_int
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 88286c0..78fda0e 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -11,7 +11,7 @@ import (
)
//sysnb raw_ptrace(request int, pid int, addr *byte, data *byte) (err Errno)
-//ptrace(request _C_int, pid Pid_t, addr *byte, data *byte) _C_long
+//__go_ptrace(request _C_int, pid Pid_t, addr *byte, data *byte) _C_long
func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
// The peek requests are machine-size oriented, so we wrap it