AArch64 assert aarch64/decode.c:189 false + "failed to encode" warnings calling instr_get_arith_flags() on a jump-to-instr
Running a drbbdup test on a64 for #4134 (closed) hits:
<Internal Error: Failed to encode instruction: 'b @0x0000fffdb402bfc0[8byte]'
>
<Internal Error: Failed to encode instruction: 'b @0x0000fffdb402bfc0[8byte]'
>
<Application /home/derek/dr/build/suite/tests/bin/simple_app (3256451). Internal Error: DynamoRIO debug check failure: /home/derek/dr/src/core/ir/aarch64/decode.c:189 false
A callstack for the "Failed to encode":
<Internal Error: Failed to encode instruction: 'b @0x0000fffdb402bfc0[8byte]'
>
<press enter to continue>
^C
Program received signal SIGINT, Interrupt.
dynamorio_syscall () at /home/derek/dr/src/core/drlibc/drlibc_aarch64.asm:66
66 #define FUNCNAME dr_fpu_exception_init
(gdb) bt
#0 dynamorio_syscall () at /home/derek/dr/src/core/drlibc/drlibc_aarch64.asm:66
#1 0x00000000713bef50 in read_syscall (fd=0, buf=0xfffdb4026c47, nbytes=1) at /home/derek/dr/src/core/drlibc/drlibc_unix.c:293
#2 0x00000000713bf0dc in os_read (f=0, buf=0xfffdb4026c47, count=1) at /home/derek/dr/src/core/drlibc/drlibc_unix.c:370
#3 0x00000000710c8fec in d_r_notify (priority=SYSLOG_ERROR, internal=true, synch=true, substitution_num=0, prefix=0x7142f280 "SYSLOG_ERROR",
fmt=0x7142f248 "Internal Error: Failed to encode instruction: '%s'\n") at /home/derek/dr/src/core/utils.c:1921
#4 0x0000000071231ac8 in instr_encode_arch (dcontext=0xfffdb4002080, instr=0xfffdb402be78,
copy_pc=0xffffb4064858 '\253' <repeats 64 times>, "\274\274\274\274\274\274\274\274", '\315' <repeats 127 times>, <incomplete sequence \315>..., final_pc=0xffffb4064858 '\253' <repeats 64 times>, "\274\274\274\274\274\274\274\274", '\315' <repeats 127 times>, <incomplete sequence \315>...,
check_reachable=true, has_instr_opnds=0xfffdb4027687, assert_reachable=false) at /home/derek/dr/src/core/ir/aarch64/encode.c:250
#5 0x0000000071231744 in instr_encode_check_reachability (dcontext=0xfffdb4002080, instr=0xfffdb402be78,
pc=0xffffb4064858 '\253' <repeats 64 times>, "\274\274\274\274\274\274\274\274", '\315' <repeats 127 times>, <incomplete sequence \315>...,
has_instr_opnds=0xfffdb4027687) at /home/derek/dr/src/core/ir/encode_shared.c:125
#6 0x00000000712211ac in private_instr_encode (dcontext=0xfffdb4002080, instr=0xfffdb402be78, always_cache=true)
at /home/derek/dr/src/core/ir/instr_shared.c:362
#7 0x000000007122271c in instr_get_eflags (instr=0xfffdb402be78, flags=DR_QUERY_INCLUDE_COND_SRCS)
at /home/derek/dr/src/core/ir/instr_shared.c:891
#8 0x00000000712228bc in instr_get_arith_flags (instr=0xfffdb402be78, flags=DR_QUERY_INCLUDE_COND_SRCS)
at /home/derek/dr/src/core/ir/instr_shared.c:932
#9 0x0000ffffb3fe9ca0 in drreg_event_bb_analysis (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000', user_data=0xffffb4064840) at /home/derek/dr/src/ext/drreg/drreg.c:405
#10 0x0000ffffb40097fc in drmgr_bb_event_do_instrum_phases (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000', pt=0xffffb3fc1460, local_info=0xfffdb4027948, pair_data=0xffffb4064838, quintet_data=0xffffb4064850)
at /home/derek/dr/src/ext/drmgr/drmgr.c:957
#11 0x0000ffffb400a428 in drmgr_bb_event (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000') at /home/derek/dr/src/ext/drmgr/drmgr.c:1195
#12 0x00000000711e0cd4 in instrument_basic_block (dcontext=0xfffdb4002080, tag=0xfffff7fccb40 "\377C\025\321\375{", bb=0xfffdb402bbe0,
for_trace=false, translating=false, emitflags=0xfffdb4028b24) at /home/derek/dr/src/core/lib/instrument.c:1680
#13 0x0000000071335808 in client_process_bb (dcontext=0xfffdb4002080, bb=0xfffdb4028dd0) at /home/derek/dr/src/core/arch/interp.c:2742
#14 0x000000007133a1fc in build_bb_ilist (dcontext=0xfffdb4002080, bb=0xfffdb4028dd0) at /home/derek/dr/src/core/arch/interp.c:4105
#15 0x000000007133e6ac in build_basic_block_fragment (dcontext=0xfffdb4002080, start=0xfffff7fccb40 "\377C\025\321\375{", initial_flags=0,
link=true, visible=true, for_trace=false, unmangled_ilist=0x0) at /home/derek/dr/src/core/arch/interp.c:5096
#16 0x00000000710aa9c4 in d_r_dispatch (dcontext=0xfffdb4002080) at /home/derek/dr/src/core/dispatch.c:210
Looks like aarch64 instr_encode_arch() isn't honoring assert_reachable=false: those are the warnings, I assume for instr operands w/o having note values yet.
The assert:
#5 0x00000000710c34e4 in d_r_internal_error (file=0x7142dec8 "/home/derek/dr/src/core/ir/aarch64/decode.c", line=189, expr=0x7142df40 "false")
at /home/derek/dr/src/core/utils.c:179
#6 0x0000000071231490 in opcode_to_encoding_info (opc=26, isa_mode=DR_ISA_ARM_A64) at /home/derek/dr/src/core/ir/aarch64/decode.c:189
#7 0x0000000071221220 in private_instr_encode (dcontext=0xfffdb4002080, instr=0xfffdb402be78, always_cache=true)
at /home/derek/dr/src/core/ir/instr_shared.c:367
#8 0x000000007122271c in instr_get_eflags (instr=0xfffdb402be78, flags=DR_QUERY_INCLUDE_COND_SRCS)
at /home/derek/dr/src/core/ir/instr_shared.c:891
#9 0x00000000712228bc in instr_get_arith_flags (instr=0xfffdb402be78, flags=DR_QUERY_INCLUDE_COND_SRCS)
at /home/derek/dr/src/core/ir/instr_shared.c:932
#10 0x0000ffffb3fe9ca0 in drreg_event_bb_analysis (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000', user_data=0xffffb4064840) at /home/derek/dr/src/ext/drreg/drreg.c:405
#11 0x0000ffffb40097fc in drmgr_bb_event_do_instrum_phases (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000', pt=0xffffb3fc1460, local_info=0xfffdb4027948, pair_data=0xffffb4064838, quintet_data=0xffffb4064850)
at /home/derek/dr/src/ext/drmgr/drmgr.c:957
#12 0x0000ffffb400a428 in drmgr_bb_event (drcontext=0xfffdb4002080, tag=0xfffff7fccb40, bb=0xfffdb402bbe0, for_trace=0 '\000',
translating=0 '\000') at /home/derek/dr/src/ext/drmgr/drmgr.c:1195
#13 0x00000000711e0cd4 in instrument_basic_block (dcontext=0xfffdb4002080, tag=0xfffff7fccb40 "\377C\025\321\375{", bb=0xfffdb402bbe0,
for_trace=false, translating=false, emitflags=0xfffdb4028b24) at /home/derek/dr/src/core/lib/instrument.c:1680
#14 0x0000000071335808 in client_process_bb (dcontext=0xfffdb4002080, bb=0xfffdb4028dd0) at /home/derek/dr/src/core/arch/interp.c:2742
#15 0x000000007133a1fc in build_bb_ilist (dcontext=0xfffdb4002080, bb=0xfffdb4028dd0) at /home/derek/dr/src/core/arch/interp.c:4105
#16 0x000000007133e6ac in build_basic_block_fragment (dcontext=0xfffdb4002080, start=0xfffff7fccb40 "\377C\025\321\375{", initial_flags=0,
link=true, visible=true, for_trace=false, unmangled_ilist=0x0) at /home/derek/dr/src/core/arch/interp.c:5096
#17 0x00000000710aa9c4 in d_r_dispatch (dcontext=0xfffdb4002080) at /home/derek/dr/src/core/dispatch.c:210
So the encoding failure then tries to call opcode_to_encoding_info() which is not supported on a64.