-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
New RZIL integration #1663
New RZIL integration #1663
Conversation
The Currently, the API of opcode evaluation is : it's a recursive function to evaluate the expression. so we may add an extra arg as Callback function the callback function ccould be rzil_focus_trace (RzILOp *op)
- mem read
- mem write
- reg read
- reg write etc. but what I worry about is the possible header conflict. we may not be able to directly use the function and trace info struct in rz_analysis.h
That's two possible solutions I have for now. Do you have any idea ? |
@Heersin I think adding some new structure is a way to go. Not sure what @ret2libc @thestr4ng3r @wargio think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good with these new changes.
core->dbg->trace = rz_debug_trace_new(); | ||
core->analysis->esil->trace = rz_analysis_esil_trace_new(core->analysis->esil); | ||
core->analysis->rzil->trace = rz_analysis_rzil_trace_new(core->analysis, core->analysis->rzil); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have core->analysis
why passing core->analysis->rzil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it passes these 2 because I followed the ESIL api. We can only maintain one argument core->analysis
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, lets skip and use just core->analysis
for both.
ut8 code[32]; | ||
// analysis current data to trigger rzil_set_op_code | ||
(void)rz_io_read_at_mapped(core->io, addr, code, sizeof(code)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are ignoring the rz_io_read_at_mapped return value, maybe it should be better to initialize code to 0 or any other value that represent NOP or invalid op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend not to ignore the value and do the function exit on the error
I'm not 100% sure I understood the problem, but I think having a callback that takes the ILOp as argument (maybe also the RzILVM as well) should be enough to support all kinds of traversal of the OPs without putting anything specific in the RzIL module. |
32f7093
to
f0fc2f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall in a good shape now. Only a few minor nitpicks left, and should be ready to merge. We can improve the implementation further after merging, IMHO.
f0fc2f0
to
6f1372a
Compare
@Heersin could you please rebase on the latest |
6f1372a
to
7da8ec3
Compare
*/ | ||
struct rzil_op_int_t { | ||
ut32 length; ///< s -- sort(type), length of bitvector | ||
int value; ///< x -- value of bitvector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this rather just contain a single RzILBitVector
and be called something like RzILOpBitVector
?
|
||
// Memory | ||
RZIL_OP_LOAD, | ||
RZIL_OP_STORE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't RZIL_OP_LOAD
actually be a bit vector op and RZIL_OP_STORE
be an effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the operand and effect are separated in this case, see the original implementation:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, where are the operands in this link?
There's a lot of work here, nice job. I don't want to be tooo picky here, as otherwise we'll never merge this. I think there are however just few more things to adjust, in particular the void * thing as mentioned also by @thestr4ng3r . |
@Heersin could you please rebase your PR and address the feedback? |
Sure, I will review it tonight |
7da8ec3
to
343cc78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Heersin you forgot 6 more feedback comments, please take a look again. Apart from that, it's good to merge, I think. cc @ret2libc @thestr4ng3r
* Fix db/cmd/esil tests and anlysis_bf bugs * Change BUILD_ header to RZ header * Fix macros and types * Remove unnecessary string and bit types and unused code * Add autolabeler * Various file name and function name changes * Fix broken test * Add unit test for il_definitions * Change the index behaviour of bitvector
- Fix some comments - Add ut8 ut16 convertions
* Rename functions * Add as_string and remove some unused debug functions * Add doxygen docs * Small fix * Fix header protector to corresponding name * Add null checks and RZ_NONNULL * Add more unit tests of rzil_vm, effect and mem * Minimal migration from index approach tree-like approach * Fix bug in new rzil op struct
Address some rename comments Add test for evaluation Address some old comments Fix tests
343cc78
to
570cffc
Compare
Two ASAN failed tests are unrelated to this PR and happen on the latest
|
Your checklist for this pull request
Detailed description
rz_util
only.core/cil.c
. (Related pr of moving esil -> Reorganize esil directory #1360 )stats
andtrace
in the old ESILTest plan
Should pass the old rizin tests.
Closing issues
closes #277
More Info
0. Use tree-like approach
asan build
to detect bug.analysis_bf.c
.Register arena
changes in other module (such asdebug
) are not covered in current new IL.