Dear Maintainer,
I tried to get some more information to this crash and
could reproduce it on a Raspberry 3 running a Debian Buster armhf
image created by following script (with "arch: armhf" and linux-image-armmp):
https://salsa.debian.org/raspi-team/image-specs
The crash seems to happen at least on the initial key creation,
therefore is maybe just visible with an empty ~/.android.
"dmesg" shows following after the crash has happened:
[ 339.344841] Alignment trap: not handling instruction ecd6cb04 at
[]
[ 339.345111] Unhandled fault: alignment exception (0x001) at 0xb6c58ba1
[ 339.345328] pgd = 72cfb493
[ 339.345426] [b6c58ba1] *pgd=33fe8835
The backtrace from "coredumpctl gdb ..." just shows the last two frames:
(gdb) bt
#0 _bsaes_key_convert () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1037
#1 0xb6c5960e in bsaes_ctr32_encrypt_blocks () at
linux-arm/crypto/fipsmodule/bsaes-armv7.S:1371
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
When running in an debugger short before the crash the backtrace shows this:
(gdb) bt
#0 bsaes_ctr32_encrypt_blocks () at
linux-arm/crypto/fipsmodule/bsaes-armv7.S:1351
#1 0xb6c476ba in CTR_DRBG_generate (drbg=0x436570, out=,
out_len=, additional_data=0xbeffd67c
"\321,(L\262[\270\344\242\353Zp<\234\372\266\200U:\354\314\237\220r\033\252\002[P\vUban\216\024.J\020\305#g\r\345w\243q-Z\305\201\b~\245U\324\005^\310j\223\221H\370t\356\301\352\323ze\267\063\211\006\332\004\017\320\217w",
additional_data_len=32) at src/crypto/fipsmodule/rand/ctrdrbg.c:169
#2 0xb6c47832 in RAND_bytes_with_additional_data (out=0x4364e8 "",
out_len=out_len@entry=128,
user_additional_data=user_additional_data@entry=0xb6c80dc8
"") at src/crypto/fipsmodule/rand/rand.c:330
#3 0xb6c479f6 in RAND_bytes_with_additional_data
(user_additional_data=0xb6c80dc8 "", out_len=128,
out=0x4364e8 "") at src/crypto/fipsmodule/bn/random.c:143
#4 bn_rand_with_additional_data (rnd=0x436460, bits=1024, top=0, bottom=1,
additional_data=0xb6c80dc8 "") at
src/crypto/fipsmodule/bn/random.c:162
#5 0xb6c47a8e in BN_rand (rnd=rnd@entry=0x436460, bits=bits@entry=1024,
top=top@entry=0, bottom=bottom@entry=1) at src/crypto/fipsmodule/bn/random.c:199
#6 0xb6c4be42 in generate_prime (out=0x436460, bits=bits@entry=1024,
e=0x436448, p=p@entry=0x0, ctx=ctx@entry=0x436a18, cb=cb@entry=0x0) at
src/crypto/fipsmodule/rsa/rsa_impl.c:837
#7 0xb6c4c132 in RSA_generate_key_ex (rsa=0x4361a8, bits=2048,
e_value=, cb=0x0) at src/crypto/fipsmodule/rsa/rsa_impl.c:964
#8 0xb6f947ac in ?? () from
/usr/lib/arm-linux-gnueabihf/android/libadb.so.0
#9 0xb6f95d80 in adb_auth_init() () from
/usr/lib/arm-linux-gnueabihf/android/libadb.so.0
#10 0x00408608 in adb_server_main (is_daemon=is_daemon@entry=1,
socket_spec="tcp:5037", ack_reply_fd=ack_reply_fd@entry=4) at
adb/client/main.cpp:130
#11 0x0040bd10 in adb_commandline (argc=, argv=0xbefffdd0)
at /usr/include/c++/8/bits/basic_string.h:252
#12 0xb6cc2524 in __libc_start_main (main=0x404e11 ,
argc=7, argv=0xbefffdb4, init=, fini=0x41812d <__libc_csu_fini>,
rtld_fini=0xb6fe16c5 <_dl_fini>, stack_end=0xbefffdb4) at libc-start.c:308
#13 0x00404e80 in _start () at adb/client/main.cpp:186
The causing instruction seems to be following (complete debug session attached):
(gdb)
1034vldmia r6, {q14} @ .LM0
1: x/i $pc
=> 0xb6c6f278 <_bsaes_key_convert+40>: vldmia r6, {d28-d29}
(gdb) info reg
...
r6 0xb6c6eba1 3066489761
...
(gdb) stepi
Thread 1 "adb" received signal SIGBUS, Bus error.
_bsaes_key_convert () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1037
1037vrev32.8q7, q7
1: x/i $pc
=> 0xb6c6f27c <_bsaes_key_convert+44>: vrev32.8q7, q7
(gdb)
Upstream appears to have an patch integrated that touches _bsaes_key_convert:
[1] [2]
A package android-libboringssl build with that patch applied could successfuly
create the keys and did no crash on "adb devices" (just tested without a device
connected).
Kind regards,
Bernhard
[1]
https://android.googlesource.com/platform/external/boringssl/+/ab8b888152733533e60c1ebbe8438594a3a2e3d7%5E%21/linux-arm/crypto/fipsmodule/bsaes-armv7.S
[2]
https://boringssl.googlesource.com/boringssl/+/672f6fc2486745d0cabc3aaeb4e0a3cd13b37b12%5E%21/crypto/fipsmodule/aes/asm/bsaes-armv7.pl
# Buster/stable armhf Raspberry Pi 3, 2019-08-06
apt update
apt dist-ugprade
apt install systemd-coredump gdb fakeroot adb adb-dbgsym
android-libboringssl-dbgsym
apt build-dep android-libboringssl
The following NEW packages will be installed:
adb android-libadb android-libbase android-libboringssl android-libcrypto-utils
android-libcutils android-liblog android-sdk-platform-tools-common libatomic1
libusb-1.0-0 gdb libbabeltrace1 libc6-dbg libglib2.0-0 libglib2.0-data libicu63
libp