You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we compile this code with clang-10, the % operation at line 21 will be trasnlated into idiv assembly instruction.
.text:0000000000401210 55 push rbp
.text:0000000000401211 48 89 E5 mov rbp, rsp
.text:0000000000401214 66 89 7D FC mov [rbp+var_4], di
.text:0000000000401218 66 89 75 FA mov [rbp+var_6], si
.text:000000000040121C 66 83 3C 25 3E 40 40 00+ cmp word_40403E, 0
.text:0000000000401225 0F 84 3D 00 00 00 jz loc_401268
.text:000000000040122B 31 C0 xor eax, eax
.text:000000000040122D 0F B7 4D FA movzx ecx, [rbp+var_6]
.text:0000000000401231 BA 05 00 00 00 mov edx, 5
.text:0000000000401236 89 45 BC mov [rbp+var_44], eax
.text:0000000000401239 89 D0 mov eax, edx
.text:000000000040123B 99 cdq
.text:000000000040123C F7 F9 idiv ecx
.text:000000000040123E 0F BF 0C 25 40 40 40 00 movsx ecx, g_81
.text:0000000000401246 39 CA cmp edx, ecx
.text:0000000000401248 40 0F 95 C6 setnz sil
.text:000000000040124C 40 80 E6 01 and sil, 1
.text:0000000000401250 40 0F B6 CE movzx ecx, sil
.text:0000000000401254 8B 55 BC mov edx, [rbp+var_44]
.text:0000000000401257 39 CA cmp edx, ecx
.text:0000000000401259 40 0F 9F C6 setnle sil
.text:000000000040125D 40 80 E6 01 and sil, 1
.text:0000000000401261 40 0F B6 CE movzx ecx, sil
.text:0000000000401265 89 4D F0 mov [rbp+var_10], ecx
However, we noticed that the idiv instruction will be translated into a function call to idivl_EAX by QEMU (see the translation), and this kind of translation is not handled by symqemu, i.e., the divisor and dividend are treated as concrete values, the tcg_gen_div_i32 function defined at tcg-op.c is not used.
For example, the above idiv ecx instruction will be converted to following tcg ops by symqemu:
The rdx will be updated by idivl_EAX, but the rdx_expr is not updated, so the symbolic chain is broken, and some variables become constant in constraints generated by symqemu.
The same issue exists for the div instruction.
The text was updated successfully, but these errors were encountered:
We found a possible bug while using symqemu to execute following program:
If we compile this code with clang-10, the
%
operation at line 21 will be trasnlated intoidiv
assembly instruction.However, we noticed that the
idiv
instruction will be translated into a function call toidivl_EAX
by QEMU (see the translation), and this kind of translation is not handled by symqemu, i.e., the divisor and dividend are treated as concrete values, thetcg_gen_div_i32
function defined at tcg-op.c is not used.For example, the above idiv ecx instruction will be converted to following tcg ops by symqemu:
The
rdx
will be updated byidivl_EAX
, but therdx_expr
is not updated, so the symbolic chain is broken, and some variables become constant in constraints generated by symqemu.The same issue exists for the
div
instruction.The text was updated successfully, but these errors were encountered: