huandu / go-tls

A bit safer approach to implement Thread Local Storage (TLS) for Go 1.7+.
MIT License
162 stars 15 forks source link

启动不起来了,Apple M1 Max #12

Closed zohu closed 2 years ago

zohu commented 2 years ago

panic: tls: fail to call mprotect(addr=0x10618d910, size=40, prot=0x2) with error invalid argument

goroutine 1 [running]: github.com/huandu/go-tls.mprotect(0x10618d910, 0x28, 0x2) /Users/xxx/work/go/pkg/mod/github.com/huandu/go-tls@v1.0.1/syscall_unix.go:34 +0x250 github.com/huandu/go-tls.init.1() /Users/xxx/work/go/pkg/mod/github.com/huandu/go-tls@v1.0.1/goexit.go:63 +0xd8 Exiting.

Debugger finished with the exit code 0

zohu commented 2 years ago

好吧,是因为用了1.17

huandu commented 2 years ago

Go1.17 是会有问题,但是你这个问题最主要的还是因为触发了 Mac DEP 机制,不允许将 read-only 内存修改成 read-write,之前都是因为用到了 GCCGo 编译造成的问题,不知道你这个是不是这样。

ychellboy commented 2 years ago

所以使用cgo就不能用这个库吗?

huandu commented 2 years ago

Cgo 应该是没问题,有问题的是 GCCGo。不过我现在没有最新的 M1 Max 机器,不知道现在是不是 Cgo 也不行了。