pufferffish / wireproxy

Wireguard client that exposes itself as a socks5 proxy
ISC License
4.55k stars 272 forks source link

Crash on armv7l architecture: panic: unaligned 64-bit atomic operation #61

Closed mdartmann closed 1 year ago

mdartmann commented 1 year ago

Hi,

when trying to run wireproxy, both on the latest tag v1.0.5 and the latest git commit, on my Banana Pi M2 Ultra (which has an armv7l chip), the program crashes with the following output:

❯ ./wireproxy -c ~/.config/wireproxy/wireproxy.conf
DEBUG: 2023/03/10 11:10:44 Routine: handshake worker 1 - started
DEBUG: 2023/03/10 11:10:44 Routine: encryption worker 1 - started
DEBUG: 2023/03/10 11:10:44 UAPI: Updating private key
DEBUG: 2023/03/10 11:10:44 Routine: event worker - started
DEBUG: 2023/03/10 11:10:44 Routine: decryption worker 4 - started
DEBUG: 2023/03/10 11:10:44 Routine: encryption worker 4 - started
DEBUG: 2023/03/10 11:10:44 Routine: handshake worker 4 - started
DEBUG: 2023/03/10 11:10:44 Routine: encryption worker 3 - started
DEBUG: 2023/03/10 11:10:44 Routine: handshake worker 2 - started
DEBUG: 2023/03/10 11:10:44 Routine: TUN reader - started
DEBUG: 2023/03/10 11:10:44 Routine: decryption worker 3 - started
DEBUG: 2023/03/10 11:10:44 Routine: decryption worker 2 - started
DEBUG: 2023/03/10 11:10:44 Routine: handshake worker 3 - started
DEBUG: 2023/03/10 11:10:44 Routine: decryption worker 1 - started
DEBUG: 2023/03/10 11:10:44 Routine: encryption worker 2 - started
DEBUG: 2023/03/10 11:10:44 Interface up requested
DEBUG: 2023/03/10 11:10:44 UDP bind has been updated
DEBUG: 2023/03/10 11:10:44 Routine: receive incoming v4 - started
DEBUG: 2023/03/10 11:10:44 Routine: receive incoming v6 - started
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Created
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Updating endpoint
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Updating persistent keepalive interval
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Updating preshared key
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Adding allowedip
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - UAPI: Adding allowedip
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - Starting
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - Sending keepalive packet
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - Sending handshake initiation
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - Routine: sequential sender - started
DEBUG: 2023/03/10 11:10:44 peer(ms4v…4bU0) - Routine: sequential receiver - started
DEBUG: 2023/03/10 11:10:44 Interface state was Down, requested Up, now Up
DEBUG: 2023/03/10 11:10:44 Routine: handshake worker 1 - stopped
panic: unaligned 64-bit atomic operation

goroutine 16 [running]:
runtime/internal/atomic.panicUnaligned()
    /usr/lib/go-1.20/src/runtime/internal/atomic/unaligned.go:8 +0x24
runtime/internal/atomic.Load64(0x1039754)
    /usr/lib/go-1.20/src/runtime/internal/atomic/atomic_arm.s:280 +0x14
golang.zx2c4.com/wireguard/device.(*Device).IsUnderLoad(0x1039680)
    /home/mae/.go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.0-20220829161405-d1d08426b27b/device/device.go:226 +0x11c
golang.zx2c4.com/wireguard/device.(*Device).RoutineHandshake(0x1039680, 0x1)
    /home/mae/.go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.0-20220829161405-d1d08426b27b/device/receive.go:291 +0x44c
created by golang.zx2c4.com/wireguard/device.NewDevice
    /home/mae/.go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.0-20220829161405-d1d08426b27b/device/device.go:316 +0x2e0

The build runs just fine. I am using go 1.20 from Armbian Lunar which is based on Ubuntu Lunar (23.04).

Is 32-bit ARM supported/has it been tested yet? Do you know if there is a way to make this run with this architecture?

Thank you!

sasha0552 commented 1 year ago

I solved this by using command go get golang.zx2c4.com/wireguard to update wireguard dependency to the latest version.

mdartmann commented 1 year ago

closing this issue as I switched to something else for my proxying needs