Commit Graph

340 Commits

Author SHA1 Message Date
Dmitry Vyukov
ee01a72bf4 syz-manager: don't reproduce corrupted reports
Corrupted reports are usually associated with frequently happenning races.
Since they are frequently happenning, we should get a repro for them
without corrupted reports. Reproducing is expensive, so doing it
when we will the repro anyway is harmful.
2017-11-22 12:47:00 +01:00
Dmitry Vyukov
6440d6940f syz-manager: send corrupted flag to dashboard 2017-11-21 19:11:54 +01:00
Dmitry Vyukov
ad0af9fff5 vm: return Report from MonitorExecution
This allows callers to get access to Report.Corrupted.
Better than adding 6-th return value and will allow
to pipe other report properties if necessary.
2017-11-21 19:02:35 +01:00
Dmitry Vyukov
fba338cd51 pkg/csource: add function to parse serialized options
Also move options and options tests into a separate file,
add serialization function.
2017-11-17 17:57:51 +01:00
Dmitry Vyukov
c4d43f4773 pkg/osutil: don't leace runaway processes
When manager is stopped there are sometimes runaway qemu
processes still running. Set PDEATHSIG for all subprocesses.
We never need child processes outliving parents.
2017-11-16 12:48:02 +01:00
Dmitry Vyukov
4bd78cef05 pkg/report, pkg/repro, syz-manager: name crash attributes consistently
We currently have several names for crash attributes, which is disturbing.
E.g. crash title is called "Title" or "Desc". Name them consistently.

Title - single line bug identity.
Report - whole crash text.
Log - whole fuzzer/kernel output.
2017-11-14 10:04:22 +01:00
Dmitry Vyukov
10112655d7 vm: remove needOutput arg for MonitorExecution
Always wait 10 secs for output.
If anything this can only lead to missed crashes during repro.
Let's unify manager and repro behavior.
2017-11-14 09:45:34 +01:00
Dmitry Vyukov
3b7ad24d6c syz-manager/mgrconfig: add another OOM suppression
If sshd was killed, we will get "lost connection".
2017-11-08 18:01:43 +01:00
Dmitry Vyukov
6755f62592 syz-fuzzer: fix manager polling
We need to always poll manager to send stats/maxsignal,
we just need not request candidates if we have plenty of work.
2017-10-23 09:59:39 +02:00
Dmitry Vyukov
fe864987bd syz-manager: pass kernel object dir to report.NewReporter 2017-10-18 18:19:01 +02:00
Dmitry Vyukov
441d64d9a5 syz-manager/mgrconfig: fix selection of executor binary
We currently select executor for vm arch, need to select target arch.
This breaks linux/amd64/386 configuration where we select amd64 instead of 386.
2017-10-18 16:49:25 +02:00
Dmitry Vyukov
85c802e4cf pkg/report: support multiple OSes
Introduce report.Reporter interface.
Add an implementation per-OS.
Make users be explicit about OS they are testing.
2017-10-18 12:01:24 +02:00
Dmitry Vyukov
a1bdb604cc syz-manager: extend periodic messages
Add coverage and number of reproducing programs to the periodic messages.
When all machines are busy reproducing crashes, it appears that
syz-manager hanged as number of executed programs does not increase.
Coverage is just a nice characteristic.
Also print machine check message, it appears once and contains useful info.
2017-10-17 15:00:01 +02:00
Dmitry Vyukov
974ad2210c syz-manager: check git revision on start
If we have no git revision, we will fail later anyway.
Better to fail earlier.
2017-10-16 20:21:47 +02:00
Dmitry Vyukov
128c09f19d syz-manager: expose raw cover in http handler
This adds /rawcover handler which returns a file with all covered so far PCs, e.g.:

0xffffffff8100763e
0xffffffff81007667
...
0xffffffff8100767d

Useful for offline coverage processing, diffing coverage, etc.
In particular allows to do:

curl http://localhost:1234/rawcover | addr2line -e vmlinux
2017-10-11 22:47:40 +02:00
Dmitry Vyukov
817b677396 syz-manager/mgrconfig: add gce examples 2017-10-10 15:47:27 +02:00
Dmitry Vyukov
9fc15c7ea3 vm/gce: windows support
Support custom pre-created images.
Support non-root user.
Use dir instead of pwd on windows.
Don't use sudo on windows.
2017-09-27 18:59:50 +02:00
Dmitry Vyukov
4b83c85945 Makefile: name windows executables with .exe suffix 2017-09-27 18:59:50 +02:00
Dmitry Vyukov
8f8cf20bd2 syz-manager: make vmlinux optional
It's currently both optional and non optional.
We require it to be non-empty, but at the same time allow fake "-"
which effectively means "no vmlinux". Make it optional.
2017-09-23 10:02:53 +02:00
Dmitry Vyukov
0818340e80 syz-manager: don't take mutex when serving static files
Crash log serving does not touch any manager state.
2017-09-20 14:00:20 +02:00
Dmitry Vyukov
62114d6064 Makefile: build target binaries into separate dirs
We currently build binaries for all targets into bin.
This makes mess in bin/ and does not allow testing of different archs.
Build target binaries into bin/OS_ARCH/ subdirs.

Host binaries are still built into bin/.

Update #333
Update #324
Update #191
2017-09-19 16:44:54 +02:00
Dmitry Vyukov
4f60e46e49 syz-manager: check that files we are using are not changing under us
If kernel or syzkaller binaries are rebuilt when manager uses them,
nothing good will happen. Manager can start mixing coverage from
old and new kernels, or crash on unknown syscalls.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
539e603206 syz-manager, syz-fuzzer, executor: ensure that binaries are consistent
Check that manager/fuzzer/executor are build on the same git revision,
use the same syscall descriptions and the same target arch.

Update #336
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
52a33fd516 prog: remove default target and all global state
Now each prog function accepts the desired target explicitly.
No global, implicit state involved.
This is much cleaner and allows cross-OS/arch testing, etc.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
91def5c506 prog: remove special knowledge about "mmap" syscall
Abstract "mmap" away as it can be called differently on another OS.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
c0cabacda7 syz-fuzzer, syz-execprog: add -arch flag
arch flag specifies target arch, which can be different from GOARCH.
For example, 386 executor with amd64 fuzzer.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
c6d248ce95 vm/vmimpl: add target OS/arch to env
Allows future VM tuning based on target OS/arch.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
f7b1163afb syz-manager/mgrconfig: explicitly specify target in config
Add target config parameter (e.g. linux/amd64) which controls target OS/arch.
No more explicit assumptions about target.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
ffe7e17368 prog, sys: move types to prog
Large overhaul moves syscalls and arg types from sys to prog.
Sys package now depends on prog and contains only generated
descriptions of syscalls.
Introduce prog.Target type that encapsulates all targer properties,
like syscall list, ptr/page size, etc. Also moves OS-dependent pieces
like mmap call generation from prog to sys.

Update #191
2017-09-05 15:52:42 +02:00
Dmitry Vyukov
5db39ab953 sys: rename Call to Syscall
In preparation for moving sys types to prog
to avoid confusion between sys.Call and prog.Call.
2017-09-05 10:38:22 +02:00
Victor Chibotaru
1336586b42 executor, fuzzer: change the way Syzkaller opens the KCOV device
We have implemented a new version of KCOV, which is able to dump
comparison operands' data, obtained from Clang's instrumentation hooks
__sanitizer_cov_trace_cmp[1248], __sanitizer_cov_trace_const_cmp[1248]
and __sanitizer_cov_trace_switch.

Current KCOV implementation can work in two modes: "Dump only the PCs"
or "Dump only comparisons' data". Mode selection is done by the
following series of calls:

fd = open(KCOV_PATH, ...); // works as previous
ioctl(fd, KCOV_INIT_TRACE, ...); // works as previous
mmap(fd, ...); // works as previous
ioctl(fd, KCOV_ENABLE, mode);
// mode = KCOV_MODE_TRACE_CMP or mode = KCOV_MODE_TRACE_PC

Note that this new interface is backwards compatible, as old KCOV
devices will just return -EINVAL for the last ioctl. This way we can
distinguish if the KCOV device is able to dump the comparisons.

Main changes in this commit:
    1. Fuzzer now checks at startup which type (new/old) of KCOV device
is running.
    2. Executor now receives an additional flag, which indicates if
executor should read the comparisons data from KCOV. The flag works on
per-call basis, so executor can collect PCs or Comps for each
individual syscall.
2017-08-30 18:40:14 +02:00
Dmitry Vyukov
33b9e777cb syz-manager: remove unnecessary type conversion 2017-08-19 09:58:45 +02:00
Dmitry Vyukov
0327584e99 dashboard/app: tell managers when dashboard needs a repro
Managers can't decide when a repro is required.
First, there can be bugs with seq>0.
Second, a repro can be already obtained on another manager.
2017-08-10 19:29:42 +02:00
Dmitry Vyukov
77a9ec9ba5 syz-manager: don't ask for repros if reproducing is not enabled 2017-08-07 16:58:18 +02:00
Dmitry Vyukov
a8561e92f3 syz-manager: don't save/send to dashboard repros from hub 2017-08-07 16:40:18 +02:00
Dmitry Vyukov
1e3a94a731 syz-manager: send more info with repros
Leave at least some traces of the original crash
when sending repros to hub.
2017-08-07 15:37:21 +02:00
Dmitry Vyukov
8af91f61b4 syz-manager, syz-hub: share repros between managers via hub
Currently hub allows managers to exchange programs from corpus.
But reproducers are not exchanged and we don't know if a crash
happens on other managers as well or not.

Allow hub to exchange reproducers.

Reproducers are stored in a separate db file with own sequence numbers.
This allows to throttle distribution of reproducers to managers,
so that they are not overloaded with reproducers and don't lose them on restarts.

Based on patch by Andrey Konovalov:
https://github.com/google/syzkaller/pull/325

Fixes #282
2017-08-07 15:28:59 +02:00
Dmitry Vyukov
df92da0d0e dashboard/dashapi: don't send manager name in crashes
We already have manager name in Build and Crash references Build.
2017-07-25 20:23:37 +02:00
Dmitry Vyukov
0bdcc49799 syz-manager: fix repro saving
If manager is connected to dashboard it now does not save crashes.
Which means that when we save a repro the crash dir may not exist yet.
Create the dir when saving repros.
2017-07-21 10:06:46 +02:00
Andrey Konovalov
d1e3265562 syz-manager: don't print empty tag on report page 2017-07-19 17:35:40 +02:00
Andrey Konovalov
f9f0e027d8 syz-manager: fix repro log filename 2017-07-19 17:32:48 +02:00
Dmitry Vyukov
0107e4124d pkg/repro: save final crash log
Logs are useful in situations where we mess the report.
Since we try to report crashes with reproducers,
we need logs for reproducers.
2017-07-18 18:00:03 +02:00
Dmitry Vyukov
e489b6cafd syz-ci: don't duplicate manager config default values 2017-07-17 12:39:11 +02:00
Dmitry Vyukov
8d1e709552 syz-manager: symbolize repro reports
We now take reports from repro and they are not symbolized.
Symbolize them.
2017-07-13 18:46:24 +02:00
Dmitry Vyukov
76f45d87f2 syz-manager: save proper report for reproducers
We can start reproducing one crash, but end up reproducing another.
Currently we still attribute the resulting repro to the original crash.
This is wrong.
Save the resulting desc/report for reproducers and use that in manager.
2017-07-06 12:17:39 +02:00
Dmitry Vyukov
a7b199253f all: use consistent file permissions
Currently we have unix permissions for new files/dirs
hardcoded throughout the code base. Some places use 0644,
some - 0640, some - 0600 and a variety of other constants.

Introduce osutil.MkdirAll/WriteFile that use the default
permissions and use them throughout the code base.

This makes permissions consistent and also allows to easily
change the permissions later if we change our minds.

Also merge pkg/fileutil into pkg/osutil as they become
dependent on each other. The line between them was poorly
defined anyway as both operate on files.
2017-07-03 14:00:47 +02:00
Dmitry Vyukov
7f03d6d553 syz-manager: switch to the new dashboard 2017-06-30 16:09:50 +02:00
Dmitry Vyukov
a8b32c55ab syz-ci: switch to the new dashboard
Switch to the new dashboard and start uploading build info.
2017-06-30 16:04:30 +02:00
Dmitry Vyukov
a7785e15ba syz-manager: output maintainers in html reports 2017-06-30 15:09:57 +02:00
Dmitry Vyukov
c2028e38d2 pkg/report: change arg of ExtractGuiltyFile to []byte
We usually store reports as []byte, not as string. They can be large.
So change arg type to []byte.
Also rename it from log to report. In our terminology log is
not symblized/processed crash output. What this function wants
is called report in manager.
2017-06-30 15:09:57 +02:00
Dmitry Vyukov
c5b6fcddca syz-hub: split client name and manager name
This allows to reduce number of hub clients by grouping managers
and creating one client per such group.
2017-06-29 17:50:44 +02:00
Andrey Konovalov
e379542e8b repro, manager: show repro logs and stats on manager dashboard 2017-06-27 16:27:21 +02:00
Andrey Konovalov
3349d055d7 repro: bisect the log to find multiple guilty programs 2017-06-27 11:59:11 +02:00
Dmitry Vyukov
9af3153420 syz-dash/dashboard: move from dashboard
Move the old dashboard API into syz-dash
to get it out of the way of the new dashboard.
2017-06-23 15:22:34 +02:00
Dmitry Vyukov
97b58e7eae syz-manager/mgrconfig: move sshkey from vm config to manager config
Sshkey is a property of image, which is in manager config.
Move sshkey to the same location as image.

The motivation for the move is as follows.
Continuous build produces an image and the key,
both need to be passed manager instance.
Continuous build system should not distinguish
different VM types and mess with their configs.

NOTE FOR USERS: this breaks manager configs again.
Hopefully the last time for now. Docs are updated.
2017-06-17 15:02:58 +02:00
Dmitry Vyukov
260cdaa2b2 syz-manager/mgrconfig: remove output param
It was useful only for vm/local which was removed.
The param wasn't documented and if one tries to change it,
it will break manager in obscure way (i.e. spurious
"test machine is not executing programs" crashes).
2017-06-17 14:41:15 +02:00
Dmitry Vyukov
017b5dea53 pkg/symbolizer: move from symbolizer 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
949ccff832 pkg/rpctype: from from rpctype 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
68621900a3 pkg/report: move from report 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
baad3b4b02 pkg/csource: move from csource 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
ec95d17c32 pkg/cover: move from cover 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
6fd7a75a91 pkg/repro: move from pkg 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
a853b91c58 syz-manager/mgrconfig: allow loading from memory
Allow loading manager config from memory.
Follow pkg/config naming convention,
i.e. LoadFile/LoadData instead of Parse.
2017-06-17 14:41:15 +02:00
Dmitry Vyukov
75c73461d8 syz-manager/config: rename to syz-manager/mgrconfig
We have 2 packages with the same name: pkg/config and syz-manager/config.
This leads to constant clashes. We either rename one to pkgconfig or
another to mgrconfig. This is not good and will become worse when/if
we have another program-specific config in a separate package.

Rename manager config to mgrconfig.
Other program-specific configs can use the same convention
in future -- fooconfig.
2017-06-17 14:41:10 +02:00
Dmitry Vyukov
4cc7e08628 all: use osutil.IsExist instead of os.Stat 2017-06-17 12:23:52 +02:00
Dmitry Vyukov
daf82c6d9e syz-manager: delete old corpus support
There was enough time to convert old corpuses to the new format.
2017-06-15 22:14:53 +02:00
Dmitry Vyukov
b43dc425e0 syz-manager: fix bug in repro logic
We did not check phase when creating new instances for fuzzing.
2017-06-15 22:13:19 +02:00
Dmitry Vyukov
2200ced89b syz-manager: improve vm management during repro
1. Don't start reproducing crashes until we triage
   all inputs from corpus and hub. This minimizes
   chances of losing inputs from hub. Also allows
   to faster get idea of total coverage.
2. Fix bug when vmCount%instacesPerRepro != 0.
   Currently we stop the remainder of instances
   and it stays idle.
2017-06-15 21:50:15 +02:00
Andrey Konovalov
493434090e report: extract guilty file 2017-06-13 19:33:21 +02:00
Dmitry Vyukov
7caa2a9eda syz-manager/config: add test for example config parsing
This will ensure that the provided example config is up-to-date.
2017-06-04 10:45:42 +02:00
Dmitry Vyukov
af643baa32 vm: overhaul
VM infrastructure currently has several problems:
 - Config struct is complete mess with a superset of params for all VM types
 - verification of Config is mess spread across several places
 - there is no place where VM code could do global initialization
   like creating GCE connection, uploading GCE image to GCS,
   matching adb devices with consoles, etc
 - it hard to add private VM implementations
   such impl would need to add code to config package
   which would lead to constant merge conflicts
 - interface for VM implementation is mixed with interface for VM users
   this does not allow to provide best interface for both of them
 - there is no way to add common code for all VM implementations

This change solves these problems by:
 - splitting VM interface for users (vm package) and VM interface
   for VM implementations (vmimpl pacakge), this in turn allows
   to add common code
 - adding Pool concept that allows to do global initialization
   and config checking at the right time
 - decoupling manager config from VM-specific config
   each VM type now defines own config

Note: manager configs need to be changed after this change:
VM-specific parts are moved to own "vm" subobject.

Note: this change also drops "local" VM type.
Its story was long unclear and there is now syz-stress which solves the same problem.
2017-06-03 11:31:42 +02:00
Dmitry Vyukov
ea2295f3e2 pkg/db: move from db 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
23b94422d3 pkg/log: move from log 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
d1032c21a0 pkg/hash: move from hash 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
66fd442d48 pkg/fileutil: move from fileutil 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
84eb5fd389 config: split and refactor
Introduce generic config.Load function that can be
reused across multiple programs (syz-manager, syz-gce, etc).
Move the generic config functionality to pkg/config package.
The idea is to move all helper (non-main) packages to pkg/ dir,
because we have more and more of them and they pollute the top dir.
Move the syz-manager config parts into syz-manager/config package.
2017-06-01 11:17:54 +02:00
Jess Frazelle
f4a173a718
syz-manager: detect sandbox namespace unsupported
Signed-off-by: Jess Frazelle <acidburn@google.com>
2017-05-31 09:25:44 -04:00
Dmitry Vyukov
8f58526cb8 all: add fault injection capability
Systematically inject faults during smashing.
Requires kernel patch:
"fault-inject: support systematic fault injection"
(currently in linux-next).
2017-05-26 17:22:57 +02:00
Dmitry Vyukov
e33075c047 syz-manager: reformat 2017-05-25 11:36:19 +02:00
baishuai
6e254bdd13 manager: save and reuse allSymbols, vmOffset 2017-05-25 17:30:27 +08:00
Dmitry Vyukov
7e458d6416 syz-hub: send new inputs in smaller parts
Currently hub sends all inputs on first manager connect.
This can be 100K+ inputs and can take long time
and consume tons of memory. Send inputs in 1K parts.

Also increase rpc timeouts as hub still has global mutex.
2017-05-23 16:33:28 +02:00
baishuai
85a6d58149 manager: do not print "executed programs" until first connection from test machine.
add my name to contributors
2017-05-21 12:48:25 +08:00
Andrey Konovalov
91ea49ce25 vm: add Odroid support
This commit adds Odroid C2 support to syzkaller.
It's now possible to specify "type": "odroid" in manager config.

Documentation on how to setup fuzzing with Odroid C2 board is here:
https://github.com/google/syzkaller/wiki/Setup:-Odroid-C2

Note, that after this change libusb-1.0-0-dev package should be
installed to build syzkaller.
2017-03-10 17:10:52 +01:00
Dmitry Vyukov
1466d0cb9f manager: add ability to communicate with dashboard
Manager can send crashes and repros to a dashboard app.
Dashboard app is not checked-in yet.
2017-02-17 18:52:07 +01:00
Dmitry Vyukov
525be5b8a7 manager: don't recalculate dynamic priorities too often
Recalculating dynamic priorities requires deserializing all programs,
and that is slow. So do it at most once per 30 mins and don't hold
the mutex during prio calculation.
2017-01-30 15:44:12 +01:00
Dmitry Vyukov
22361c62e9 manager: collect crash info without holding the global mutex
Crash collection just reads files, so the mutex is unnecessary.
2017-01-30 15:23:29 +01:00
Dmitry Vyukov
1f0546f0da manager, fuzzer, hub: move common rpc code into rpctype
If hub hangs, it causes all managers to hang as well as they call
hub under the global mutex. So move common rpc code into rpctype
and make it more careful about timeouts (tcp keepalives, call timeouts).
Also don't call hub under the mutex, the call can be slow.
2017-01-30 15:15:37 +01:00
Dmitry Vyukov
e00c6a347b syz-manager: print at most 10 deleted programs
Printing thousands of programs is slow and unnecessary.
2017-01-28 17:52:14 +01:00
Dmitry Vyukov
24362e5bc7 manager: make disabledHashes map 2017-01-27 21:48:36 +01:00
Dmitry Vyukov
8365c3838d all: implement edge coverage
Currently syzkaller uses per-call basic block (BB) coverage.
This change implements edge (not-per-call) coverage.
Edge coverage is more detailed than BB coverage as it captures
not-taken branches, looping, etc. So it provides better feedback signal.
This coverage is now called "signal" throughout the code.
BB code coverage is also collected as it is required for visualisation.
Not doing per-call coverage reduces corpus ~6-7x (from ~35K to ~5K),
this has profound effect on fuzzing efficiency.
2017-01-27 20:46:18 +01:00
Dmitry Vyukov
652ac3731d syz-manager: add benchmarking mode
In benchmarking mode (if the new -bench flag is specified)
syz-manager writes execution statistics into the specified file.
This allows later comparison of different runs (baseline vs some experiment).
For example, verify that some fuzzing modification indeed leads to larger coverage.
2017-01-20 14:56:20 +01:00
Dmitry Vyukov
f9869965cf syz-manager: don't create legacy corpus dir if it does not exist 2017-01-20 14:56:20 +01:00
Dmitry Vyukov
823604de7e syz-manager: track fuzzing time
Fuzzing time is amount of time we spent actually fuzzing.
It excludes VM creation time, crash reproducing time, etc.
On the other hand it is multipled by number of currently
fuzzing VMs, so it can be larger than uptime time.
2017-01-20 14:56:20 +01:00
Dmitry Vyukov
c4f622fcb3 syz-manager: add option to turn off crash reproducing
Reproducing is still turned on by default,
turning it off can be useful for benchmarking.
2017-01-20 14:56:20 +01:00
Dmitry Vyukov
ffe327412b syz-fuzzer: don't reminimize all programs from corpus on start
Minimization takes considerable time on start, but the programs were already minimized.
There are some chances that we could minimize it better this time,
but still it does not worth very slow start (which is especially painful for development).
2017-01-18 19:58:12 +01:00
Dmitry Vyukov
0e2608c229 syz-manager: speed up coverage report
Uncovered PCs were handled very badly:
we added PCs from the same function multiple times
and did not remove covered PCs. As the result total
number of uncovered PCs was terrific.
Fix that.
2017-01-17 17:14:11 +01:00
Dmitry Vyukov
f6c7b90523 syz-manager: speed up crash reading
Currently we read lots of unnecessary files. This is slow on GCE.
Read only necessary info.
For summary report use on readdirnames (which does not do stat on every file).
For detailed crash report read additional info, but only for this crash.
2017-01-16 21:39:34 +01:00
Dmitry Vyukov
c91904333f db: add package
Package db implements a simple key-value database.
The database is cached in memory and mirrored on disk.
It is used to store corpus in syz-manager and syz-hub.
The database strives to minimize number of disk accesses
as they can be slow in virtualized environments (GCE).

Use db in syz-manager instead of the old PersistentSet.
2017-01-16 20:42:52 +01:00
Dmitry Vyukov
43d5c364a2 syz-manager: move include files to the bottom of coverage report
They are usually less interesting than source files.
2017-01-09 20:20:49 +01:00
Dmitry Vyukov
ec9744f3e5 syz-manager, syz-gce: output 20 log lines instead of 50 in web UI
50 lines take too much space, there is scroll bar if necessary.
2017-01-09 20:19:44 +01:00
Dmitry Vyukov
80b6c954f8 manager: add ability to ignore bugs
Add new config parameter "ignores" which contains list of regexp expressions.
If one of the expressions is matched against oops line,
crash report is not saved and VM is not restarted.
2016-12-19 17:39:03 +01:00
Dmitry Vyukov
a59452c4b2 vm/gce: handle graceful preemption
In case of graceful preemption fuzzer should be terminated by SIGTERM.
Catch it and propagate to manager.
2016-12-16 16:11:18 +01:00
Dmitry Vyukov
73b7be0e9c manager: print how long VMs running before restarting
For a potential case VM unexpectedly exits too early.
2016-12-08 17:28:42 +01:00
Dmitry Vyukov
ad8354e9bd manager: fix potential nil deref crash
res.res.CRepro crashes if res.res == nil.
Fix that.
2016-12-06 20:08:04 +01:00
Dmitry Vyukov
eac6d72f0e manager: use only 1 proc in debug mode
Parallel procs produce lots of intermixed output.
2016-11-29 15:17:48 +01:00
Dmitry Vyukov
9604794dce manager: reproduce crashes on the fly
With this change manager will run reproduction on crashes
until reproducer is discovered, but at most 3 times.

If reproducer is discovered it is saved with crashes and shown on the web UI.
2016-11-25 11:07:52 +01:00
Andrey Konovalov
5f1dc34693 manager: add empty line before per-call coverage in html 2016-11-22 16:06:49 +01:00
Andrey Konovalov
7c5f5c84aa manager: print actual number of loaded progs 2016-11-22 16:06:49 +01:00
Dmitry Vyukov
c9ae0f69d8 vm: add ability to interrupt commands
This is required for crash reproduction in manager.
2016-11-19 11:14:11 +01:00
Dmitry Vyukov
dbc7ff3805 manager: unbreak build 2016-11-18 19:18:09 +01:00
Dmitry Vyukov
e8de4be407 manager: enable keepalives on rcp connections
VMs die frequently and it causes orphan tcp rpc connections on manager.
2016-11-18 19:06:04 +01:00
Dmitry Vyukov
cd74cc9cf4 syz-hub: add program
syz-hub is used to exchange programs between syz-managers.
2016-11-17 18:38:10 +01:00
Dmitry Vyukov
128816142c syz-gce,syz-manager: add name config parameter
Name is used for identification on web ui
and included in gce instance names (so that
several managers can coexist in a single project).
2016-11-16 13:19:33 +01:00
Dmitry Vyukov
f5a15094af syz-gce, syz-manager: save image tag in syz-gce, show in syz-manager 2016-10-10 17:32:27 +02:00
Dmitry Vyukov
ef3ee4ad56 manager: minor tweaks to web ui 2016-10-10 13:11:31 +02:00
Dmitry Vyukov
6796d65400 syz-manager, syz-gce: show latest log messages in log textarea 2016-10-10 13:00:27 +02:00
Dmitry Vyukov
1af94b8f0c manager: show cached log in web ui 2016-10-09 11:45:39 +02:00
Dmitry Vyukov
222090e3b4 log: add package
Log is a simple wrapper around std log package.
It is meant to solve 2 main problems:
1. Logging from non-main packages (mainly, vm/* packages).
   Currently they can either always log or not log at all.
   But they can't respect program verbosity setting.
   Log package allows all packages to use the same verbosity setting.
2. Exposing recent logs in html UI.
   Namely we want to tee logs to console and html UI.
2016-10-09 11:27:48 +02:00
Dmitry Vyukov
fc3361d7af manager: enable fuzzer verbosity only if -debug flag is given
It is not useful to pass manager verbosity flag to fuzzer,
as fuzzer output is not visible. But it increases amount of fuzzer
output that needs to be parsed by manager. Also increased fuzzer
verbosity reduces effective crash log size (less programs fit).
Enable fuzzer verbosity only if debug flag is given.
2016-10-09 09:41:30 +02:00
Dmitry Vyukov
7de2937037 manager: overwrite old reports with new reports
Save up to 100 reports. If we already have 100, overwrite the oldest one.
Newer reports are generally more useful. Overwriting is also needed
to be able to understand if a particular bug still happens or already fixed.
2016-10-07 22:04:58 +02:00
Dmitry Vyukov
191a429c4c manager: save user tag with crash reports
If config contains "tag" parameter, save it along with crash reports.
The tag is meant to contain kernel branch/commit hash.
If workdir contains crashes from different kernel versions,
it is useful to be able to find out on what kernel revision a crash happened.
2016-10-07 21:42:56 +02:00
Dmitry Vyukov
fbaafcd200 manager: don't alter /proc/sys/debug/exception-trace
It should be handled by image (create-image.sh already sets it to 0).
2016-10-07 21:38:56 +02:00
Dmitry Vyukov
d21c3c878c syz-gce: add autonomous GCE runner
It is meant to download new kernel images from GCS,
update and rebuild syzkaller and restart syz-manager.
Work in progress...
2016-10-07 18:56:45 +02:00
Dmitry Vyukov
2da6f4a8e1 manager: precreate crashes dir
http handler scrapes crashes dir, it becomes upset if the dir is missing
2016-10-07 18:42:52 +02:00
Dmitry Vyukov
ff62857ef3 manager: fix html table markup 2016-10-07 09:25:42 +02:00
Dmitry Vyukov
f032ffb788 manager: unify handling of various stats in web ui 2016-10-06 19:53:32 +02:00
Dmitry Vyukov
ec073e08ad manager: show crashes in web ui 2016-10-06 18:48:14 +02:00
Dmitry Vyukov
83374d77d3 vm/gce: add support GCE VMs 2016-10-06 16:22:35 +02:00
Dmitry Vyukov
2bdb521fb0 manager: server http over ipv4
ipv4 is still more prevalent. In particular, GCE does not support ipv6.
2016-10-06 16:22:35 +02:00
Dmitry Vyukov
76be3c5d86 manager: fix rpc address in error message 2016-10-06 16:22:35 +02:00
Dmitry Vyukov
93b6291297 vm/adb: avoid draining battery
One common issue we see with android devices is that
fuzzing drains battery episodically, device goes down and
then does not boot until one presses the power button.
Check battery level at the beginning of each cycles
and wait if it is too low.
Current numbers are: wait if level < 20% until it is >=30%.
Let's see how it works.

Fixes #79
2016-09-29 15:13:00 +02:00
Dmitry Vyukov
d87ae1c444 manager: fix deadlock
This fixes 2 problems:
1. syz-manager inverted condition for local instances.
2. local instances deadlocked on "no output" condition
2016-09-09 13:22:48 +02:00
Dmitry Vyukov
9decc82111 manager: show uncovered PCs
Uncovered PCs in covered functions are shown in red.

Fixes #43
2016-09-06 19:35:48 +02:00
Dmitry Vyukov
6b42c2d6da manager: show unique coverage
Add an option to view unique coverage per syscall (i.e. not covered
by any other calls) and unique coverage per-program (not covered by
any other program).
2016-09-06 19:34:55 +02:00
Dmitry Vyukov
c7aabee440 manager: don't save empty reports 2016-09-05 12:49:47 +02:00
Dmitry Vyukov
0e77b5a187 manager, repro: unify VM monitoring
Unify and factor out VM monitoring loop used in syz-manager and syz-repro.
This allows syz-repro to detect all the same bugs (e.g. "no output", "lost connection", etc).
And also just deduplicates code.
2016-09-01 19:54:55 +02:00
Dmitry Vyukov
b06a63128a manager: improve how crashes are saved
Now crashes dir contains 1 subdirectory per unique crash type.
Each subdirectory contains 'description' file with a unique string identifying
the crash type (e.g. "KASAN: slab-out-of-bounds Read of size 2 in bit_putcs"),
and up to 100 logN and reportN files with raw crash log (as before) and
post processed kernel oops message.
2016-09-01 17:08:22 +02:00
Dmitry Vyukov
54d923bb5d manager: mark covered lines with /*covered*/
Mark covered lines with /*covered*/ in coverage report,
so that it is possible to quickly find if there are few of them.
2016-08-31 19:20:27 +02:00
Dmitry Vyukov
365791764b symbolizer: move symbolizer to a separate package
Make it reusable.
Support several binaries (vmlinux, modules).
Support symbolization of individual PCs.
Add tests.
2016-08-31 19:20:21 +02:00
Dmitry Vyukov
bb1e3bfda5 report: extract better, unique identifiers of oopses 2016-08-31 13:20:57 +02:00
Dmitry Vyukov
14dfa4f109 report: add a new package for report parsing and processing
Move vm.FindCrash to the new package.
2016-08-30 15:19:28 +02:00
Dmitry Vyukov
bc9b349bd7 vm/adb: support multiple adb devices
Device IDs are specified in "devices" config param.
2016-08-30 14:33:39 +02:00
Dmitry Vyukov
76f68d6039 vm: merger console/fuzzer output line-by-line
Fixes #57
2016-08-28 19:21:57 +02:00
Dmitry Vyukov
776431e726 manager: ignore .git dir in corpus
For the case the corpus is checked into git.
2016-08-28 10:48:21 +02:00
Dmitry Vyukov
0d0fbbe73f overhaul syscall description generation process
This splits generation process into two phases:
1. Extract values of constants from linux kernel sources.
2. Generate Go code.

Constant values are checked in.
The advantage is that the second phase is now completely independent
from linux source files, kernel version, presence of headers for
particular drivers, etc. This allows to change what Go code we generate
any time without access to all kernel headers (which in future won't be
limited to only upstream headers).

Constant extraction process does require proper kernel sources,
but this can be done only once by the person who added the driver
and has access to the required sources. Then the constant values
are checked in for others to use.
Consant extraction process is per-file/per-arch. That is,
if I am adding a driver that is not present upstream and that
works only on a single arch, I will check in constants only for
that driver and for that arch.
2016-08-26 07:09:25 +02:00
Dmitry Vyukov
96cc1ccc79 manager: measure execution speed starting from first VM connect
Currently execution speed is considerably skewed on start
because we take into account VM boot time.
2016-08-21 19:04:50 -07:00
Dmitry Vyukov
39350d876d manager: add a special VM type "none"
Type "none" in config says manager to not manage any VMs,
and just manage the corpus (it still server RPCs).
This is useful when something else manages the VMs
and starts fuzzer processes on them.
2016-08-05 20:08:44 +02:00
Dmitry Vyukov
2db4e4554b manager: print keep alive to stdout
Print a message with total number of programs executed every 10 seconds.
Helps to understand if this thing is working or not.
2016-08-05 19:42:24 +02:00
Dmitry Vyukov
f2dda79907 manager: pass -debug flag to fuzzer
This allows to see debug output from syz-executor
running on test machine.
2016-08-05 16:00:38 +02:00
JeremyHuang
d8075925a0 Merge branch 'master' of https://github.com/google/syzkaller into for_submit 2016-07-07 13:36:47 +08:00
JeremyHuang
19523ffdcc added an optional initrd flag. 2016-07-07 12:08:20 +08:00
Dmitry Vyukov
4782c2b8e6 executor: revive setuid sandbox
The new namespace-based sanboxing is good,
but it's not always what one wants
(and also requires special kernel configs).

Change dropprivs config value to sandbox,
which can have different values (currently: none, setuid, namespace).
Setuid mode uses setuid(nobody) before fuzzing as before.

In future we can add more sandboxing modes or, say,
extend -sandbox=setuid to -sandbox=setuid:johndoe
to impersonolate into given user.
2016-07-01 22:26:33 +02:00
JeremyHuang
6691f801bf add a initrd flag for qemu type and display the qemu command. 2016-06-20 17:54:25 +08:00
Alexander Potapenko
ed787856f2 Use readelf to obtain the upper 32 bits of addresses returned by kcov.
When executors send coverage data to the manager, they clamp the addresses
of covered blocks to 32 bits. Manager uses RestorePC() to restore the original
addresses.
Previously, RestorePC() assumed that the upper 4 bytes of a kernel code
address were 0xffffffff, which is not so on Android.
Instead we now parse `readelf -SW vmlinux` output to obtain the upper bytes of
PROGBITS sections VMAs in the case those VMAs are non-zero. We assume that
the upper 4 bytes are the same for every section.
2016-05-03 11:06:27 +02:00
Dmitry Vyukov
41b2457ddc manager: dump machine state on hangs 2016-03-10 17:47:13 +01:00
Dmitry Vyukov
9537a44236 manager: don't save crashers during shutdown 2016-03-10 17:47:13 +01:00
Dmitry Vyukov
862594f1b6 manager: don't confuse users with zero coverage 2016-02-18 21:48:45 +01:00
Dmitry Vyukov
8e0d5c2bd0 manager: properly cleanup on ctrl+C
Don't leave temporal files behind.
2016-02-18 21:41:50 +01:00
David Drysdale
e28305b2bd Pass through -v <N> option from syz-manager to syz-fuzzer 2016-02-18 11:14:56 +00:00
David Drysdale
ef1dbf7924 Distinguish between no data and no symbols 2016-02-17 16:50:57 +00:00
Dmitry Vyukov
68c7a49a96 fuzzer: warn about absent kcov/kmemleak files
Currently the failure mode is too obscure,
so warn explicitly about these common cases.

Also make local mode more usable.
2016-02-16 15:55:44 +01:00
Dmitry Vyukov
8c1b44717f manager: detect missing debug info
Fixes #19
2016-02-16 15:10:24 +01:00
Dmitry Vyukov
d439da5b7c manager: do GC after cover profile generation
Don't retain more memory than necessary.
2016-02-16 15:07:27 +01:00
Dmitry Vyukov
dfa483f986 manager: remove coverage info caching
The generation does not seem to take too large time.
The cache consumes memory but rarey used, so just remove it.
Makes the code much nicer.
2016-02-16 15:06:24 +01:00
Dmitry Vyukov
d1163f0480 ipc: unify command line flag handling
It was duplicated in 3 programs.
2016-01-27 14:22:48 +01:00
Dmitry Vyukov
f9ad59cfb9 manager: extend crash logs a bit
Also print all previous crashes to estimate how corrupted the kernel can be,
and for how long we are running.
2016-01-27 13:34:30 +01:00
Dmitry Vyukov
3bbab61d72 manager: save more trailing output
In some crash logs I see trimmed oops messages,
because fuzzer outputs executing programs.
2016-01-27 13:14:43 +01:00
Dmitry Vyukov
62dabb6a64 vm/adb: make more robust
Add timeout to adb invocations and do more reliable reboot.
Clean up temporary files from previous runs.
Also pass enabled syscalls via rpc, as adb barks at too long command line.
Abd is still unreliable, though. Devices hang.
2016-01-26 16:48:37 +01:00
Dmitry Vyukov
8cff5843fb vm/adb: use a more reliable way to reboot devices 2016-01-20 13:58:57 +01:00
Dmitry Vyukov
891b46a9a5 vm: faster output oops grepping
Use manual parsing instead of a regexp.
Regexp takes ~220ms for typical output size. New code takes ~2ms.
Brings manager CPU consumption from ~250% down to ~25%.
2016-01-19 17:22:36 +01:00
Dmitry Vyukov
842a74a661 manager: use jsonrpc for communication
It seems to be less agressive with caching.
gob caches tons of memory per connection.

Also fix a timer memory leak.
2016-01-19 12:32:21 +01:00
Dmitry Vyukov
7f927c8e33 manager: don't copy data aimlessly
Inputs on manager are immutable anyway.
2016-01-19 12:31:09 +01:00
Dmitry Vyukov
36b96db4da manager: import net/http/pprof
Also expose how much memory is spent on coverage information.
2016-01-19 12:29:59 +01:00
Dmitry Vyukov
4d906f05d4 vm/adb: add adb-based VM
vm/adb can be used to fuzz on real android devices.
2016-01-11 17:40:26 +01:00
Dmitry Vyukov
de48f7b019 vm: refactor VM interface in preparation for adb support
adb has more complex port forwarding setup, also / is mounted read-only.
Make VM interface more flexible to support such cases.
2016-01-11 17:33:44 +01:00
Dmitry Vyukov
4f3c86c950 manager: restore exclusion of programs with disabled syscalls 2016-01-08 22:41:36 +01:00
Dmitry Vyukov
62351e3ea5 fuzzer: allow to write programs to dmesg
Mostly useful for local VM.
2015-12-31 16:03:01 +01:00
Dmitry Vyukov
84916f2fc6 manager: run leak checking only on one instance (it is slow) 2015-12-31 16:03:01 +01:00
marky
2ccb4f6f95
fix a syntax error in example.cfg
Missing comma makes it so that syz-manager does not properly parse the example
config.

Signed-off-by: marky <mark@noffle.net>
2015-12-30 21:29:34 -07:00
Dmitry Vyukov
d54762d735 manager: don't filter out programs with disabled syscalls from corpus
In two contexts I tested it only reduces total coverage.
If you want strict set of syscalls, reset corpus.
2015-12-30 18:53:15 +01:00
Dmitry Vyukov
43815ce761 vm/local: revive local VM 2015-12-30 18:25:14 +01:00
Dmitry Vyukov
9c148d824a manager: fix printing of enabled syscalls 2015-12-29 15:18:50 +01:00
Dmitry Vyukov
c7f10835eb manager: give kernel more time to print crash message 2015-12-28 14:35:00 +01:00
Dmitry Vyukov
4961230857 syz-manager: filter out programs with disabled syscalls from corpus
Fixes #9
2015-12-24 12:21:01 +01:00
Dmitry Vyukov
8922bd4029 update documentation 2015-12-23 19:33:12 +01:00
Dmitry Vyukov
546347d931 all: reformat 2015-12-23 19:18:58 +01:00
Dmitry Vyukov
2eb388c0f8 vm: improve VM interface
Current interface is suitable only for running syz-fuzzer.
Make the interface more generic (boot, copy file, run an arbitrary command).
This allows to build other tools on top of vm package
(e.g. reproducer creation).
2015-12-23 19:12:45 +01:00
Dmitry Vyukov
bfc05fb926 manager: fix persistent corpus minimization 2015-12-17 17:31:11 +01:00
Dmitry Vyukov
7b5574e9d7 rpctype: remove master messages 2015-12-17 17:31:11 +01:00
Dmitry Vyukov
8e7ca7c5ff remove master and naming overhaul
Remove master process entirely, it is not useful in its current form.
We first need to understand what we want from it, and them re-implement it.

Prefix all binaries with syz- to avoid name clashes.
2015-12-17 16:06:33 +01:00