Commit Graph

330 Commits

Author SHA1 Message Date
Alexander Egorenkov
70301872e1 syz-manager/cover: support compiler triple for readelf 2020-08-09 14:58:49 +02:00
Pedro Lopes
242b0eb219 pkg: get and store Maintainers data
Create a struct on pkg/vcs to store data of syzkaller email recipients
and update its users. The struct contains default name, email, and a
label to divide user into To and Cc when sending the emails.
2020-07-31 17:18:29 +02:00
Dmitry Vyukov
3940e7a64f all: fix log/error text starting with capital letter
Update #1876
2020-07-05 10:55:16 +02:00
Dmitry Vyukov
fcb219b67e all: don't compare string len with 0
For strings it's more readable to compare the string itself with "",
instead of comparing len with 0. Fix all such cases.

Update #1876
2020-07-04 15:05:30 +02:00
Dmitry Vyukov
2c2b926cb7 .golangci.yml: reduce function line count from 200 to 140
140 lines should be enough for everyone.
2020-06-07 10:41:01 +02:00
Dmitry Vyukov
2fcb2b5c16 .golangci.yml: enable gocognit checker
Finds too complex functions.
Similar to gocyclo, but uses somewhat different metric.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
2ba71ec506 pkg/repro: don't enable features missing on the target
Manager has already checked what features are present on the target.
But if we detected that, say, USB is missing, we still enabled it
in the starting csource options. This is wrong, increases configuration
minimization time and may lead to some obscure bugs.
2020-06-03 11:35:08 +02:00
Daimeng Wang
f7fbb18cba syz-manager: add detailed coverage logging
Originally, syz-manager confusingly logs corpusSignal as "cover".
Change syz-manager's logging to output corpusSignal, corpusCover
and maxSignal.
Add a field in Stats to store maxSignal.
2020-05-30 08:04:19 +02:00
Dmitry Vyukov
fdf90f622b pkg/cover: add test for report generation
Test various combinations of no debug info,
no coverage instrumentation, no PCs, bad PCs, good PCs,
and what errors we produce for these.
Also implement support for cross-arch reports:
prefix objdump with cross-compile prefix
(e.g. aarch64-linux-gnu-objdump instead of objdump).
2020-05-27 14:38:28 +02:00
Dmitry Vyukov
a44eb8f7ea syz-manager: more consistently check disabled syscalls
We have program "validity" check duplicated 4 times
(initially it was just "does it deserialize?").
Then we added program length and disabled syscall.
But some of the sites have only a subset of checks.
Factor out program checking procedure into a separate function
and use it at all sites.
2020-05-12 15:26:07 +02:00
Dmitry Vyukov
a788005625 dashboard/app: collect BB coverage stats from managers
Fixes #1698
2020-05-08 14:09:35 +02:00
Dmitry Vyukov
413b991c26 syz-fuzzer: add more checks for disabled syscalls
We are seeing some panics that say that some disabled
syscalls somehow get into corpus.
I don't see where/how this can happen.
Add a check to syz-fuzzer to panic whenever we execute
a program with disabled syscall. Hopefull the panic
stack will shed some light.
Also add a check in manager as the last defence line
so that bad programs don't get into the corpus.
2020-05-07 15:41:50 +02:00
Dmitry Vyukov
9f7c6d1294 Revert "syz-manager: if running on GCE use GCE public IP address"
This reverts commit 273e386b71.
The error handling in the function is somewhat unusual,
and the code was correct. GCE address took precedence.
2020-04-19 22:06:23 +02:00
Dmitry Vyukov
273e386b71 syz-manager: if running on GCE use GCE public IP address
Host is not necessary full public address.
So if we are running on GCE, prefer GCE public IP.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
9b1f3e6653 prog: control program length
We have _some_ limits on program length, but they are really soft.
When we ask to generate a program with 10 calls, sometimes we get
100-150 calls. There are also no checks when we accept external
programs from corpus/hub. Issue #1630 contains an example where
this crashes VM (executor limit on number of 1000 resources is
violated). Larger programs also harm the process overall (slower,
consume more memory, lead to monster reproducers, etc).

Add a set of measure for hard control over program length.
Ensure that generated/mutated programs are not too long;
drop too long programs coming from corpus/hub in manager;
drop too long programs in hub.
As a bonus ensure that mutation don't produce programs with
0 calls (which is currently possible and happens).

Fixes #1630
2020-03-13 13:16:53 +01:00
Dmitry Vyukov
05359321bb all: fix new golangci-lint warnings
Newer version started producing more warnings. Fix them.
2020-03-13 08:26:02 +01:00
Andrei Vagin
f60dc5d243 manager: check mgr.checkResult before accessing it
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xd5ef14]

goroutine 1 [running]:
main.(*Manager).needLocalRepro(0xc000582780, 0xc000416a40, 0xc00307e274)
	/usr/local/google/home/avagin/git/gopath/src/github.com/google/syzkaller/syz-manager/manager.go:697 +0x74
main.(*Manager).saveCrash(0xc000582780, 0xc000416a40, 0x24)
	/usr/local/google/home/avagin/git/gopath/src/github.com/google/syzkaller/syz-manager/manager.go:688 +0xce5
main.(*Manager).vmLoop(0xc000582780)
	/usr/local/google/home/avagin/git/gopath/src/github.com/google/syzkaller/syz-manager/manager.go:398 +0x174b
main.RunManager(0xc000120f00, 0xc000292000, 0xc00001edc0, 0xc000792000, 0xd11, 0x1000)
	/usr/local/google/home/avagin/git/gopath/src/github.com/google/syzkaller/syz-manager/manager.go:270 +0x7a6
main.main()
	/usr/local/google/home/avagin/git/gopath/src/github.com/google/syzkaller/syz-manager/manager.go:135 +0x365

Signed-off-by: Andrei Vagin <avagin@google.com>
2020-03-04 11:13:09 +01:00
Dmitry Vyukov
b6ed147834 prog: dump orig prog if Deserialize panics
We are seeing some one-off panics during Deserialization
and it's unclear if it's machine memory corrpution or
an actual bug in prog. I leam towards machine memory corruption
but it's impossible to prove without seeing the orig program.

Move git revision to prog and it's more base package
(sys can import prog, prog can't import sys).
2020-02-21 10:22:07 +01:00
Dmitry Vyukov
f9b6950728 syz-manager: don't accept excessive amounts of inputs for a single call
From time to time we get corpus explosion due to different reason:
generic bugs, per-OS bugs, problems with fallback coverage, kcov bugs, etc.
This has bad effect on the instance and especially on instances
connected via hub. Do some per-syscall sanity checking to prevent this.
2020-01-15 18:04:24 +01:00
Dmitry Vyukov
0b7abdf922 syz-manager: don't send more than 100K inputs to hub
Never send more than 100K, this is never healthy but happens episodically
due to various reasons: problems with fallback coverage, bugs in kcov,
fuzzer exploiting our infrastructure, etc.
2020-01-15 18:04:24 +01:00
Dmitry Vyukov
23641f8d17 syz-manager: start VMs with a small delay
If lots of instances are started at the same time,
it slows down boot of every VMs and delays detection
of configuration bugs, etc. Start VMs with 10 sec delay,
so that checking happens faster.
2020-01-14 19:51:25 +01:00
Dmitry Vyukov
6a8d39b1f4 syz-manager: disable corpus rotation
Temporary disable corpus rotation b/c we suspect it negatively affects fuzzing.
But we don't have hard data, and the easiest way to check is to disable
and see what happens.

Update #1348
2020-01-07 16:01:39 +01:00
Dmitry Vyukov
90408076e6 syz-manager: don't show hub stats if hub is not enabled 2020-01-05 11:46:34 +01:00
Dmitry Vyukov
147b97431b syz-manager: show list of all enabled syscalls
1. Show all syscalls even if they don't have coverage yet.
2. Show full syscall names.
3. Show prio/corpus/cover for paticular syscall descrimination.

This allows to check what exactly syscalls are enabled
and see prio/corpus/cover for a single syscall.
2020-01-05 11:46:33 +01:00
Dmitry Vyukov
7e52950696 syz-manager: init coverage without manager mutex
Coverage initialization takes very long time,
if we hold manager mutex we stall all rpc's and everything.
Do it without manager mutex.
2020-01-03 16:11:49 +01:00
Dmitry Vyukov
74da6acb21 syz-manager: add a note about corpus rotation
Update #1348
2019-12-30 18:03:59 +01:00
Dmitry Vyukov
6b36d33868 syz-manager: corpus rotation
Use a random subset of syscalls/corpus/coverage for each individual VM run.
Hypothesis is that this should allow fuzzer to get more coverage
find more bugs in saturated state (stuck in local optimum).
See the issue and comments for details.

Update #1348
2019-12-30 16:37:38 +01:00
Marco Vanotti
607350e438 syz/targets: add SyzExecutorCmd flag
This commit adds a new attribute to syzkaller targets that tells
syzkaller how to invoke the syz-executor command.

Some systems, like Fuchsia, are now building syz-executor as part of the
build, and there is no need to copy it over, or to run it from `/tmp`.
In fact, that might stop working at some time in the future in Fuchsia.

All places that used to copy syz-executor into the target machine will
now check for the SyzExecutorCmd flag, and won't copy it if the flag is
set.
2019-12-09 15:13:49 -08:00
Dmitry Vyukov
587cec15e2 pkg/host: add Features.Supported
To reduce diff in future changes. Currently no-op.
2019-11-16 09:58:54 +01:00
Dmitry Vyukov
aa27601f9e pkg/host: rename some features
Rename some features in preparation for subsequent changes
which will align names across the code base.
2019-11-16 09:58:54 +01:00
Marco Elver
5681358a2a syz-fuzzer, executor: Add support for blacklisting data race frames
This adds support to add frames that have already been in data races, to
the KCSAN report blacklist.
2019-10-22 17:48:18 +02:00
Dmitry Vyukov
c85e1c5be9 pkg/cover: hierarchical coverage reports
Better coverage reports with hierarchical coverage information,
number of programs covering each line,
handling of partially covered lines,
links to programs covering lines.

Fixes #682
2019-07-26 19:32:14 +02:00
Dmitry Vyukov
7bb222f7bc syz-manager: fix argument order in generateCoverHTML 2019-07-18 09:47:33 +02:00
Siddharth M
f613a7c41d pkg/cover: fix prefix computation
* pkg/cover: Modify parsing logic
1. Remove prefix computation
2. Add a mgrconfig for kernel build directory

* pkg/report: shorten reports with kernelBuildSrc instead of kernelSrc

* pkg/report: Fix failing tests

* pkg/report: fix formating issues

* tools/syz-cover: Fix unintended redefinition

* make changes to fix failing ci build

* pkg/report: fix issues
2019-07-17 11:58:23 +02:00
Dmitry Vyukov
2fa06225ad syz-manager: increase initial poll batch size
When the fuzzer starts, it pumps the whole corpus.
If we do it using the final batchSize, it can be very slow
batch of size 6 can take more than 10 mins for 50K corpus and slow kernel).
Use a batch of 30 initially.
2019-06-03 13:13:56 +02:00
Dmitry Vyukov
4adc00e894 syz-manager: reproduce leaks from hub
pkg/repro only enables leak checking when report type is MemoryLeak.
Since repros from hub always have Unknown type, repro won't reproduce leaks.
Always set report type to MemoryLeak on leak instances.
2019-05-21 12:25:10 +02:00
Dmitry Vyukov
7b3084af2e syz-manager: don't repro non-leaks on leak instance
Leak checking is too slow to reproduce other bugs.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
2c9280d432 pkg/rpctype: use string type for leak frames
We need them as string everywhere.
Not sure why they were []byte to begin with.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
4d4a4420e7 pkg/report: add Type/Frame to Report
In several places we do special handling for some crash types.
Currently we compare report title with magic strings,
which is error-prone. Add explicit Type to reports.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
52a20ba400 dashboard/app: properly handle build failures
Separate kernel and syzkaller build failures.
Fix logic to understand when a build is fixed:
look if kernel/syzkaller commit changes to understand
if it's a new good build or re-upload of an old build.

Fixes #1014
2019-03-25 17:00:25 +01:00
Andrew Donnellan
54779150a6 syz-manager: fix typo in dashboard stats upload error
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-03-20 07:47:17 +01:00
Dmitry Vyukov
3e98cc3080 dashboard/app: poll commits info
This implements 2 features:
 - syz-ci polls a set of additional repos to discover fixing commits sooner
   (e.g. it can now discover a fixing commit in netfilter tree before
   it reaches any of the tested trees).
 - syz-ci uploads info about commits to dashboard.
   For example, a user marks a bug as fixed by commit "foo: bar".
   syz-ci will find this commit in the main namespace repo
   and upload commmit hash/date/author to dashboard. This in turn
   allows to show links to fixing commits.

Fixes #691
Fixes #610
2019-02-17 15:08:45 +01:00
Dmitry Vyukov
b97b12358e syz-manager: restore disabled syscall logging
We reset disabled syscalls before checking them.
As the result no diagnostics printed. Reset them after checking.
2019-02-01 10:02:24 +01:00
Michael Tuexen
2103a236f1 syz-manager: provide config name in Stats 2019-01-18 13:20:33 +01:00
Dmitry Vyukov
025b20b5cb syz-manager: fix up commit link 2019-01-16 14:48:49 +01:00
Joey Jiao
d5d60d1061 syz-manager: add repo version and config link on stats page 2019-01-16 14:38:28 +01:00
Michael Tuexen
3d85f48c14 syz-manager: Improve the computation of getVMOffset() on FreeBSD
On FreeBSD getVMOffset() always returned 0 instead of 0xffffffff.
This breaks the usage of addr2line. For now, just return always
0xffffffff on FreeBSD, since a more sophisticated logic doesn't
seem to be required by now.

Thanks to Dmitry for pointing out that this functions provides
the prefix address.
2018-12-31 19:36:13 +01:00
Dmitry Vyukov
85d28281fb syz-manager: factor out rpc serving part
Update #605
2018-12-26 10:58:23 +01:00
Dmitry Vyukov
88f5934633 vm: allow fine-grained control over program exit conditions
Currently we only support canExit flag.
However there are actually 3 separate conditions:
 - program can exit normally
 - program can timeout (e.g. fuzzer test or runtest can't)
 - program can exit with error (e.g. C test can)
Allow to specify these 3 conditions separately.
2018-12-24 09:59:56 +01:00
Dmitry Vyukov
ba64d006de prog: implement strict parsing mode
Add bulk of checks for strict parsing mode.
Probably not complete, but we can extend then in future as needed.
Turns out we can't easily use it for serialized programs
as they omit default args and during deserialization it looks like missing args.
2018-12-10 16:37:01 +01:00