open-quantum-safe / liboqs-go

Go bindings for liboqs
https://openquantumsafe.org/
MIT License
69 stars 24 forks source link

Container from openquantumsafe/go doesn't run on Intel #16

Closed JannisFengler closed 1 year ago

JannisFengler commented 1 year ago

If I pull the openquantumsafe/go from the docker hub on my AMD Ryzen 7 7700X, every test pass and the container is working.

If I do the same on my Intel Laptop with an Intel Core i7 10710U, the tests are not passing and I get the following error:

2023/01/10 19:03:20 Correctness -  HQC-256
SIGILL: illegal instruction
PC=0x7f59ab0a35c8 m=0 sigcode=2
signal arrived during cgo execution
instruction bytes: 0x62 0xf2 0x7d 0x28 0x7c 0xc7 0x62 0xf3 0x65 0x28 0x1f 0xc8 0x4 0x62 0xf3 0x5d

goroutine 35 [syscall]:
runtime.cgocall(0x4fc130, 0xc00016bca8)
        /usr/lib/go-1.18/src/runtime/cgocall.go:157 +0x5c fp=0xc00016bc80 sp=0xc00016bc48 pc=0x4069bc
github.com/open-quantum-safe/liboqs-go/oqs._Cfunc_OQS_KEM_keypair(0x2181460, 0xc00016e000, 0xc000170000)
        _cgo_gotypes.go:199 +0x4c fp=0xc00016bca8 sp=0xc00016bc80 pc=0x4f566c
github.com/open-quantum-safe/liboqs-go/oqs.(*KeyEncapsulation).GenerateKeyPair.func1(0xc00016bd18?, {0xc00016e000, 0xc0001120a0?, 0x2?})
        /home/liboqs-go/oqs/oqs.go:175 +0x76 fp=0xc00016bce8 sp=0xc00016bca8 pc=0x4f68d6
github.com/open-quantum-safe/liboqs-go/oqs.(*KeyEncapsulation).GenerateKeyPair(0xc00016be30)
        /home/liboqs-go/oqs/oqs.go:175 +0x94 fp=0xc00016bd28 sp=0xc00016bce8 pc=0x4f67d4
github.com/open-quantum-safe/liboqs-go/oqstests.testKEMCorrectness({0xc00012e050, 0x7}, 0x0, 0xc000105380)
        /home/liboqs-go/oqstests/kem_test.go:39 +0x1ec fp=0xc00016bec8 sp=0xc00016bd28 pc=0x4f84ac
github.com/open-quantum-safe/liboqs-go/oqstests.TestKeyEncapsulationCorrectness(0xc000105380)
        /home/liboqs-go/oqstests/kem_test.go:92 +0x3a5 fp=0xc00016bf70 sp=0xc00016bec8 pc=0x4f8fc5
testing.tRunner(0xc000105380, 0x536a10)
        /usr/lib/go-1.18/src/testing/testing.go:1439 +0x102 fp=0xc00016bfc0 sp=0xc00016bf70 pc=0x4b6f42
testing.(*T).Run.func1()
        /usr/lib/go-1.18/src/testing/testing.go:1486 +0x2a fp=0xc00016bfe0 sp=0xc00016bfc0 pc=0x4b7dea
runtime.goexit()
        /usr/lib/go-1.18/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc00016bfe8 sp=0xc00016bfe0 pc=0x466d21
created by testing.(*T).Run
        /usr/lib/go-1.18/src/testing/testing.go:1486 +0x35f

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001051e0, {0x5319a5?, 0x4b6ca5?}, 0x536a10)
        /usr/lib/go-1.18/src/testing/testing.go:1487 +0x37a
testing.runTests.func1(0xc0001051e0?)
        /usr/lib/go-1.18/src/testing/testing.go:1839 +0x6e
testing.tRunner(0xc0001051e0, 0xc000050cd8)
        /usr/lib/go-1.18/src/testing/testing.go:1439 +0x102
testing.runTests(0xc000130140?, {0x5f8680, 0x7, 0x7}, {0x7f59aa6f2a68?, 0x40?, 0x0?})
        /usr/lib/go-1.18/src/testing/testing.go:1837 +0x457
testing.(*M).Run(0xc000130140)
        /usr/lib/go-1.18/src/testing/testing.go:1719 +0x5d9
main.main()
        _testmain.go:59 +0x1aa

rax    0x1f
rbx    0x7ffcc0e91260
rcx    0xd20fe8398e6f61c1
rdx    0x63
rdi    0x1af3
rsi    0x5b7708
rbp    0x7ffcc0e91210
rsp    0x7ffcc0e8e840
r8     0x0
r9     0x22141d0
r10    0x7f59aab844d0
r11    0xa97a873ed334c5a3
r12    0x189
r13    0x83
r14    0x20
r15    0x7ffcc0e8e860
rip    0x7f59ab0a35c8
rflags 0x10202
cs     0x33
fs     0x0
gs     0x0

Seems like the build is not portable. Maybe CPU information from the CI build system is leaking into the docker image.