From 4c5d6edeb2b10c2044d1ea2b4fa3e403133431c8 Mon Sep 17 00:00:00 2001 From: Dmitri Goutnik Date: Wed, 22 Feb 2023 10:58:14 -0500 Subject: syscall: add ptracePtr that accepts pointer arg as unsafe.Pointer The existing ptrace wrapper accepts pointer argument as an uintptr which often points to the memory allocated in Go. This violates unsafe.Pointer safety rules. Fixes #58387 Change-Id: Iab12122c495953f94ea00c2a61654a818a464205 Reviewed-on: https://go-review.googlesource.com/c/go/+/470299 TryBot-Result: Gopher Robot Run-TryBot: Dmitri Goutnik Reviewed-by: Bryan Mills Reviewed-by: Ian Lance Taylor Auto-Submit: Dmitri Goutnik --- src/syscall/zsyscall_linux_arm.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/syscall/zsyscall_linux_arm.go') diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go index 69f811a0ec..86d8e1c2d7 100644 --- a/src/syscall/zsyscall_linux_arm.go +++ b/src/syscall/zsyscall_linux_arm.go @@ -210,6 +210,16 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(arg) -- cgit v1.3-5-g9baa