Alpine Linux x86 segmentation fault
westsuhanic opened this issue · comments
Hello All:
Thank you for your work it is appreciated.
uname -ar yields:
Linux routerplus4 4.9.65-1-hardened #2-Alpine SMP Mon Nov 27 15:36:15 GMT 2017 i686 Linux
The following information is received:
[2018-04-30 14:59:11] [NOTICE] dnscrypt-proxy is ready - live servers: 31
unexpected fault address 0x30a4a000
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x30a4a000 pc=0x1304d9de]
goroutine 76 [running]:
runtime.throw(0x13274a5e, 0x5)
/usr/lib/go/src/runtime/panic.go:616 +0x77 fp=0x307fac08 sp=0x307fabfc pc=0x12f03bd7
runtime.sigpanic()
/usr/lib/go/src/runtime/signal_unix.go:395 +0x1e4 fp=0x307fac2c sp=0x307fac08 pc=0x12f195a4
github.com/aead/chacha20/chacha.xorKeyStreamSSE2(0x307fad2c, 0x40, 0x40, 0x307fad2c, 0x40, 0x40, 0x304640d0, 0x30464090, 0x14, 0x1304c965)
/home/buildozer/aports/community/dnscrypt-proxy/src/dnscrypt-proxy-2.0.11/src/github.com/aead/chacha20/chacha/chacha_386.s:157 +0x16e fp=0x307fac30 sp=0x307fac2c pc=0x1304d9de
github.com/aead/chacha20/chacha.xorKeyStream(0x307fad2c, 0x40, 0x40, 0x307fad2c, 0x40, 0x40, 0x304640d0, 0x30464090, 0x14, 0x20)
/home/buildozer/aports/community/dnscrypt-proxy/src/dnscrypt-proxy-2.0.11/src/github.com/aead/chacha20/chacha/chacha_386.go:65 +0x8e fp=0x307fac5c sp=0x307fac30 pc=0x1304c9ee
github.com/aead/chacha20/chacha.(*Cipher).XORKeyStream(0x30464090, 0x307fad2c, 0x40, 0x40, 0x307fad2c, 0x40, 0x40)
/home/buildozer/aports/community/dnscrypt-proxy/src/dnscrypt-proxy-2.0.11/src/github.com/aead/chacha20/chacha/chacha.go:165 +0x1b3 fp=0x307fac98 sp=0x307fac5c pc=0x1304c643
runtime: unexpected return pc for github.com/jedisct1/xsecretbox.Seal called from 0xa2b43a61
stack: frame={sp:0x307fac98, fp:0x307fad88} stack=[0x307fa000,0x307fb000)
307fac18: 30a4a000 303af260 12f2d661 <runtime.morestack+65> 12f193c5 <runtime.sigpanic+5>
307fac28: 1304d9de <github.com/aead/chacha20/chacha.xorKeyStreamSSE2+366> 1304c9ee <github.com/aead/chacha20/chacha.xorKeyStream+142> 307fad2c 00000040
307fac38: 00000040 307fad2c 00000040 00000040
307fac48: 304640d0 30464090 00000014 1304c965 <github.com/aead/chacha20/chacha.xorKeyStream+5>
307fac58: 1304c643 <github.com/aead/chacha20/chacha.(*Cipher).XORKeyStream+435> 307fad2c 00000040 00000040
307fac68: 307fad2c 00000040 00000040 304640d0
307fac78: 30464090 00000014 00000020 00000020
307fac88: 00000000 00000000 1304c495 <github.com/aead/chacha20/chacha.(*Cipher).XORKeyStream+5> 13055af8 <github.com/jedisct1/xsecretbox.Seal+216>
307fac98: <30464090 307fad2c 00000040 00000040
307faca8: 307fad2c 00000040 00000040 30464090
307facb8: 00000000 00000000 7fffffff 0000001f
/cc @aead
Looks like that one is going to haunt us forever :)
@westsuhanic Don't use the Alpine Linux package. Use the standard package you can download here: https://github.com/jedisct1/dnscrypt-proxy/releases
@aead Maybe due to this:
BUFFER_KEYSTREAM:
MOVL block+24(FP), State // <- oooooooooohhhhhhhhhhh
MOVOU X4, 0(State)
MOVOU X5, 16(State)
MOVOU X6, 32(State)
MOVOU X7, 48(State)
MOVL Len, Rounds // <- aaaaaaaaaahhhhhhhhhh
FINALIZE(Dst, Src, State, Rounds, Tmp0, Tmp1)
And elsewhere...
DONE:
MOVL Tmp2, Stack // restore stack pointer
MOVL state+28(FP), Tmp0 // <- bleh
MOVOU X3, 3*16(Tmp0)
MOVL Len, ret+36(FP)
RET
This is really annoying.
Are there some specific/different flags you’re using to compile the i386 version?
I’d like to try to understand more about why the alpine build borks but your build is fine. I’d like to get the alpine build solid if possible...