Reputation: 1193
Are there any tools that can build the control flow graph for an entire Linux kernel binary? For example, consider Linux kernel compiled for x86 architecture (vmlinux file). Is it possible to determine all execution paths (disregarding indirect branches or other control flows that need runtime information) using static analysis only? Are there any tools suitable for this?
Upvotes: 2
Views: 1775
Reputation: 937
There are two tools(CodeViz and Egypt) that can generate call graph during the compiling.
I don't think it will help you a lot to learn the Linux kernel. Many execution paths depend on Macros and runtime conditions, so the call graph generated by the static analyzer is not very practical. You still need to use printk
and dmesg
to figure out what happened in some functions. Instead of using these tools, printk
is more useful.
Upvotes: 1
Reputation: 86
GrammaTech CodeSonar can perform static analysis on binary code (https://www.grammatech.com/products/binary-analysis) and it allows you to visualize and navigate the control-flow graph. This is a commercial tool though.
Upvotes: 0
Reputation: 95316
Our DMS Software Reengineering Toolkit with its C Front End can do this.
DMS provides generic parsing, control flow graph and call graph construction; the C front end provide C-specific parsing details and the logic for constructing C-specific flowgraphs include indirect-gotos as well as a points-to analysis that has beem used on code systems of some 16 million lines, so it should handle the Linux kernal. The flow graphs are produced one-per-compilation unit; the call graph is for a set of linked compilation units. All this information is available as DMS data structures, and/or exportable as XML if you insist and can stomach gigabytes of output.
You can see examples of Control flow, Data Flow, and Call graphs.
Upvotes: 1