Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.
Hey @JonathanSalwan o/ There is an issue with the semantics of call. It has an odd behavoir that depends on whether a GET_CONCRETE_MEMORY_VALUE callback is set. The following snippet exposes the issue:
The address of mem access varies when the callback is set (the first is the correct one, which can be determine by the value that ends up in rip and not the value that is shown by the callback). The reason why it happens when the callback is set is because after calling the callback, processCallback sets the leaAst of the memory access. The first thing done in call_s is aligning the stack to reserve space for holding the return address. After that the AST for the memory access is computed. This AST is affected by what the processCallback does. When the callback is set it takes into account the stack alignment.
This PR fixes this (by reserving the space after building the AST of the mem access in call_s) for this but I wanted to double check with you that I'm not missing anything here.
Hey ameo. Nice catch! The patch looks good to me. I've also checked where we also use alignSubStack_s, for example in the push_s, and it looks we did it correctly.
Hey @JonathanSalwan o/ There is an issue with the semantics of
call
. It has an odd behavoir that depends on whether aGET_CONCRETE_MEMORY_VALUE
callback is set. The following snippet exposes the issue:This is the output:
The address of mem access varies when the callback is set (the first is the correct one, which can be determine by the value that ends up in
rip
and not the value that is shown by the callback). The reason why it happens when the callback is set is because after calling the callback,processCallback
sets theleaAst
of the memory access. The first thing done incall_s
is aligning the stack to reserve space for holding the return address. After that the AST for the memory access is computed. This AST is affected by what theprocessCallback
does. When the callback is set it takes into account the stack alignment.This PR fixes this (by reserving the space after building the AST of the mem access in
call_s
) for this but I wanted to double check with you that I'm not missing anything here.