Skip to content

Instantly share code, notes, and snippets.

@stefanor
Last active May 24, 2020 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanor/908628f457a44063797df3b84a6bc1d0 to your computer and use it in GitHub Desktop.
Save stefanor/908628f457a44063797df3b84a6bc1d0 to your computer and use it in GitHub Desktop.
disas of cyrus-imapd's crc32_slice8
Program terminated with signal SIGBUS, Bus error.
#0 crc32_slice8 (prev=1389039116, data=0xf4bce9f5, length=21) at lib/crc32.c:646
646 uint32_t one = *current++ ^ crc;
(gdb) bt
#0 crc32_slice8 (prev=1389039116, data=0xf4bce9f5, length=21) at lib/crc32.c:646
#1 0xf7938124 in crc32 (prev=2905928179, data=0xf4bce9f5, length=21) at lib/crc32.c:756
#2 0xf79381a2 in crc32_iovec (iov=0xffae1bbc, iovcnt=3) at lib/crc32.c:771
#3 0xf792511c in write_record (db=0x21df798, record=0xffae1c28, key=0x220c1c8 "aden.ado.ahabfirm",
val=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>) at lib/cyrusdb_twoskip.c:800
#4 0xf792523e in append_record (db=0x21df798, record=0xffae1c28, key=0x220c1c8 "aden.ado.ahabfirm",
val=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>) at lib/cyrusdb_twoskip.c:843
#5 0xf792593a in store_here (db=0x21df798, val=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>, vallen=21)
at lib/cyrusdb_twoskip.c:1167
#6 0xf792663e in skipwrite (db=0x21df798, key=0x22206b8 "aden.ado.ahabdlorddnfigbqgWJB", keylen=13,
data=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>, datalen=21, force=0) at lib/cyrusdb_twoskip.c:1727
#7 0xf792697c in mystore (db=0x21df798, key=0x22206b8 "aden.ado.ahabdlorddnfigbqgWJB", keylen=13,
data=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>, datalen=21, tidptr=0xffae1e10, force=0)
at lib/cyrusdb_twoskip.c:1852
#8 0xf79269fe in copy_cb (rock=0xffae1e0c, key=0x22206b8 "aden.ado.ahabdlorddnfigbqgWJB", keylen=13,
val=0xf4bce9f5 <error: Cannot access memory at address 0xf4bce9f5>, vallen=21) at lib/cyrusdb_twoskip.c:1880
#9 0xf7926480 in myforeach (db=0x21df588, prefix=0x0, prefixlen=0, goodp=0x0, cb=0xf79269d1 <copy_cb>, rock=0xffae1e0c,
tidptr=0x21df784) at lib/cyrusdb_twoskip.c:1644
#10 0xf7926af6 in mycheckpoint (db=0x21df588) at lib/cyrusdb_twoskip.c:1908
#11 0xf79267c6 in mycommit (db=0x21df588, tid=0x2219c08) at lib/cyrusdb_twoskip.c:1786
#12 0xf791bc90 in cyrusdb_commit (db=0x2224be0, tid=0x2219c08) at lib/cyrusdb.c:345
#13 0x00c150ae in test_many () at ./cunit/aaa-db.testc:1542
#14 0x00bed6ac in __cunit_wrap_test (name=0xd5b480 "/tmp/cyrus-imapd/cunit/aaa-db.testc:test_many", fn=0xc14e7d <test_many>)
at cunit/unit.c:153
#15 0x00c18cd8 in __cunit_test_many () at cunit/aaa-db.testc-cunit.c:169
#16 0xf76a2da2 in ?? () from /usr/lib/arm-linux-gnueabihf/libcunit.so.1
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Dump of assembler code for function crc32_slice8:
0xf7937b2c <+0>: cmp r2, #7
0xf7937b2e <+2>: mvn.w r0, r0
0xf7937b32 <+6>: stmdb sp!, {r4, r5, r6, r7, r8, r9, r10, lr}
0xf7937b36 <+10>: bls.n 0xf7937be0 <crc32_slice8+180>
0xf7937b38 <+12>: sub.w r7, r2, #8
0xf7937b3c <+16>: ldr r4, [pc, #308] ; (0xf7937c74 <crc32_slice8+328>)
0xf7937b3e <+18>: bic.w r3, r7, #7
0xf7937b42 <+22>: add.w r6, r1, #16
0xf7937b46 <+26>: add r4, pc
0xf7937b48 <+28>: lsrs r7, r7, #3
0xf7937b4a <+30>: add r6, r3
0xf7937b4c <+32>: add.w r5, r1, #8
=> 0xf7937b50 <+36>: ldrd r9, r3, [r5, #-8]
0xf7937b54 <+40>: adds r5, #8
0xf7937b56 <+42>: cmp r5, r6
0xf7937b58 <+44>: ubfx r8, r3, #8, #8
0xf7937b5c <+48>: ubfx lr, r3, #16, #8
0xf7937b60 <+52>: uxtb.w r10, r3
0xf7937b64 <+56>: mov.w r12, r3, lsr #24
0xf7937b68 <+60>: add.w r10, r10, #768 ; 0x300
0xf7937b6c <+64>: eor.w r3, r0, r9
0xf7937b70 <+68>: add.w lr, lr, #256 ; 0x100
0xf7937b74 <+72>: ldr.w r9, [r4, r12, lsl #2]
0xf7937b78 <+76>: ldr.w r0, [r4, r10, lsl #2]
0xf7937b7c <+80>: add.w r12, r8, #512 ; 0x200
0xf7937b80 <+84>: mov.w r8, r3, lsr #24
0xf7937b84 <+88>: ldr.w r10, [r4, lr, lsl #2]
0xf7937b88 <+92>: add.w r8, r8, #1024 ; 0x400
0xf7937b8c <+96>: uxtb.w lr, r3
0xf7937b90 <+100>: eor.w r0, r9, r0
0xf7937b94 <+104>: add.w lr, lr, #1792 ; 0x700
0xf7937b98 <+108>: ldr.w r9, [r4, r12, lsl #2]
0xf7937b9c <+112>: ubfx r12, r3, #16, #8
0xf7937ba0 <+116>: ldr.w r8, [r4, r8, lsl #2]
0xf7937ba4 <+120>: eor.w r0, r0, r10
0xf7937ba8 <+124>: add.w r12, r12, #1280 ; 0x500
0xf7937bac <+128>: ubfx r3, r3, #8, #8
0xf7937bb0 <+132>: ldr.w lr, [r4, lr, lsl #2]
0xf7937bb4 <+136>: eor.w r0, r0, r9
0xf7937bb8 <+140>: add.w r3, r3, #1536 ; 0x600
0xf7937bbc <+144>: ldr.w r12, [r4, r12, lsl #2]
0xf7937bc0 <+148>: eor.w r0, r0, r8
0xf7937bc4 <+152>: ldr.w r3, [r4, r3, lsl #2]
0xf7937bc8 <+156>: eor.w r0, r0, lr
0xf7937bcc <+160>: eor.w r0, r0, r12
0xf7937bd0 <+164>: eor.w r0, r0, r3
0xf7937bd4 <+168>: bne.n 0xf7937b50 <crc32_slice8+36>
0xf7937bd6 <+170>: adds r7, #1
0xf7937bd8 <+172>: and.w r2, r2, #7
0xf7937bdc <+176>: add.w r1, r1, r7, lsl #3
0xf7937be0 <+180>: cmp r2, #0
0xf7937be2 <+182>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937be4 <+184>: ldrb r4, [r1, #0]
0xf7937be6 <+186>: uxtb r5, r0
0xf7937be8 <+188>: ldr r3, [pc, #140] ; (0xf7937c78 <crc32_slice8+332>)
0xf7937bea <+190>: cmp r2, #1
0xf7937bec <+192>: eor.w r4, r4, r5
0xf7937bf0 <+196>: add r3, pc
0xf7937bf2 <+198>: ldr.w r4, [r3, r4, lsl #2]
0xf7937bf6 <+202>: eor.w r0, r4, r0, lsr #8
0xf7937bfa <+206>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937bfc <+208>: ldrb r4, [r1, #1]
0xf7937bfe <+210>: uxtb r5, r0
0xf7937c00 <+212>: cmp r2, #2
0xf7937c02 <+214>: eor.w r4, r4, r5
0xf7937c06 <+218>: ldr.w r4, [r3, r4, lsl #2]
0xf7937c0a <+222>: eor.w r0, r4, r0, lsr #8
0xf7937c0e <+226>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937c10 <+228>: ldrb r4, [r1, #2]
0xf7937c12 <+230>: uxtb r5, r0
0xf7937c14 <+232>: cmp r2, #3
0xf7937c16 <+234>: eor.w r4, r4, r5
0xf7937c1a <+238>: ldr.w r4, [r3, r4, lsl #2]
0xf7937c1e <+242>: eor.w r0, r4, r0, lsr #8
0xf7937c22 <+246>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937c24 <+248>: ldrb r4, [r1, #3]
0xf7937c26 <+250>: uxtb r5, r0
0xf7937c28 <+252>: cmp r2, #4
0xf7937c2a <+254>: eor.w r4, r4, r5
0xf7937c2e <+258>: ldr.w r4, [r3, r4, lsl #2]
0xf7937c32 <+262>: eor.w r0, r4, r0, lsr #8
0xf7937c36 <+266>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937c38 <+268>: ldrb r4, [r1, #4]
0xf7937c3a <+270>: uxtb r5, r0
0xf7937c3c <+272>: cmp r2, #5
0xf7937c3e <+274>: eor.w r4, r4, r5
0xf7937c42 <+278>: ldr.w r4, [r3, r4, lsl #2]
0xf7937c46 <+282>: eor.w r0, r4, r0, lsr #8
0xf7937c4a <+286>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937c4c <+288>: ldrb r4, [r1, #5]
0xf7937c4e <+290>: uxtb r5, r0
0xf7937c50 <+292>: cmp r2, #6
0xf7937c52 <+294>: eor.w r4, r4, r5
0xf7937c56 <+298>: ldr.w r4, [r3, r4, lsl #2]
0xf7937c5a <+302>: eor.w r0, r4, r0, lsr #8
0xf7937c5e <+306>: beq.n 0xf7937c6e <crc32_slice8+322>
0xf7937c60 <+308>: ldrb r1, [r1, #6]
0xf7937c62 <+310>: uxtb r2, r0
0xf7937c64 <+312>: eors r2, r1
0xf7937c66 <+314>: ldr.w r3, [r3, r2, lsl #2]
0xf7937c6a <+318>: eor.w r0, r3, r0, lsr #8
0xf7937c6e <+322>: mvns r0, r0
0xf7937c70 <+324>: ldmia.w sp!, {r4, r5, r6, r7, r8, r9, r10, pc}
0xf7937c74 <+328>: andeq r10, r3, lr, lsr r5
0xf7937c78 <+332>: muleq r3, r4, r4
End of assembler dump.
(gdb) info registers
r0 0x52cb0e0c 1389039116
r1 0xf4bce9f5 4106021365
r2 0x15 21
r3 0x8 8
r4 0xf7972088 4153876616
r5 0xf4bce9fd 4106021373
r6 0xf4bcea0d 4106021389
r7 0x1 1
r8 0xf76ba150 4151026000
r9 0x0 0
r10 0x0 0
r11 0x0 0
r12 0xbcfd3525 3170710821
sp 0xffae1b50 0xffae1b50
lr 0xf7938125 -141328091
pc 0xf7937b50 0xf7937b50 <crc32_slice8+36>
cpsr 0x20030030 537067568
fpscr 0x20000010 536870928
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment