See this for Linux kernel specific coverage information.
When clicking on cover
link you get view showing each directory located in your kernel build directory. It's showing either percentage number X% of N
or ---
. X% of N
means that X%
of N
coverage points is covered so far, a coverage point generally refers to a basic block or a CFG edge (depends on compiler and instrumentation mode used during build, basic block in gcc and CFG edge in clang). ---
indicates there is no coverage in that directory.
Directory can be clicked and you get view on files and possible subdirectories. On each source code file there is again either ---
or coverage percentage.
If you click on any C files you will get source code view. There is certain coloring used in the source code view. Color definitions can be found in coverTemplate. Coloring is described below.
If you click on percentage number of any listed source file you will get cover percentage for each function in that source file.
All PC values associated to that line are covered. There is number on the left side indicating how many programs have triggered executing the PC values assocaciated to this line. You can click on that number and it will open last executed program. Example below shows how single line which is fully covered is shown.
There are several PC values associated to the line and not all of these are executed. Again there is number left to the source code line that can clicked to open last program triggering associated PC values. Example below shows single line which has both excuted and non-executed PC values associated to it.
Function (symbol) this line is in doesn't have any coverage. I.e. the function is not executed at all. Please note that if compiler have optimized certain symbol out and made the code inline instead symbol associated with this line is the one where the code is compiled into. This makes it sometimes real hard to figure out meaning of coloring. Example below shows how single line which is uncovered and PC values associated to it are in function(s) that are not executed either is shown.
Line is uncovered. Function (symbol) this line is in is executed and one of the PC values associated to this line. Example below shows how single line which is not covered is shown.
PC values associated to the line are not instrumented or source line doesn't generate code at all. Example below shows how all not instrumented code is shown.
There is small utility in syzkaller repository to generate coverage report based on raw coverage data. This is available in syz-cover and can be built by:
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w" -o ./bin/syz-cover github.com/google/syzkaller/tools/syz-cover
Raw coverage data can be obtained from running syz-manager
by:
wget http://localhost:<your syz-manager port>/rawcover
Now this raw cover data can be fed to syz-cover
to generate coverage report:
./bin/syz-cover --kernel_obj <directory where vmlinux is located> rawcover
You can also export CSV file containing function coverage by:
./bin/syz-cover --kernel_obj <directory where vmlinux is located> --csv <filename where to export> rawcover