Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VEXIRSBConverter: Hack Syscall onto Call translation #184

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions ailment/converter_vex.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,7 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
pass

manager.vex_stmt_idx = DEFAULT_STATEMENT
if irsb.jumpkind == "Ijk_Call":
# call

if irsb.jumpkind == "Ijk_Call" or irsb.jumpkind.startswith("Ijk_Sys"):
# FIXME: Move ret_expr and fp_ret_expr creation into angr because we cannot reliably determine which
# expressions can be returned from the call without performing further analysis
ret_reg_offset = manager.arch.ret_offset
Expand All @@ -705,10 +703,17 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
else:
fp_ret_expr = None

if irsb.jumpkind == "Ijk_Call":
target = VEXExprConverter.convert(irsb.next, manager)
elif irsb.jumpkind.startswith("Ijk_Sys"):
target = DirtyExpression(manager.next_atom(), "syscall", manager.arch.bits)
else:
raise NotImplementedError("Unsupported jumpkind")

statements.append(
Call(
manager.next_atom(),
VEXExprConverter.convert(irsb.next, manager),
target,
ret_expr=ret_expr,
fp_ret_expr=fp_ret_expr,
ins_addr=manager.ins_addr,
Expand Down Expand Up @@ -744,5 +749,7 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
vex_stmt_idx=DEFAULT_STATEMENT,
)
)
else:
raise NotImplementedError("Unsupported jumpkind")

return Block(addr, irsb.size, statements=statements)