aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/cover/report_test.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/osutil: make VerboseError nest other errorsAleksandr Nogikh2025-10-011-1/+3
| | | | | After this change it fits more naturally into the Go's error functionality.
* dashboard/app: export info about uncovered blocks as wellDmitry Vyukov2025-04-101-2/+2
| | | | | | | | Currently it's only possible to understand total number of uncovered blocks in a function (implicitly defined by Instrumented field). This does not allow to render coverage data, nor do detailed analysis on line level. Export detailed info about both covered and uncovered blocks. This allows to e.g. calculate coverage percent for kernel interfaces.
* all: reduce params to MakeReportGeneratorJoey Jiao2025-03-171-2/+2
|
* pkg/cover: allow paths to be excluded from statsKevin Ding2025-03-111-0/+43
| | | | | | | | | | | | | | | Some sub paths may not be covered due to hardware configuration, or lack of interest. This patch allows them to be excluded from the stats. This can be convenient if the excluded paths are deep in the hierarchy: { "name": "sound", "path": [ "techpack/audio", "-techpack/audio/asoc/aaa/bbb" "-techpack/audio/asoc/aaa/ccc" ] }
* pkg/symbolizer: introduce Symbolizer interfaceTaras Madan2025-03-071-2/+1
| | | | To simplify interface Read*Symbols were moved out from symbolizer.Symbolizer.
* pkg/cover: reduce generateReport cycloTaras Madan2025-02-281-29/+17
| | | | This function reached the cyclo complexity limit 24
* pkg/cover: test DoCoverProgramsTaras Madan2025-02-281-18/+40
|
* all: remove loop variables scopingTaras Madan2025-02-171-1/+0
|
* all: rename html functions to meaningful onesJoey Jiao2024-09-051-3/+3
|
* all: calc kaslr offset and remove kaslr_offset from module addrJoey Jiao2024-07-031-1/+5
|
* pkg/cover: cover lessDmitry Vyukov2024-06-051-1/+1
| | | | | | | | Rename CoverHandlerParams to HandlerParams. Everything in cover package is Cover-something, adding cover prefix to everything is excessive. And cover.CoverHandlerParams.CoverFilter is way more cover I am ready to handle. Filter is just fine.
* pkg/cover: fix gcc build error due to warning triggered by -Wint-conversionAlexander Egorenkov2024-06-031-1/+1
| | | | | | | | | | | | | | | | | | This error has appeared on Fedora 40 s390x with gcc 14.0.1. $ go test -v -count=1 -short ./pkg/cover /tmp/TestReportGeneratorlinux-s390xmismatch-pcs2143164880/001/kcov.c:20:33: error: pointer/integer type mismatch in conditional expression [-Wint-conversion] 20 | return map ? map->l_addr : NULL; | ^ At top level: cc1: note: unrecognized command-line option '-Wno-unused-command-line-argument' may have been intended to silence earlier diagnostics Signed-off-by: Alexander Egorenkov <eaibmz@gmail.com>
* pkg/cover/backend: remove RestorePCDmitry Vyukov2024-05-271-1/+1
| | | | | | Now that PCs are 64-bit we don't need RestorePC callback. Now we can just use PreviousInstructionPC, which does not require creation of ReportGenerator.
* executor: make flatrpc build for C++Dmitry Vyukov2024-05-031-3/+7
|
* all: go fix everythingDmitry Vyukov2024-04-261-1/+0
|
* all: remove akaros supportDmitry Vyukov2024-04-151-1/+1
| | | | | | | Akaros support is unused, it was shutdown on syzbot for a while, the akaros development seems to be frozen for years as well. We have a bunch of hacks for Akaros since it supported only super old gcc and haven't supported Go. Remove it.
* pkg/cover: fix riscv testsAleksandr Nogikh2024-04-111-3/+18
| | | | | | | | The TestReportGenerator/linux-riscv64/good-pie-relocs is broken due to some misinteroperability between gcc riscv cross-compiler and llvm-addr2line. Run the test only with clang.
* pkg/cover: don't duplicate broken kcov logic in the testDmitry Vyukov2024-04-091-17/+4
| | | | | dwarf.go already detects if kcov is broken and need to provide this bit for the check in report.go, so just use this bit in the test as well.
* pkg/cover: make tests build for non-Linux targetsAleksandr Nogikh2024-03-261-3/+0
| | | | The sampleCoverJSON was defined in a Linux-only test file.
* syz-ci, pkg/cover: stream coverage from manager to gcsTaras Madan2024-03-211-4/+4
|
* pkg/cover: export the frames data as jsonlTaras Madan2024-03-191-28/+20
| | | | | | jsonl is new-line-new-json format. It is good for streaming because you can read data line-by-line. This pipeline will stream a lot eventually (x00 megabytes).
* pkg/cover/report_test.go: test DoCoverJSONTaras Madan2024-03-071-11/+51
|
* pkg/cover, syz-manager: introduce the /cover?debug=1 parameterAlexander Potapenko2024-02-131-4/+7
| | | | | | | | | | Debugging coverage point validation warnings may require looking at specific addresses, which are not printed anywhere. Add a URL parameter that can be passed to prepareFileMap() to print a more meaningful error message. Also factor out the error message code from prepareFileMap() to reduce its cyclomatic complexity.
* pkg/cover: ensure that all PCs returned by kcov have matching callbacksAlexander Potapenko2024-01-291-5/+44
| | | | | | | | | | | | | | | | In the case some modules' addresses are off, certain kernel addresses returned by kcov may not have corresponding coverage callbacks in the .ko files. Keep an additional map in the backend to verify those addresses and report an error if that is the case. Because GCC < 14 may tail-call coverage callbacks, the described check is not performed for binaries which mention GCC in their .comment section. Also adjust text expectations in pkg/cover/report_test.go, so that non-GCC targets check for PCs matching the callbacks. See https://github.com/google/syzkaller/issues/4447 for more details.
* Revert "pkg/cover: ensure that all PCs returned by kcov have matching callbacks"Alexander Potapenko2024-01-181-27/+5
| | | | | | | This reverts commit 3392690e404b6ba5022825d33259bc2e9e89eb53. x86 bots are unable to generate coverage reports, because they actually have coverage PCs without matching callbacks.
* pkg/cover: ensure that all PCs returned by kcov have matching callbacksAlexander Potapenko2024-01-171-5/+27
| | | | | | | | | | In the case some modules' addresses are off, certain kernel addresses returned by kcov may not have corresponding coverage callbacks in the .ko files. Keep an additional map in the backend to verify those addresses and report an error if that is the case. Also adjust text expectations in pkg/cover/report_test.go, as inexact coverage will result in an error now.
* all: remove mentions of big-envAleksandr Nogikh2023-07-121-2/+2
| | | | Use just env instead of that.
* all: pass cfg to MakeReportGeneratorJoey Jiao2023-07-041-1/+10
| | | | Change-Id: I839fbc94c02da62cadee99a44b4f7c520e35a0dd
* pkg/cover: default to DWARF4 in testsAlexander Potapenko2023-02-021-27/+37
| | | | | | New Clang versions default to DWARF5, which cannot be parsed by pkg/cover yet. Pass -gdwarf-4 to the compiler in those tests that already have -g enabled.
* pkg/cover: mitigate datarace in generateReportSpace Meyer2022-10-071-5/+12
| | | | | | | | | After merging #3409 the test case TestReportGenerator became flaky[0]. The problem is caused by our tests using the same 'Test' struct instance in multiple tests in parallel. Hence when overwriting test.Progs in one test run, another test run might be reading it at the same time. [0] https://github.com/google/syzkaller/actions/runs/3198309451/jobs/5222669976
* pkg/cover: show percent of covered pcs in funcsJoey Jiao2022-05-231-3/+3
|
* syz-manager: display raw coverageAleksandr Nogikh2022-03-281-1/+1
|
* all: use `t.TempDir` to create temporary test directoryEng Zer Jun2022-03-281-6/+1
| | | | | | | | | This commit replaces all `ioutil.TempDir` with `t.TempDir` in tests. The directory created by `t.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* pkg/cover: workaround clang/ubsan bugDmitry Vyukov2021-10-051-8/+43
| | | | | | | | We used to compile and link with a single compiler invocation, but clang has a bug that it tries to link in ubsan runtime when -fsanitize-coverage=trace-pc is provided during linking and ubsan runtime is missing for arm/arm64/riscv arches in the llvm packages. So we first compile with -fsanitize-coverage and then link w/o it.
* pkg/cover: fix tests with clangDmitry Vyukov2021-10-051-1/+8
| | | | | | | This test currently fails on linux if clang is used. The binaries crash when ubsan runtime tries to install signal handlers because static libc is used. Disable all signal handlers in sanitizers.
* sys/targets: enable ASLR on most targetsAleksandr Nogikh2021-09-161-6/+44
| | | | | | | | | | | The -static-pie flag enables us to build static binaries with ASLR support. Local testing demonstrated that enabling ASLR on syz-executor eliminates (almost all?) memory corruptions and significantly reduces the number of "no output from test machine" errors. Enable ASLR by default for Linux and *BSD targets. Replace -static-pie by -static when -static-pie is not supported. Update cover report_test to properly handle ASLR binaries.
* pkg: update generated files to go 1.17Alexey Kardashevskiy2021-07-071-0/+1
| | | | | | | | | | | "make generate" produces this diff when go 1.17 (go1.17-c95464f0ea3f==upstream) is used. Seems compatible with >=1.16. https://github.com/golang/go/commit/4d2d89ff42ca documents the syntax. https://github.com/golang/go/commit/eeadce2d8713 enforces "ignore" for unsatisfiable tags hence the pkg/csource/gen.go change. Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* all: fix arm64 runtime pc not align with elfJoey Jiao2021-06-251-4/+4
|
* pkg/cover/backend: add mach-o object support for darwinPatrick Meyer2021-05-061-2/+2
| | | | | | I have invested time deduplicating code between the two formats. As the go modules for Mach-O and ELF don't share types, I had to re-wrap some information or move code to format specific functions though.
* pkg/cover: pass modules as []host.KernelModuleDmitry Vyukov2021-03-181-1/+1
| | | | | | | | | | Pass modules as []host.KernelModule to cover.MakeReportGenerator. This avoids make(map) in callers that don't pass modules. Store modules as []*KernelModule. This avoids clumsy assignments to the map to update Path and allows to store modules as *KernelModule rather than by name (we are not scripting, pointer is more flexible and handy representation).
* pkg/mgrconfig: move Subsystem from pkg/coverDmitry Vyukov2021-03-181-1/+2
| | | | | | | | | | | | | | | | | | mgrconfig used to be "leaf" package that can be imported by anything. Recently it started importing pkg/cover for Subsystem definition. It leads to the following import cycle if I try to import pkg/host from pkg/cover: package github.com/google/syzkaller/pkg/bisect imports github.com/google/syzkaller/pkg/build imports github.com/google/syzkaller/pkg/mgrconfig imports github.com/google/syzkaller/pkg/cover imports github.com/google/syzkaller/pkg/host imports github.com/google/syzkaller/pkg/csource imports github.com/google/syzkaller/pkg/mgrconfig: import cycle not allowed Move Subsystem into pkg/mgrconfig itself.
* all: support coverage of kernel modulesJoey Jiao2021-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The PCs returned for dynamic loaded module (DLKM) is not parsed in coverage page, these PCs are dropped. The commit is to use DLKM modules' load address and symbol file to restore the PC and show coverage data of DLKM. Introduced new config module_obj to specify module directories. Example of config: "module_obj": [ "module_path1" "module_path2" ] For linux target, before Manager.Connect run, load addresses are getting from /proc/modules in order to group PCs into modules. And so, if modules are under kernel_obj or module_obj dir, their addresses and paths can be generated automatically. kernel_obj is searched before module_obj dir and the first found ko object is always used. Also note that kaslr needs to be disabled.
* Revert "all: add KernelModule cfg to show DLKM coverage"Dmitry Vyukov2021-03-051-1/+1
| | | | This reverts commit 69a06ca2b532ff4021a43fdead4e2ac1452a44c0.
* all: add KernelModule cfg to show DLKM coverageJoey Jiao2021-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PC returned for dynamic loaded module (DLKM) is not parsed in coverage page. So the commit is to use DLKM modules' load address to restore the PC and show coverage data of DLKM. As the load address is written in cfg file, so kaslr needs to be disabled. And for linux target, load address is getting from /proc/modules during instance setup. For either manual or auto address setting case, name and path are needed in config kernel_modules, where name is module name on target. path is module unstripped object path on host. addr is decimal value of module load address on target. Example of config: "kernel_modules": [ { "name": "nf_nat", "path": "/usr/src/linux-source/net/netfilter/nf_nat.ko", "addr": 18446744072637911040 } ]
* pkg/cover, syz-manager: show coverage summaryJoey Jiaojg2021-03-021-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pkg/cover, syz-manager: show coverage summary The funccover or cover page is not easy for statistic purpose. So add /cover?type=rawfiles to show coverage based on each file. And /cover?type=table page to show coverage for group of components. If driver_path_map.json exists, /cover?type=table can show component coverage. Format example: { "all": [ "/" ], "audio": [ "/techpack/audio/asoc", "/techpack/audio/dsp", "/techpack/audio/ipc", "/sound/core" ] } If driver_path_map.json not exist, it will show one line summary. * pkg/cover: use subsystem naming * syz-manager: use /subsystemcover and /filecover * pkg/cover: use subsystem from config * pkg/mgrconfig: add kernel_subsystem * pkg/cover, tools/syz-cover: fix make test * all: fix presumit errors * pkg/cover, syz-manager: fix subsystem
* syz-manager: use ReportGenerator.RestorePC in RPCServer.NewInputDmitry Vyukov2020-12-131-1/+2
| | | | | This will allow to support gvisor coverage where PCs don't need to be rewound to the previous instruction.
* pkg/cover: accept object dir instead of object fileDmitry Vyukov2020-12-131-2/+2
| | | | | | This looks more natural. All users duplicate logic of creating object file path, and then pkg/cover second guesses object dir back.
* pkg/cover: pass VM type for report generatorDmitry Vyukov2020-12-131-1/+1
| | | | | This will be needed for gVisor reports, the target is "linux" but VM type is "gvisor".
* pkg/report: add test for CONFIG_RANDOMIZE_BASEDmitry Vyukov2020-10-261-0/+29
|
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-2/+2
| | | | | | | | | | | | We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere.