| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
After this change it fits more naturally into the Go's error
functionality.
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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"
]
}
|
| |
|
|
| |
To simplify interface Read*Symbols were moved out from symbolizer.Symbolizer.
|
| |
|
|
| |
This function reached the cyclo complexity limit 24
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
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.
|
| |
|
|
| |
The sampleCoverJSON was defined in a Linux-only test file.
|
| | |
|
| |
|
|
|
|
| |
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).
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
This reverts commit 3392690e404b6ba5022825d33259bc2e9e89eb53.
x86 bots are unable to generate coverage reports, because they actually
have coverage PCs without matching callbacks.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Use just env instead of that.
|
| |
|
|
| |
Change-Id: I839fbc94c02da62cadee99a44b4f7c520e35a0dd
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
"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>
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
This reverts commit 69a06ca2b532ff4021a43fdead4e2ac1452a44c0.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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
|
| |
|
|
|
| |
This will allow to support gvisor coverage where PCs
don't need to be rewound to the previous instruction.
|
| |
|
|
|
|
| |
This looks more natural.
All users duplicate logic of creating object file path,
and then pkg/cover second guesses object dir back.
|
| |
|
|
|
| |
This will be needed for gVisor reports,
the target is "linux" but VM type is "gvisor".
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|