Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues

Fuzzer details

Fuzzer: bpf-object-fuzzer

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 506 42.4%
gold [1:9] 108 9.05%
yellow [10:29] 29 2.43%
greenyellow [30:49] 31 2.59%
lawngreen 50+ 519 43.5%
All colors 1193 100

Fuzz blockers

The followings are the branches where fuzzer fails to bypass.

Unique non-covered Complexity Unique Reachable Complexities Unique Reachable Functions All non-covered Complexity All Reachable Complexity Function Name Function Callsite Blocked Branch
346 467 14 :

['IS_ERR', 'fill_map_from_def', 'strdup', 'PTR_ERR', 'build_map_pin_path', 'skip_mods_and_typedefs', 'parse_btf_map_def', 'calloc', 'map_fill_btf_type_info', 'bpf_object__add_map', 'btf_kind_str', 'strlen', 'malloc', 'btf_is_struct']

346 492 bpf_object__init_user_btf_map call site: 00833 /src/libbpf/src/libbpf.c:2509
268 268 4 :

['__errno_location', 'open64', 'libbpf_strerror_r', 'elf_begin']

268 623 bpf_object__elf_init call site: 00047 /src/libbpf/src/libbpf.c:1307
178 178 1 :

['elf32_getchdr']

178 178 gelf_getchdr call site: 00320 /src/libbpf/elfutils/libelf/gelf_getchdr.c:50
134 134 1 :

['btf__find_str']

134 288 btf__add_str call site: 00635 /src/libbpf/src/btf.c:1522
61 61 1 :

['__elf32_getshdr_rdlock']

61 451 elf_strptr call site: 00312 /src/libbpf/elfutils/libelf/elf_strptr.c:121
60 60 1 :

['__elf32_getshdr_wrlock']

60 107 __libelf_set_rawdata_wrlock call site: 00218 /src/libbpf/elfutils/libelf/elf_getdata.c:223
50 206 14 :

['libbpf_print', 'btf__type_by_id', 'IS_ERR', 'btf_vlen', 'btf__resolve_type', 'strdup', 'PTR_ERR', 'btf_var_secinfos', 'calloc', 'bpf_object__add_map', 'btf__name_by_offset', 'btf__find_by_name_kind', 'malloc', 'btf_is_struct']

50 206 init_struct_ops_maps call site: 01002 /src/libbpf/src/libbpf.c:1137
6 6 3 :

['fopen64', 'fclose', '__isoc99_fscanf']

6 6 get_ubuntu_kernel_version call site: 00033 /src/libbpf/src/libbpf_probes.c:38
4 4 2 :

['__xpg_basename', 'strchr']

4 39 bpf_object__new call site: 00026 /src/libbpf/src/libbpf.c:1248
4 4 2 :

['__errno_location', 'pread']

4 4 pread_retry call site: 00063 /src/libbpf/elfutils/libelf/../lib/system.h:193
2 7 2 :

['libbpf_print', '__errno_location']

2 7 __bpf_program__iter call site: 01036 /src/libbpf/src/libbpf.c:8339
2 2 1 :

['strlen']

6 3924 bpf_object_open call site: 00042 /src/libbpf/src/libbpf.c:7257

Runtime coverage analysis

Covered functions
234
Functions that are reachable but not covered
90
Reachable functions
324
Percentage of reachable functions covered
72.22%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
fuzz/bpf-object-fuzzer.c 2
src/libbpf.c 104
src/./libbpf_internal.h 12
elfutils/libelf/elf_version.c 1
elfutils/libelf/elf_error.c 2
src/../include/linux/err.h 4
src/libbpf_probes.c 3
elfutils/libelf/elf_memory.c 1
elfutils/libelf/elf_begin.c 12
elfutils/libelf/./common.h 2
/usr/include/x86_64-linux-gnu/bits/byteswap.h 3
elfutils/libelf/../lib/system.h 1
src/str_error.c 1
elfutils/libelf/elf_kind.c 1
elfutils/libelf/gelf_getclass.c 1
elfutils/libelf/./elf32_getehdr.c 2
elfutils/libelf/elf_getshdrstrndx.c 1
elfutils/libelf/elf_getscn.c 1
elfutils/libelf/elf_rawdata.c 1
elfutils/libelf/elf_getdata.c 7
elfutils/libelf/elf32_getshdr.c 5
elfutils/libelf/elf_getshdrnum.c 2
elfutils/libelf/./elf32_getshdr.c 5
elfutils/libelf/gelf_getehdr.c 1
elfutils/libelf/elf_end.c 1
elfutils/libelf/elf_nextscn.c 1
elfutils/libelf/elf_ndxscn.c 1
elfutils/libelf/elf_strptr.c 3
elfutils/libelf/elf_compress.c 2
elfutils/libelf/gelf_getchdr.c 1
elfutils/libelf/elf32_getchdr.c 1
elfutils/libelf/./elf32_getchdr.c 1
src/btf.c 47
src/./btf.h 24
src/strset.c 8
src/hashmap.c 10
src/./hashmap.h 2
src/usdt.c 1
src/gen_loader.c 1

Analyses and suggestions

Optimal target analysis

Remaining optimal interesting functions

The following table shows a list of functions that are optimal targets. Optimal targets are identified by finding the functions that in combination, yield a high code coverage.

Func name Functions filename Arg count Args Function depth hitcount instr count bb count cyclomatic complexity Reachable functions Incoming references total cyclomatic complexity Unreached complexity
bpf_object__load_skeleton /src/libbpf/src/libbpf.c 1 ['struct.bpf_object_skeleton *'] 9 0 172 23 8 459 0 2831 1614
attach_usdt /src/libbpf/src/libbpf.c 3 ['struct.bpf_program *', 'size_t ', 'struct.bpf_link **'] 13 0 94 11 4 214 0 1431 589
btf__dedup /src/libbpf/src/btf.c 2 ['struct.btf *', 'struct.btf_dedup_opts *'] 4 0 208 48 14 118 0 591 363
elf_compress /src/libbpf/elfutils/libelf/elf_compress.c 3 ['struct.Elf_Scn *', 'int ', 'int '] 7 0 560 62 26 43 0 322 88
perf_buffer__new_raw /src/libbpf/src/libbpf.c 6 ['int ', 'size_t ', 'struct.perf_event_attr *', 'func_type *', 'char *', 'struct.perf_buffer_raw_opts *'] 4 0 171 29 11 41 0 159 62
attach_kprobe_multi /src/libbpf/src/libbpf.c 3 ['struct.bpf_program *', 'size_t ', 'struct.bpf_link **'] 5 0 128 16 6 41 0 202 56
bpf_object__pin /src/libbpf/src/libbpf.c 2 ['struct.bpf_object *', 'char *'] 4 0 59 8 4 37 0 168 55
libbpf_prepare_prog_load /src/libbpf/src/libbpf.c 3 ['struct.bpf_program *', 'struct.bpf_prog_load_opts *', 'size_t '] 9 0 185 28 11 84 0 341 53
attach_ksyscall /src/libbpf/src/libbpf.c 3 ['struct.bpf_program *', 'size_t ', 'struct.bpf_link **'] 6 0 116 15 6 62 0 265 52
bpf_prog_test_run_opts /src/libbpf/src/bpf.c 2 ['int ', 'struct.bpf_test_run_opts *'] 2 0 562 115 38 9 0 62 38

Implementing fuzzers that target the above functions will improve reachability such that it becomes:

Functions statically reachable by fuzzers
68.3%
668/978
Cyclomatic complexity statically reachable by fuzzers
79.4%
4858 / 6116

All functions overview

If you implement fuzzers for these functions, the status of all functions in the project will be:

Func name Functions filename Args Function call depth Reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Files and Directories in report

This section shows which files and directories are considered in this report. The main reason for showing this is fuzz introspector may include more code in the reasoning than is desired. This section helps identify if too many files/directories are included, e.g. third party code, which may be irrelevant for the threat model. In the event too much is included, fuzz introspector supports a configuration file that can exclude data from the report. See the following link for more information on how to create a config file: link

Files in report

Source file Reached by Covered by
[] []
/usr/include/x86_64-linux-gnu/bits/byteswap.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/elf_kind.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_compress.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_fsize.c [] []
/src/libbpf/elfutils/libelf/./gelf_xlate.h [] []
/src/libbpf/src/./hashmap.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/gelf_getshdr.c [] []
/src/libbpf/fuzz/bpf-object-fuzzer.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/../lib/system.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/./elf32_getehdr.c ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/elf_getdata.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_getshdrnum.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/hashmap.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_version.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_getsym.c [] []
/src/libbpf/elfutils/libelf/elf_getshdrstrndx.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_xlatetof.c [] []
/src/libbpf/elfutils/libelf/./elf32_getchdr.c ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/./chdr_xlate.h [] []
/src/libbpf/src/gen_loader.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/./version_xlate.h [] []
/src/libbpf/elfutils/libelf/./elf32_xlatetof.c [] []
/src/libbpf/src/usdt.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf32_getshdr.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_getchdr.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/../include/linux/ring_buffer.h [] []
/src/libbpf/src/bpf.c [] []
/src/libbpf/src/./libbpf_internal.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/elf_getscn.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/libbpf.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_getphdr.c [] []
/src/libbpf/src/relo_core.c [] []
/src/libbpf/elfutils/libelf/./elf32_getshdr.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_ndxscn.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_strptr.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf32_getchdr.c ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/./note_xlate.h [] []
/src/libbpf/elfutils/libelf/elf_end.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf32_getphdr.c [] []
/src/libbpf/elfutils/libelf/./elf32_getphdr.c [] []
/src/libbpf/src/../include/linux/err.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/elf_error.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_nextscn.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/strset.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/./common.h ['bpf-object-fuzzer'] []
/src/libbpf/src/./btf.h ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/elf_begin.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_getehdr.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/gelf_getnote.c [] []
/src/libbpf/elfutils/libelf/elf_getphdrnum.c [] []
/src/libbpf/elfutils/libelf/gelf_xlate.c [] []
/src/libbpf/src/str_error.c ['bpf-object-fuzzer'] []
/src/libbpf/elfutils/libelf/gelf_getclass.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/libbpf_probes.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/btf.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/./gnuhash_xlate.h [] []
/src/libbpf/elfutils/libelf/elf32_xlatetof.c [] []
/src/libbpf/elfutils/libelf/elf_rawdata.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/elfutils/libelf/elf_memory.c ['bpf-object-fuzzer'] ['bpf-object-fuzzer']
/src/libbpf/src/zip.c [] []

Directories in report

Directory
/src/libbpf/src/../include/linux/
/src/libbpf/elfutils/libelf/./
/src/libbpf/elfutils/libelf/../lib/
/src/libbpf/fuzz/
/src/libbpf/elfutils/libelf/
/src/libbpf/src/
/usr/include/x86_64-linux-gnu/bits/
/src/libbpf/src/./