google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer
Apache License 2.0
5.38k stars 1.23k forks source link

pkg/cover: optimize coverage report generation #2006

Closed dvyukov closed 4 years ago

dvyukov commented 4 years ago

Coverage report generation is very slow first time, mainly because of running objdump and addr2line on the whole vmlinux. addr2line seems to take more time. Need to figure out a way to make it faster.

For objdump, we could find the binary call pattern in the .text section directly, without running objdump on it (does any arch have pc-relative addressing in calls?).

For addr2line we could try the Go debug/dwarf package instead, but most likely it's slower. Ideally, we should run addr2line incrementally, only on files/symbols that we need for the report, not the whole binary. But it may be tricky,

dvyukov commented 4 years ago

It may be possible to cook something using debug/dwarf, in particular see: https://golang.org/pkg/debug/dwarf/#Data.Ranges https://golang.org/pkg/debug/dwarf/#Data.LineReader https://golang.org/pkg/debug/dwarf/#LineReader

dvyukov commented 4 years ago

Mailed Go change that we need for faster report generation: https://go-review.googlesource.com/c/go/+/256217 It will allow to iterate over all DW_TAG_compile_unit fast and then symbolize only subset of compile units that we need.

dvyukov commented 4 years ago

Report generation is now more than order of magnitude faster. Let's consider this fixed.