brahma-adshonor / gohook

a funny library to hook golang function at runtime
https://www.cnblogs.com/catch/p/10973611.html
MIT License
512 stars 72 forks source link

v1.1.9 on Go 1.20.1 panic: permission denied #53

Open TommyLemon opened 1 year ago

TommyLemon commented 1 year ago

https://github.com/TommyLemon/UnitAuto

image
/Users/tommylemon/sdk/go1.20.1/bin/go build -o /private/var/folders/x8/2jhwrrd93f79qjpl9pzlnkym0000gn/T/GoLand/___go_build_github_com_TommyLemon_unitauto_go -gcflags all=-N -l github.com/TommyLemon/unitauto-go #gosetup
/Applications/GoLand.app/Contents/plugins/go-plugin/lib/dlv/macarm/dlv --listen=127.0.0.1:61275 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /private/var/folders/x8/2jhwrrd93f79qjpl9pzlnkym0000gn/T/GoLand/___go_build_github_com_TommyLemon_unitauto_go --
API server listening at: 127.0.0.1:61275
debugserver-@(#)PROGRAM:LLDB  PROJECT:lldb-1400.0.38.17
 for arm64.
Got a connection, launched process /private/var/folders/x8/2jhwrrd93f79qjpl9pzlnkym0000gn/T/GoLand/___go_build_github_com_TommyLemon_unitauto_go (pid = 11153).
WARNING: undefined behavior - version of Delve is too old for Go version 1.20.1 (maximum supported version 1.19)
Hi, origin func
-------
panic: permission denied

goroutine 1 [running]:
github.com/brahma-adshonor/gohook.setPageWritable(0x1050d4990, 0x7, 0x7)
        /Users/tommylemon/go/pkg/mod/github.com/brahma-adshonor/gohook@v1.1.9/utility_unix.go:19 +0xe0
github.com/brahma-adshonor/gohook.CopyInstruction(0x1050d4990, {0x1050d47f0, 0x7, 0x7})
        /Users/tommylemon/go/pkg/mod/github.com/brahma-adshonor/gohook@v1.1.9/utility_unix.go:26 +0x58
github.com/brahma-adshonor/gohook.hookFunction(0x40, 0x0, 0x1050d47f0, 0x1050d48c0, 0x1050d4990)
        /Users/tommylemon/go/pkg/mod/github.com/brahma-adshonor/gohook@v1.1.9/utility.go:213 +0xbd8
github.com/brahma-adshonor/gohook.doHook(0x40, 0x0, {0x105183cc0, 0x105214e98, 0x13}, {0x105183cc0, 0x105214e88, 0x13}, {0x105183cc0, 0x105214ea0, ...})
        /Users/tommylemon/go/pkg/mod/github.com/brahma-adshonor/gohook@v1.1.9/hook.go:164 +0x448
github.com/brahma-adshonor/gohook.Hook({0x105183cc0, 0x105214e98}, {0x105183cc0, 0x105214e88}, {0x105183cc0, 0x105214ea0})
        /Users/tommylemon/go/pkg/mod/github.com/brahma-adshonor/gohook@v1.1.9/hook.go:71 +0xc8
main.main()
        /Users/tommylemon/unitauto-go/main.go:106 +0xb8
Exiting.

Debugger finished with the exit code 0
kmalloc commented 1 year ago

we don't support ARM arch yet.

TommyLemon commented 1 year ago

well, thanks for ur reply, I'll try Intel chip later

TommyLemon commented 1 year ago

it does work on Intel i5 & macOS 12.6.1 & Go 1.20.1, thx.

image

hope this repo support ARM~

huting0211 commented 1 year ago

what a pity~