Prototype for an RzIL based analysis chain#5505
Draft
Rot127 wants to merge 326 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Rot127
force-pushed
the
abstr-intr-prototype
branch
2 times, most recently
from
November 5, 2025 14:16
5862ad7 to
7be9e33
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
from
November 7, 2025 19:21
c5c1b6d to
c4c3c14
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
from
November 10, 2025 19:31
c4c3c14 to
37218c0
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
2 times, most recently
from
November 16, 2025 00:07
ae8a074 to
2a49555
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
from
November 21, 2025 16:29
1cdf909 to
b34d533
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
2 times, most recently
from
November 25, 2025 16:23
a6ec62e to
1c94af2
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
4 times, most recently
from
December 2, 2025 19:39
4790a06 to
cdbe826
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
3 times, most recently
from
December 13, 2025 16:18
675a610 to
8b76d0a
Compare
Rot127
force-pushed
the
abstr-intr-prototype
branch
2 times, most recently
from
December 17, 2025 17:32
3ccc142 to
023d0a5
Compare
Actual concurrent lifting is removed for now while developing the prototype.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performance tests
TODOs
To merge
Performance TODOs
...
Design changes
E.g. if the condition of a direct branch evaluates to a top value, it should produce a abstract state for each branch possibility.
hash_stateis super slow. It needs some faster way. Maybe hash the memory of the global hash table directly with sha (or other hw implemented hash functions?)For review start with
rz_inquiry.handrz_analysis.hfor the API.rz_interpreter_run.interpreter_prototype.cis the plugin.rz_inquiry_interpretergives an idea how the whole setup and API usage of an interpreter looks like.revng_function_detection.cto see the detection algo. But this one is only temporary.aaaaIp <address>(non is current offset). The address is the first entry point executed by the interpreter.2> /dev/nulltldr: interpreter
The interpreter simply collects all statically known branch targets.
Then starts interpreting at those addresses. It collects all yield the interpreter reports (one of them are xrefs).
After the interpreter finished (no new state reached) or failed. It then removes all addresses from the branch target vector which were covered by the interpreter (checks the xrefs it collected to do this).
Then picks the next branch target and starts interpreting from it again.
It continues until no branch targets are left.
tldr: function detection
The interpreter reports call candidates.
Those are instructions which might be calls (push address in the current basic block and branch).
The function detection iterates over all this call candidates and collects the called addresses.
These addresses are called "candidate function entry points (cfep)".
It iterates then over all cfep, adds a new function, and recurses into the basic block cfg, adding each basic block to the function.
Edges of call candidates are ignored.
Lastly, it converts the results to RzAnalysis objects.
Notes
Current design
This PR is only there to discuss design decisions for now.
The RzInquiry module combines for this prototype several roles. In the final version these roles are supposed to be in separated modules. So we can improve the performance independently.
Architecture implemented in this PR
Questions to discuss
Added membersRzILOpArgsVar->hashfor performance.Use abbreviationintrprorinterpinstead ofinterpreterto shorten name prefixes?interp.RzInquiry? Or the IL cache?RzInquiryis then only the binding. But can they be a sub-module ofRzInquiry?RzInquiry.RzILVM? I would argue no for some reasons:RzAnalysisILVM. It is way simpler.Theevalcould only produce the delta between the old and new state.This would save a lot of unnecessary copies of registers which are never touched.This would mean we can never trow away any of the earlier states.
Performance
O(|i2i| * |BBs|)function.Function detection - Lessons learned
Having BBs as nodes in the statuc graph is difficult to get. Because
RzAnalysisOp.typeare not as reliable as RzIL is. Maybe we can ignore this andjust eat the inaccuracy?
We really should get an r-tree implementation for that.
RzAnalysisOp.typeis NOT a reliable source to distinguish jumps from calls or branches in general.opmembers should only be a source of static knowledge for the interpreter. The CFG detection should be based only on the interpretation results to generalize well.