graph LR
Runtime_Feedback_Hooks["Runtime Feedback & Hooks"]
Bytecode_Instrumentor["Bytecode Instrumentor"]
Bytecode_Instrumentor -- "prepares calls for" --> Runtime_Feedback_Hooks
Runtime_Feedback_Hooks -- "receives feedback from code prepared by" --> Bytecode_Instrumentor
click Runtime_Feedback_Hooks href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/atheris/Runtime_Feedback_Hooks.md" "Details"
The Runtime Feedback & Hooks subsystem is a critical part of Atheris, embodying the feedback loop essential for coverage-guided fuzzing. It primarily consists of two tightly coupled components: the Runtime Feedback & Hooks itself, which processes and manages runtime data, and the Bytecode Instrumentor, which prepares the target for this data collection.
Runtime Feedback & Hooks [Expand]
This component serves as the central processing unit for all runtime feedback generated by the instrumented code. It manages both Python-level callbacks and interfaces with underlying C/C++ callback mechanisms. Its responsibilities include pattern matching (e.g., for string comparisons), collecting coverage information, and providing this feedback to the fuzzer. It is the primary mechanism through which the fuzzer receives dynamic execution insights.
Related Classes/Methods:
src/function_hooks.py:_compile_hooksrc/function_hooks.py:addsrc/function_hooks.py:gen_matchsrc/function_hooks.py:gen_match_recursive
This component is responsible for modifying the Python bytecode of the target program. It strategically injects calls to the Runtime Feedback & Hooks component's functions at relevant points (e.g., around string operations or function entries/exits). This automated instrumentation is crucial for enabling the collection of runtime feedback without requiring manual modification of the target's source code, thereby making the fuzzing process scalable and efficient.
Related Classes/Methods: