[Android-tools-devel] Bug#933865: adb crashes on startup with SIGBUS

Bernhard Übelacker bernhardu at mailbox.org
Tue Aug 6 16:22:49 BST 2019


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 [<b6c59278>]
    [  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=<optimized out>, out_len=<optimized out>, 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 at entry=128, user_additional_data=user_additional_data at entry=0xb6c80dc8 <kDefaultAdditionalData> "") at src/crypto/fipsmodule/rand/rand.c:330
    #3  0xb6c479f6 in RAND_bytes_with_additional_data (user_additional_data=0xb6c80dc8 <kDefaultAdditionalData> "", 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 <kDefaultAdditionalData> "") at src/crypto/fipsmodule/bn/random.c:162
    #5  0xb6c47a8e in BN_rand (rnd=rnd at entry=0x436460, bits=bits at entry=1024, top=top at entry=0, bottom=bottom at entry=1) at src/crypto/fipsmodule/bn/random.c:199
    #6  0xb6c4be42 in generate_prime (out=0x436460, bits=bits at entry=1024, e=0x436448, p=p at entry=0x0, ctx=ctx at entry=0x436a18, cb=cb at entry=0x0) at src/crypto/fipsmodule/rsa/rsa_impl.c:837
    #7  0xb6c4c132 in RSA_generate_key_ex (rsa=0x4361a8, bits=2048, e_value=<optimized out>, 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 at entry=1, socket_spec="tcp:5037", ack_reply_fd=ack_reply_fd at entry=4) at adb/client/main.cpp:130
    #11 0x0040bd10 in adb_commandline (argc=<optimized out>, argv=0xbefffdd0) at /usr/include/c++/8/bits/basic_string.h:252
    #12 0xb6cc2524 in __libc_start_main (main=0x404e11 <main(int, char**)>, argc=7, argv=0xbefffdb4, init=<optimized out>, 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) 
    1034            vldmia  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
    1037            vrev32.8        q7,  q7
    1: x/i $pc
    => 0xb6c6f27c <_bsaes_key_convert+44>:  vrev32.8        q7, 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
-------------- next part --------------



# 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 libpython3.7 libxml2 shared-mime-info xdg-user-dirs adb-dbgsym android-libboringssl-dbgsym autoconf automake autopoint autotools-dev binutils binutils-arm-linux-gnueabihf binutils-common build-essential cpp cpp-8 debhelper dh-autoreconf dh-exec dh-strip-nondeterminism dpkg-dev dwz g++ g++-8 gcc gcc-8 gettext gettext-base groff-base intltool-debian libarchive-zip-perl libasan5 libbinutils libc-dev-bin libc6-dev libcc1-0 libcroco3 libdpkg-perl libfile-stripnondeterminism-perl libgcc-8-dev libgdbm-compat4 libgdbm6 libgomp1 libisl19 libmpc3 libmpfr6 libperl5.28 libpipeline1 libsigsegv2 libstdc++-8-dev libtool libubsan1 libuchardet0 linux-libc-dev m4 make man-db patch perl perl-modules-5.28 po-debconf fakeroot 




mkdir /home/benutzer/source/android-libboringssl/orig -p
cd    /home/benutzer/source/android-libboringssl/orig
apt source android-libboringssl
cd




############





root at raspi3-armhf:~# adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /tmp/adb.0.log
Server had pid: 635
--- adb starting (pid 635) ---
adb I 08-06 11:48:30   635   635 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 08-06 11:48:30   635   635 main.cpp:57] Version 1:8.1.0+r23-5
adb I 08-06 11:48:30   635   635 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 08-06 11:48:30   635   635 main.cpp:57] 
adb I 08-06 11:48:30   635   635 adb_auth_host.cpp:416] adb_auth_init...
adb I 08-06 11:48:30   635   635 adb_auth_host.cpp:262] User key '/root/.android/adbkey' does not exist...
adb I 08-06 11:48:30   635   635 adb_auth_host.cpp:109] generate_key(/root/.android/adbkey)...

* failed to start daemon
error: cannot connect to daemon







root at raspi3-armhf:~# dmesg
[  339.344841] Alignment trap: not handling instruction ecd6cb04 at [<b6c59278>]
[  339.345111] Unhandled fault: alignment exception (0x001) at 0xb6c58ba1
[  339.345328] pgd = 72cfb493
[  339.345426] [b6c58ba1] *pgd=33fe8835







root at raspi3-armhf:~# journalctl --no-pager
Aug 06 11:48:30 raspi3-armhf kernel: Alignment trap: not handling instruction ecd6cb04 at [<b6c59278>]
Aug 06 11:48:30 raspi3-armhf kernel: Unhandled fault: alignment exception (0x001) at 0xb6c58ba1
Aug 06 11:48:30 raspi3-armhf kernel: pgd = 72cfb493
Aug 06 11:48:30 raspi3-armhf kernel: [b6c58ba1] *pgd=33fe8835
Aug 06 11:48:30 raspi3-armhf systemd[1]: Created slice system-systemd\x2dcoredump.slice.
Aug 06 11:48:30 raspi3-armhf systemd[1]: Started Process Core Dump (PID 638/UID 0).
Aug 06 11:48:30 raspi3-armhf systemd-coredump[639]: Process 635 (adb) of user 0 dumped core.
                                                    
                                                    Stack trace of thread 635:
                                                    #0  0x00000000b6c5927c n/a (libcrypto.so.0)
Aug 06 11:48:30 raspi3-armhf systemd[1]: systemd-coredump at 0-638-0.service: Succeeded.








root at raspi3-armhf:~# coredumpctl list
TIME                            PID   UID   GID SIG COREFILE  EXE
Tue 2019-08-06 11:48:30 UTC     635     0     0   7 present   /usr/lib/android-sdk/platform-tools/adb




root at raspi3-armhf:~# coredumpctl gdb 635
           PID: 635 (adb)
           UID: 0 (root)
           GID: 0 (root)
        Signal: 7 (BUS)
     Timestamp: Tue 2019-08-06 11:48:30 UTC (8min ago)
  Command Line: adb -L tcp:5037 fork-server server --reply-fd 4
    Executable: /usr/lib/android-sdk/platform-tools/adb
 Control Group: /user.slice/user-1000.slice/session-1.scope
          Unit: session-1.scope
         Slice: user-1000.slice
       Session: 1
     Owner UID: 1000 (benutzer)
       Boot ID: 077d6116498b47b4b651016f58fca742
    Machine ID: a032f7e2cc6d46aeb3121af91c290808
      Hostname: raspi3-armhf
       Storage: /var/lib/systemd/coredump/core.adb.0.077d6116498b47b4b651016f58fca742.635.1565092110000000.lz4
       Message: Process 635 (adb) of user 0 dumped core.
                
                Stack trace of thread 635:
                #0  0x00000000b6c5927c n/a (libcrypto.so.0)

GNU gdb (Debian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/android-sdk/platform-tools/adb...(no debugging symbols found)...done.
[New LWP 635]
[New LWP 637]
[New LWP 636]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `adb -L tcp:5037 fork-server server --reply-fd 4'.
Program terminated with signal SIGBUS, Bus error.
#0  0xb6c5927c in ?? () from /usr/lib/arm-linux-gnueabihf/android/libcrypto.so.0
[Current thread is 1 (Thread 0xb6fde4d0 (LWP 635))]
(gdb) set width 0
(gdb) set pagination off
(gdb) bt
#0  0xb6c5927c in ?? () from /usr/lib/arm-linux-gnueabihf/android/libcrypto.so.0
#1  0xb6c5960e in ?? () from /usr/lib/arm-linux-gnueabihf/android/libcrypto.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)


Core was generated by `adb -L tcp:5037 fork-server server --reply-fd 4'.
Program terminated with signal SIGBUS, Bus error.
#0  _bsaes_key_convert () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1037
1037    linux-arm/crypto/fipsmodule/bsaes-armv7.S: No such file or directory.
[Current thread is 1 (Thread 0xb6fde4d0 (LWP 635))]
(gdb) set width 0
(gdb) set pagination off
(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?)











root at raspi3-armhf:~# gdb -q --args adb -L tcp:5037 fork-server server --reply-fd 4
Reading symbols from adb...Reading symbols from /usr/lib/debug/.build-id/4f/8b8b5131b4bfbfc8beb31092b44e810860e7da.debug...done.
done.
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/source/android-libboringssl/orig/android-platform-external-boringssl-8.1.0+r23
Source directories searched: /home/benutzer/source/android-libboringssl/orig/android-platform-external-boringssl-8.1.0+r23:$cdir:$cwd
(gdb) b bsaes_ctr32_encrypt_blocks
Function "bsaes_ctr32_encrypt_blocks" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (bsaes_ctr32_encrypt_blocks) pending.
(gdb) run
Starting program: /usr/bin/adb -L tcp:5037 fork-server server --reply-fd 4
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb6b31440 (LWP 11710)]
[New Thread 0xb6330440 (LWP 11711)]

Thread 1 "adb" hit Breakpoint 1, bsaes_ctr32_encrypt_blocks () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1351
1351            cmp     r2, #8                  @ use plain AES for
(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=<optimized out>, out_len=<optimized out>, 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 at entry=128, user_additional_data=user_additional_data at entry=0xb6c80dc8 <kDefaultAdditionalData> "") at src/crypto/fipsmodule/rand/rand.c:330
#3  0xb6c479f6 in RAND_bytes_with_additional_data (user_additional_data=0xb6c80dc8 <kDefaultAdditionalData> "", 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 <kDefaultAdditionalData> "") at src/crypto/fipsmodule/bn/random.c:162
#5  0xb6c47a8e in BN_rand (rnd=rnd at entry=0x436460, bits=bits at entry=1024, top=top at entry=0, bottom=bottom at entry=1) at src/crypto/fipsmodule/bn/random.c:199
#6  0xb6c4be42 in generate_prime (out=0x436460, bits=bits at entry=1024, e=0x436448, p=p at entry=0x0, ctx=ctx at entry=0x436a18, cb=cb at entry=0x0) at src/crypto/fipsmodule/rsa/rsa_impl.c:837
#7  0xb6c4c132 in RSA_generate_key_ex (rsa=0x4361a8, bits=2048, e_value=<optimized out>, 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 at entry=1, socket_spec="tcp:5037", ack_reply_fd=ack_reply_fd at entry=4) at adb/client/main.cpp:130
#11 0x0040bd10 in adb_commandline (argc=<optimized out>, argv=0xbefffdd0) at /usr/include/c++/8/bits/basic_string.h:252
#12 0xb6cc2524 in __libc_start_main (main=0x404e11 <main(int, char**)>, argc=7, argv=0xbefffdb4, init=<optimized out>, 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
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) b _bsaes_key_convert
Breakpoint 2 at 0xb6c6f250: file linux-arm/crypto/fipsmodule/bsaes-armv7.S, line 1019.
(gdb) display/i $pc
1: x/i $pc
=> 0xb6c6f5e0 <bsaes_ctr32_encrypt_blocks>:     cmp     r2, #8
(gdb) nexti
1352            blo     .Lctr_enc_short                 @ small sizes
1: x/i $pc
=> 0xb6c6f5e2 <bsaes_ctr32_encrypt_blocks+2>:   bcc.w   0xb6c6f780 <bsaes_ctr32_encrypt_blocks+416>
(gdb) 
1354            mov     ip, sp
1: x/i $pc
=> 0xb6c6f5e6 <bsaes_ctr32_encrypt_blocks+6>:   mov     r12, sp
(gdb) 
1355            stmdb   sp!, {r4,r5,r6,r7,r8,r9,r10, lr}
1: x/i $pc
=> 0xb6c6f5e8 <bsaes_ctr32_encrypt_blocks+8>:   stmdb   sp!, {r4, r5, r6, r7, r8, r9, r10, lr}
(gdb) 
bsaes_ctr32_encrypt_blocks () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1356
1356            VFP_ABI_PUSH
1: x/i $pc
=> 0xb6c6f5ec <bsaes_ctr32_encrypt_blocks+12>:  vpush   {d8-d15}
(gdb) 
bsaes_ctr32_encrypt_blocks () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1357
1357            ldr     r8, [ip]                        @ ctr is 1st arg on the stack
1: x/i $pc
=> 0xb6c6f5f0 <bsaes_ctr32_encrypt_blocks+16>:  ldr.w   r8, [r12]
(gdb) 
1358            sub     sp, sp, #0x10                   @ scratch space to carry over the ctr
1: x/i $pc
=> 0xb6c6f5f4 <bsaes_ctr32_encrypt_blocks+20>:  sub     sp, #16
(gdb) 
bsaes_ctr32_encrypt_blocks () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1359
1359            mov     r9, sp                          @ save sp
1: x/i $pc
=> 0xb6c6f5f6 <bsaes_ctr32_encrypt_blocks+22>:  mov     r9, sp
(gdb) 
1361            ldr     r10, [r3, #240]         @ get # of rounds
1: x/i $pc
=> 0xb6c6f5f8 <bsaes_ctr32_encrypt_blocks+24>:  ldr.w   r10, [r3, #240] ; 0xf0
(gdb) 
1364            sub     r12, sp, r10, lsl#7             @ 128 bytes per inner round key
1: x/i $pc
=> 0xb6c6f5fc <bsaes_ctr32_encrypt_blocks+28>:  sub.w   r12, sp, r10, lsl #7
(gdb) 
1365            add     r12, #96                        @ size of bit-sliced key schedule
1: x/i $pc
=> 0xb6c6f600 <bsaes_ctr32_encrypt_blocks+32>:  add.w   r12, r12, #96   ; 0x60
(gdb) 
1368            mov     r4, r3                  @ pass key
1: x/i $pc
=> 0xb6c6f604 <bsaes_ctr32_encrypt_blocks+36>:  mov     r4, r3
(gdb) 
1369            mov     r5, r10                 @ pass # of rounds
1: x/i $pc
=> 0xb6c6f606 <bsaes_ctr32_encrypt_blocks+38>:  mov     r5, r10
(gdb) 
1370            mov     sp, r12                         @ sp is sp
1: x/i $pc
=> 0xb6c6f608 <bsaes_ctr32_encrypt_blocks+40>:  mov     sp, r12
(gdb) 
bsaes_ctr32_encrypt_blocks () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1371
1371            bl      _bsaes_key_convert
1: x/i $pc
=> 0xb6c6f60a <bsaes_ctr32_encrypt_blocks+42>:  bl      0xb6c6f250 <_bsaes_key_convert>
(gdb) stepi

Thread 1 "adb" hit Breakpoint 2, _bsaes_key_convert () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1019
1019            adr     r6,_bsaes_key_convert
1: x/i $pc
=> 0xb6c6f250 <_bsaes_key_convert>:     subw    r6, pc, #3
(gdb) nexti
1020            vld1.8  {q7},  [r4]!            @ load round 0 key
1: x/i $pc
=> 0xb6c6f254 <_bsaes_key_convert+4>:   vld1.8  {d14-d15}, [r4]!
(gdb) 
1024            sub     r6,r6,#_bsaes_key_convert-.LM0
1: x/i $pc
=> 0xb6c6f258 <_bsaes_key_convert+8>:   sub.w   r6, r6, #1712   ; 0x6b0
(gdb) 
1026            vld1.8  {q15}, [r4]!            @ load round 1 key
1: x/i $pc
=> 0xb6c6f25c <_bsaes_key_convert+12>:  vld1.8  {d30-d31}, [r4]!
(gdb) 
1028            vmov.i8 q8,  #0x01                      @ bit masks
1: x/i $pc
=> 0xb6c6f260 <_bsaes_key_convert+16>:  vmov.i8 q8, #1  ; 0x01
(gdb) 
1029            vmov.i8 q9,  #0x02
1: x/i $pc
=> 0xb6c6f264 <_bsaes_key_convert+20>:  vmov.i8 q9, #2  ; 0x02
(gdb) 
1030            vmov.i8 q10, #0x04
1: x/i $pc
=> 0xb6c6f268 <_bsaes_key_convert+24>:  vmov.i8 q10, #4 ; 0x04
(gdb) 
1031            vmov.i8 q11, #0x08
1: x/i $pc
=> 0xb6c6f26c <_bsaes_key_convert+28>:  vmov.i8 q11, #8 ; 0x08
(gdb) 
1032            vmov.i8 q12, #0x10
1: x/i $pc
=> 0xb6c6f270 <_bsaes_key_convert+32>:  vmov.i8 q12, #16        ; 0x10
(gdb) 
1033            vmov.i8 q13, #0x20
1: x/i $pc
=> 0xb6c6f274 <_bsaes_key_convert+36>:  vmov.i8 q13, #32        ; 0x20
(gdb) 
1034            vldmia  r6, {q14}               @ .LM0
1: x/i $pc
=> 0xb6c6f278 <_bsaes_key_convert+40>:  vldmia  r6, {d28-d29}
(gdb) info reg
r0             0x4364e8            4416744
r1             0x4364e8            4416744
r2             0x8                 8
r3             0x436570            4416880
r4             0x436590            4416912
r5             0xe                 14
r6             0xb6c6eba1          3066489761
r7             0xb6c6f5e1          3066492385
r8             0x43666c            4417132
r9             0xbeffd478          3204437112
r10            0xe                 14
r11            0xbeffd67c          3204437628
r12            0xbeffcdd8          3204435416
sp             0xbeffcdd8          0xbeffcdd8
lr             0xb6c6f60f          -1228474865
pc             0xb6c6f278          0xb6c6f278 <_bsaes_key_convert+40>
cpsr           0x600d0030          1611464752
fpscr          0x60000000          1610612736
(gdb) stepi

Thread 1 "adb" received signal SIGBUS, Bus error.
_bsaes_key_convert () at linux-arm/crypto/fipsmodule/bsaes-armv7.S:1037
1037            vrev32.8        q7,  q7
1: x/i $pc
=> 0xb6c6f27c <_bsaes_key_convert+44>:  vrev32.8        q7, q7
(gdb) 
Unable to fetch general registers.: No such process.
Unable to fetch general registers.: No such process.
(gdb) [Thread 0xb6330440 (LWP 11711) exited]
[Thread 0xb6b31440 (LWP 11710) exited]

Program terminated with signal SIGBUS, Bus error.
The program no longer exists.






(gdb) list bsaes-armv7.S:1014,1040
1014            bx      lr
1015    .size   _bsaes_encrypt8,.-_bsaes_encrypt8
1016    .type   _bsaes_key_convert,%function
1017    .align  4
1018    _bsaes_key_convert:
1019            adr     r6,_bsaes_key_convert
1020            vld1.8  {q7},  [r4]!            @ load round 0 key
1021    #ifdef  __APPLE__
1022            adr     r6,.LM0
1023    #else
1024            sub     r6,r6,#_bsaes_key_convert-.LM0
1025    #endif
1026            vld1.8  {q15}, [r4]!            @ load round 1 key
1027
1028            vmov.i8 q8,  #0x01                      @ bit masks
1029            vmov.i8 q9,  #0x02
1030            vmov.i8 q10, #0x04
1031            vmov.i8 q11, #0x08
1032            vmov.i8 q12, #0x10
1033            vmov.i8 q13, #0x20
1034            vldmia  r6, {q14}               @ .LM0
1035
1036    #ifdef __ARMEL__
1037            vrev32.8        q7,  q7
1038            vrev32.8        q15, q15
1039    #endif
1040            sub     r5,r5,#1




(gdb) list bsaes-armv7.S:1345,1375
1345
1346    .globl  bsaes_ctr32_encrypt_blocks
1347    .hidden bsaes_ctr32_encrypt_blocks
1348    .type   bsaes_ctr32_encrypt_blocks,%function
1349    .align  5
1350    bsaes_ctr32_encrypt_blocks:
1351            cmp     r2, #8                  @ use plain AES for
1352            blo     .Lctr_enc_short                 @ small sizes
1353
1354            mov     ip, sp
1355            stmdb   sp!, {r4,r5,r6,r7,r8,r9,r10, lr}
1356            VFP_ABI_PUSH
1357            ldr     r8, [ip]                        @ ctr is 1st arg on the stack
1358            sub     sp, sp, #0x10                   @ scratch space to carry over the ctr
1359            mov     r9, sp                          @ save sp
1360
1361            ldr     r10, [r3, #240]         @ get # of rounds
1362    #ifndef BSAES_ASM_EXTENDED_KEY
1363            @ allocate the key schedule on the stack
1364            sub     r12, sp, r10, lsl#7             @ 128 bytes per inner round key
1365            add     r12, #96                        @ size of bit-sliced key schedule
1366
1367            @ populate the key schedule
1368            mov     r4, r3                  @ pass key
1369            mov     r5, r10                 @ pass # of rounds
1370            mov     sp, r12                         @ sp is sp
1371            bl      _bsaes_key_convert
1372            veor    q7,q7,q15       @ fix up last round key
1373            vstmia  r12, {q7}                       @ save last round key
1374
1375            vld1.8  {q0}, [r8]              @ load counter




set width 0
set pagination off
directory /home/benutzer/source/android-libboringssl/orig/android-platform-external-boringssl-8.1.0+r23
b bsaes_ctr32_encrypt_blocks
y
run
bt
b _bsaes_key_convert
display/i $pc








root at raspi3-armhf:~# cat /proc/cpu/alignment
User:           6
System:         0 (  (null))
Skipped:        6
Half:           0
Word:           0
DWord:          0
Multi:          0
User faults:    2 (fixup)
root at raspi3-armhf:~# echo 2 > /proc/cpu/alignment
root at raspi3-armhf:~# cat /proc/cpu/alignment
User:           6
System:         0 (  (null))
Skipped:        6
Half:           0
Word:           0
DWord:          0
Multi:          0
User faults:    2 (fixup)

-> nothing changed at armhf ... seems just for armel




http://infocenter.arm.com/help/topic/com.arm.doc.dui0646a/CHDCAEDE.html
Floating-point Load Multiple.





https://android.googlesource.com/platform/external/boringssl/+/ab8b888152733533e60c1ebbe8438594a3a2e3d7%5E%21/linux-arm/crypto/fipsmodule/bsaes-armv7.S
https://boringssl.googlesource.com/boringssl/+/672f6fc2486745d0cabc3aaeb4e0a3cd13b37b12%5E%21/crypto/fipsmodule/aes/asm/bsaes-armv7.pl


More information about the Android-tools-devel mailing list