Note: This issue was cloned from projectdiscovery/nuclei#7327 as requested by @dwisiswant0.
Is there an existing issue for this?
Current Behavior
Crash on macOS (Apple Silicon): SIGSEGV in go-m1cpu during initialization
Description
A segmentation fault occurs immediately when running httpx on macOS (Apple Silicon). The crash happens during program initialization, before any user input or scan logic is executed.
The stack trace indicates that the issue originates from the github.com/shoenig/go-m1cpu dependency during its initialize() call (cgo execution).
Steps to Reproduce
Install or build httpx on macOS (arm64)
Run:
httpx
Observe immediate crash
Expected Behavior
The binary should start normally and display usage/help output.
Actual Behavior
The process crashes with a segmentation fault during initialization.
Stack Trace
SIGSEGV: segmentation violation
PC=0x18a7871a8 m=0 sigcode=2 addr=0x0
signal arrived during cgo execution
runtime.cgocall(...)
github.com/shoenig/go-m1cpu._Cfunc_initialize()
github.com/shoenig/go-m1cpu.init.0()
runtime.doInit1(...)
runtime.main()
Environment
OS: macOS arm 26.4 BuildVersion 25E246
Go version: go1.26.1
httpx version: (fill this, e.g. v1.9.0 or latest dev)
Installation method: (brew / go install / manual build)
Additional Context
The crash occurs before any flags or input are processed.
The issue appears to be related to go-m1cpu initialization on Apple Silicon.
Similar crashes have been observed in other Go projects using this dependency on macOS arm64.
Possible Cause
The go-m1cpu library may be invoking unsupported or unsafe cgo calls during CPU feature detection on Apple Silicon, leading to a null pointer dereference.
Workarounds Tried
Running different binaries (arm64 / amd64 via Rosetta)
Reinstalling via Homebrew and go install
Issue persists
Expected Behavior
none
Steps To Reproduce
brew install nuclei
nuclei
Relevant log output
SIGSEGV: segmentation violation
PC=0x18a7871a8 m=0 sigcode=2 addr=0x0
signal arrived during cgo execution
goroutine 1 gp=0x3c6f8a6c1e0 m=0 mp=0x10b50b180 [syscall, locked to thread]:
runtime.cgocall(0x1069d1c58, 0x3c6f8b2ce08)
runtime/cgocall.go:167 +0x44 fp=0x3c6f8b2cdd0 sp=0x3c6f8b2cd90 pc=0x104556bc4
github.com/shoenig/go-m1cpu._Cfunc_initialize()
_cgo_gotypes.go:138 +0x2c fp=0x3c6f8b2ce00 sp=0x3c6f8b2cdd0 pc=0x10509ddec
github.com/shoenig/go-m1cpu.init.0()
github.com/shoenig/go-m1cpu@v0.1.6/cpu.go:148 +0x1c fp=0x3c6f8b2ce10 sp=0x3c6f8b2ce00 pc=0x10509de2c
runtime.doInit1(0x10b08c6e0)
runtime/proc.go:8103 +0xc4 fp=0x3c6f8b2cf30 sp=0x3c6f8b2ce10 pc=0x104534344
runtime.doInit(...)
runtime/proc.go:8070
runtime.main()
runtime/proc.go:258 +0x244 fp=0x3c6f8b2cfd0 sp=0x3c6f8b2cf30 pc=0x104524384
runtime.goexit({})
runtime/asm_arm64.s:1447 +0x4 fp=0x3c6f8b2cfd0 sp=0x3c6f8b2cfd0 pc=0x104562764
Environment
- OS: macOS arm 26.4 BuildVersion 25E246
- Nuclei: nuclei -version segmentation violation
- Go: go 1.26.1
Anything else?
No response
Is there an existing issue for this?
Current Behavior
Crash on macOS (Apple Silicon): SIGSEGV in go-m1cpu during initialization
Description
A segmentation fault occurs immediately when running httpx on macOS (Apple Silicon). The crash happens during program initialization, before any user input or scan logic is executed.
The stack trace indicates that the issue originates from the github.com/shoenig/go-m1cpu dependency during its initialize() call (cgo execution).
Steps to Reproduce
Install or build httpx on macOS (arm64)
Run:
httpx
Observe immediate crash
Expected Behavior
The binary should start normally and display usage/help output.
Actual Behavior
The process crashes with a segmentation fault during initialization.
Stack Trace
SIGSEGV: segmentation violation
PC=0x18a7871a8 m=0 sigcode=2 addr=0x0
signal arrived during cgo execution
runtime.cgocall(...)
github.com/shoenig/go-m1cpu._Cfunc_initialize()
github.com/shoenig/go-m1cpu.init.0()
runtime.doInit1(...)
runtime.main()
Environment
OS: macOS arm 26.4 BuildVersion 25E246
Go version: go1.26.1
httpx version: (fill this, e.g. v1.9.0 or latest dev)
Installation method: (brew / go install / manual build)
Additional Context
The crash occurs before any flags or input are processed.
The issue appears to be related to go-m1cpu initialization on Apple Silicon.
Similar crashes have been observed in other Go projects using this dependency on macOS arm64.
Possible Cause
The go-m1cpu library may be invoking unsupported or unsafe cgo calls during CPU feature detection on Apple Silicon, leading to a null pointer dereference.
Workarounds Tried
Running different binaries (arm64 / amd64 via Rosetta)
Reinstalling via Homebrew and go install
Issue persists
Expected Behavior
none
Steps To Reproduce
brew install nuclei
nuclei
Relevant log output
Environment
Anything else?
No response