shadowsocks / crypto2

The fastest cryptographic library in the galaxy
MIT License
350 stars 39 forks source link

The i386 build seems to have problems with illegal instructions. #6

Closed madeye closed 3 years ago

madeye commented 3 years ago

The i386 build seems to have problems with illegal instructions.

I guess it's related to crypto2: https://github.com/shadowsocks/crypto2/blob/master/src/blockcipher/aes/x86.rs#L13

For some old x86 devices without AES instructions, we may need to disable the ASM here.

To simplify the logic, we can totally disable assembly acceleration on armeabi and i386 build.

/data/user_de/0/com.github.shadowsocks/no_backup/stat_main -c /data/user/0/com.github.shadowsocks/no_backup/shadowsocks.conf --vpn -U --dns-addr 127.0.0.1:5450 --remote-dns-addr dns.google:53 --acl /data/user_de/0/com.github.shadowsocks/no_backup/bypass-lan.acl
12-11 16:58:39.620 11047 11047 F libc    : Fatal signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0x5f62c2e7 in tid 11047 (libsslocal.so), pid 11047 (libsslocal.so)
12-11 16:58:39.657 11053 11053 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
12-11 16:58:39.660  1873  1873 I /system/bin/tombstoned: received crash request for pid 11047
12-11 16:58:39.672 11053 11053 I crash_dump32: performing dump of process 11047 (target tid = 11047)
12-11 16:58:39.672 11053 11053 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-11 16:58:39.672 11053 11053 F DEBUG   : Build fingerprint: 'google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:user/release-keys'
12-11 16:58:39.672 11053 11053 F DEBUG   : Revision: '0'
12-11 16:58:39.672 11053 11053 F DEBUG   : ABI: 'x86'
12-11 16:58:39.672 11053 11053 F DEBUG   : Timestamp: 2020-12-11 16:58:39+0800
12-11 16:58:39.673 11053 11053 F DEBUG   : pid: 11047, tid: 11047, name: libsslocal.so  >>> /data/app/com.github.shadowsocks-aP4h93XpVwl34bjFzFASdQ==/lib/x86/libsslocal.so <<<
12-11 16:58:39.673 11053 11053 F DEBUG   : uid: 10134
12-11 16:58:39.673 11053 11053 F DEBUG   : signal 4 (SIGILL), code 2 (ILL_ILLOPN), fault addr 0x5f62c2e7 (*pc=0x8328f8c5)
12-11 16:58:39.673 11053 11053 F DEBUG   :     eax ffb366f4  ebx 5f9abe24  ecx ef469068  edx 00000000
12-11 16:58:39.673 11053 11053 F DEBUG   :     edi ffb366f4  esi 0000000d
12-11 16:58:39.673 11053 11053 F DEBUG   :     ebp ffb366f4  esp ffb36630  eip 5f62c2e7
12-11 16:58:39.685 11053 11053 F DEBUG   :
12-11 16:58:39.685 11053 11053 F DEBUG   : backtrace:
12-11 16:58:39.685 11053 11053 F DEBUG   :       #00 pc 000cb2e7  /data/app/com.github.shadowsocks-aP4h93XpVwl34bjFzFASdQ==/lib/x86/libsslocal.so
12-11 16:58:39.685 11053 11053 F DEBUG   :       #01 pc 000898e8  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+120) (BuildId: 76290498408016ad14f4b98c3ab6c65c)

Originally posted by @madeye in https://github.com/shadowsocks/shadowsocks-android/issues/2622#issuecomment-743070303