156 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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