Commit Graph

241 Commits

Author SHA1 Message Date
Dmitry Vyukov
7a53e7e35d pkg/report: combine report data into a struct
Parse returns 5 variables now. Later we may want to add crash "priority".
Introduce Report struct that holds all report data.
2017-11-14 09:41:55 +01:00
Andrey Konovalov
f9a8d567eb pkg/report: add corrupted report detection
This change makes pkg/report try to detect corrupted reports by
using some heuristics.
2017-11-13 17:18:16 +03:00
Dmitry Vyukov
e0a2b1953b vm: merge "not executing programs" into "no output"
Frequently it's the same condition.
In one case there is just a stray error message on console
that turns the crash into "not executing programs".
While in another case there is no stray message,
and then it's detected as "no output".
2017-11-08 18:01:43 +01:00
Dmitry Vyukov
c1c91039f7 vm/gce: fix error formatting
This is detected with newer Go toolchain:

vm/gce/gce.go:376: Errorf format %v reads arg #1, but call has only 0 args
vm/gce/gce.go:381: Errorf format %v reads arg #1, but call has only 0 args
2017-11-07 13:25:27 +01:00
Dmitry Vyukov
6fd57ceb7d vm/vmimpl: add netbsd console stub 2017-10-26 11:53:10 +02:00
Dmitry Vyukov
da63ec6526 vm/qemu: support netbsd 2017-10-23 10:19:38 +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
038cff25e2 vm/qemu: update error message for newer qemu
Newer qemu prints "Could" instead of "could".
2017-10-17 14:09:37 +02:00
Dmitry Vyukov
5ac303b525 vm/qemu: add freebsd support 2017-10-02 13:57:04 +02:00
Dmitry Vyukov
8136bdad2f pkg/kd: add KD protocol decoder
Very primitive decoder that only decodes amd64 exceptions.
Use it in vm/gce. Now crashes contain something more or less
reasonable which is caught by manager as crash:

BUG: first chance exception 0x80000003

&kd.stateChange64{state:0x3030, processorLevel:0x6, processor:0x0,
numProcessors:0x2, thread:0xffff9c0bd015e080, pc:0xfffff8017615c380,
exception:kd.exception64{code:0x80000003, flags:0x0, record:0x0,
address:0xfffff8017615c380, numParams:0x1, unused:0x0, params:[15]uint64{
0x0, 0x40, 0xfffff801768699e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0}, firstChance:0x1}, report:kd.controlReport{
dr6:0xffff0ff0, dr7:0x400, eflags:0x86, numInstr:0x10, reportFlags:0x3,
instr:[16]uint8{0xcc, 0xc3, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf, 0x1f,
0x84, 0x0, 0x0, 0x0, 0x0, 0x0}, cs:0x10, ds:0x2b, es:0x2b, fs:0x53}}
2017-09-28 16:53:58 +02:00
Dmitry Vyukov
e0e6908d3f vm/gce: fix GCE image check 2017-09-28 16:53:58 +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
187270ea83 vm/qemu: fix typo 2017-09-25 13:14:32 +02:00
Dmitry Vyukov
a0fdd2e758 vm/qemu: initial multi-OS support 2017-09-25 08:47:48 +02:00
Dmitry Vyukov
25f4fe0662 vm/qemu: tune some qemu arguments based on target arch 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
Thomas Garnier
ed7f95981b Fix reboot support for VM isolated
Do not fail a reboot if the reboot command returns an error. Reduces the
wait time per ssh commands to 30 seconds.

Signed-off-by: Thomas Garnier <thgarnie@google.com>
2017-08-30 19:30:38 +02:00
Dmitry Vyukov
f238fbd42d all: support i386 arch
Update #191
2017-08-19 19:17:27 +02:00
Dmitry Vyukov
13fd8fda08 vm/vmimpl: support linux/arm
Update #324
2017-08-18 19:24:26 +02:00
Dmitry Vyukov
a48e1ead61 vm/gce: work around GCE console bug
Sometimes connects to serial console spuriously fail with:
Permission denied (publickey)
2017-08-08 11:45:25 +02:00
Dmitry Vyukov
75f1e83f8b vm/gce: another attempt to fix trimmed console output
We still see trimmed reports even with the "serialport" grep.
Add a 5 second sleep in an attempt to fix it.
2017-08-01 18:25:18 +02:00
Dmitry Vyukov
da1dd22e48 vm/gce: fix truncated console output
Sometimes we get truncated console output during repro.
The problem is that we start the console reading ssh command,
but do not wait for it to actually connect and start piping console.
Wait while the command actually starts piping console before
starting the target command.
2017-07-25 20:32:31 +02:00
Dmitry Vyukov
9e1407a678 vm/isolated: reformat 2017-07-18 09:58:53 +02:00
Thomas Garnier
3fd92b9694 Add Isolated VM
Add a new isolated VM for machines that you cannot easily manage. It
assumes the machine is only available through SSH and create a reverse
proxy to ensure the machine can connect back to syz-manager.

Signed-off-by: Thomas Garnier <thgarnie@google.com>
2017-07-18 09:57:38 +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
ed1e09a88a vm/gce: support debug mode
Print ssh/console output to stdout in debug mode.
2017-06-30 14:32:17 +02:00
Andrey Konovalov
d832fd391a vm: increase stored log size to 1 MB 2017-06-27 11:59:12 +02:00
Dmitry Vyukov
274bfdcec9 vm/adb: add an option to disable battery check
Add a new VM option:

	// Ensure that a device battery level is at 20+% before fuzzing.
	// Sometimes we observe that a device can't charge during heavy fuzzing
	// and eventually powers down (which then requires manual intervention).
	// This option is enabled by default. Turn it off if your devices
	// don't have battery service, or it causes problems otherwise.
	Battery_Check bool

Fixes #258
2017-06-27 10:28:22 +02:00
Dmitry Vyukov
7cacd94aa6 vm/vmimpl: fix linux/ppc64le build 2017-06-27 10:21:43 +02:00
Zach Riggle
4e580472f4 Restore TCGETS2 (#256) 2017-06-27 10:03:24 +02:00
Dmitry Vyukov
0fd3577a0a vm/vmimple: fix build and reformat 2017-06-26 15:36:54 +02:00
Zach Riggle
2420edb02e Port console to Darwin (#253)
* Port console to Darwin

* Get syz-executor to build correctly

* Do not export unix and syscall constants

* Add presubmit test

* Add myself to contributors
2017-06-26 15:32:38 +02:00
Dmitry Vyukov
98877a11dd vm/gce: fix image archive creation
See the added comment.
2017-06-17 18:30:12 +02:00
Dmitry Vyukov
e130d95518 vm/gce: accept un-tar-ed image
vm/gce differs from other VM types in that it accepts image
in a weird, GCE-specific format (namely, image named disk.raw
is put into .tar.gz file). This makes it impossible to write
generic code that creates images for any VM types.

Make vm/gce accept just image like e.g. vm/qemu
and handle own specifics internally.
2017-06-17 17:06:29 +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
68621900a3 pkg/report: move from report 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
4cc7e08628 all: use osutil.IsExist instead of os.Stat 2017-06-17 12:23:52 +02:00
Dmitry Vyukov
429ff326c3 vm/qemu: update kernel command line
+nmi_watchdog=panic
-slub_debug=UZ

Also refactor cmd line generation code to make it more resilent to bugs.
2017-06-15 18:29:47 +02:00
Dmitry Vyukov
b68d01eea0 vm/gce: accept local image
Currently gce accepts precreated GCE image name as image config param,
while all other VM types accept local file path as image.
This makes it impossible to write generic code that works with all VM types,
i.e. after building a new image it's unclear if it needs to be uploaded
to GCE or not, and what needs to be passed as image in config.

Eliminate this difference by making gce accept local image file as well.
2017-06-03 11:48:19 +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
a6bed21731 pkg/gce: move from gce 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
66fd442d48 pkg/fileutil: move from fileutil 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
d1d3a5e702 fileutil: remove unused CopyFile arg 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
0fcd5fd3dd all: speed up tests
Mark tests as parallel where makes sense.
Speed up sys.TransitivelyEnabledCalls.

Execution time is now:

ok  	github.com/google/syzkaller/config		0.172s
ok  	github.com/google/syzkaller/cover		0.060s
ok  	github.com/google/syzkaller/csource		3.081s
ok  	github.com/google/syzkaller/db			0.395s
ok  	github.com/google/syzkaller/executor		0.060s
ok  	github.com/google/syzkaller/fileutil		0.106s
ok  	github.com/google/syzkaller/host		1.530s
ok  	github.com/google/syzkaller/ifuzz		0.491s
ok  	github.com/google/syzkaller/ipc			1.374s
ok  	github.com/google/syzkaller/log			0.014s
ok  	github.com/google/syzkaller/prog		2.604s
ok  	github.com/google/syzkaller/report		0.045s
ok  	github.com/google/syzkaller/symbolizer		0.062s
ok  	github.com/google/syzkaller/sys			0.365s
ok  	github.com/google/syzkaller/syz-dash		0.014s
ok  	github.com/google/syzkaller/syz-hub/state	0.427s
ok  	github.com/google/syzkaller/vm			0.052s

However, main time is still taken by rebuilding sys package.

Fixes #182
2017-05-29 13:15:07 +02:00
baishuai
118ec7aea5 vm: validate if cfg.Bin is in $PATH for kvm,adb,qemu 2017-05-21 12:47:51 +08:00
Andrey Konovalov
fc93e6ec57 vm: build odroid vm only if odroid build tag is present 2017-03-10 19:40:05 +01:00
Andrey Konovalov
889d63a6a7 vm: don't leak tty fds in adb 2017-03-10 17:10:58 +01: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
13051717b5 vm/adb: fix ppc64le build 2017-03-02 15:21:26 +01:00
Dmitry Vyukov
c81cc207a6 vm/adb: support fuzzing without console
If no console found, fall back to 'adb shell dmesg -w'.
This is not reliable, and lots of bugs are detected as 'lost connection'
without any kernel output. But users want this.
2017-02-06 16:01:45 +01:00
Dmitry Vyukov
3558653771 vm: properly detect when a program exits
syz-fuzzer never exits (normally) so this does not affect syz-manager.
But during reproduction we can run a short running program (no repeat mode)
and currently VMs treat premature exit as an error.

Properly detect when a program exits and let callers decide what to do with it.
2017-02-02 20:23:40 +01:00
Dmitry Vyukov
86c334f459 vm/qemu: use static network config in 9p mode
Static config is faster than dhcp.
2017-01-27 20:46:09 +01:00
Billy Lau
a0a4a8ed95 adb: executor: Revert to adb reboot
Using `adb shell syz-executor reboot` to reboot devices has stopped
working with the recent Android update, probably due to the intro
of seccomp. I have reverted the device reboot logic to use `adb
shell reboot` although it can be flaky at times so that we can
continue to fuzz on devices, until a more reliable solution can be
sought out.
2017-01-26 13:19:22 +00:00
Dmitry Vyukov
83a8f430c9 vm/qemu: add some kvm-related kernel cmd line flags
In particular it is useful to enable nested.
Enable a bunch of others as well.
2017-01-09 20:20:49 +01:00
Dmitry Vyukov
40a8b2f8e1 vm/adb: increase battery check timeout
Battery info is provided by some OS services.
With KASAN/KCOV these services take long to startup.
This causes episodic timeouts during battery check.
Increase the timeout.
2017-01-09 20:20:49 +01:00
Dmitry Vyukov
3f9152d9e2 vm/qemu: enable more kvm features in test kernel 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
a074da17a4 vm/adb: support BeagleBone console
BeagleBone console requires some special tty-ism to work.
Fortunately, this code also works with Suzy-Q.
2016-12-19 15:56:10 +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
d105629ea2 vm/qemu: use panic=86400 instead of panic=-1
panic=-1 causes instant reboot, which is bad for crash logs.
panic=86400 makes it hang. Use panic=86400 as create-gce-image.sh does.
2016-12-06 20:06:45 +01:00
Dmitry Vyukov
3e53602346 vm/gce: use preemptible instances
Preemptible instances are cheaper, try to use them.
Also try to enable vmx support.
2016-12-02 16:58:09 +01:00
Alexander Popov
3a5ae29218 vm/qemu: prevent eth0 renaming
create-image.sh tries to enable eth0 network interface of the virtual machine,
but there is no eth0 in a fresh debian-wheezy, since biosdevname renames interfaces.
VM log quotation:
  e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
  e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
  e1000 0000:00:03.0 ens3: renamed from eth0
  ...
  Cannot find device "eth0"
  Bind socket to interface: No such device
  Failed to bring up eth0.

The simplest fix is disabling biosdevname by adding "net.ifnames=0 biosdevname=0"
to the kernel command line.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
2016-11-28 16:11:24 +03:00
Dmitry Vyukov
3356f68f1a vm/qemu: support non-native mode
Add config bin_args parameter that contains additional arguments for qemu binary.
This allows to specify e.g. "bin_args": "-machine virt -cpu cortex-a57".
Also restore qemu debugging output when -debug flag is specified.
2016-11-22 17:00:47 +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
3ad1f7a214 vm/gce: don't require ssh key for GCE-compatible images
If an image supports all GCE fanciness, we don't need a separate ssh key for it.
It should accept the instance private key that we specify during VM creation.
2016-11-17 09:24:54 +01:00
Dmitry Vyukov
1d5ba315b4 vm/gce: actually append name to instance names 2016-11-16 13:35:43 +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
4e20245f4d Merge pull request #88 from billy-lau/hotfix/check-battery-level
Added a retry clause when doing battery check in adb.go
2016-11-15 14:12:55 +01:00
Billy Lau
e246add2ca Added a retry clause when doing battery check in adb.go
Some devices may not boot up fast enough when battery check
is done as it currently is in adb.go. Therefore,
getBatteryLevel() is modified to take in a parameter to determine
the number of times to retry before giving up.
2016-11-15 11:53:00 +00:00
Dmitry Vyukov
d7f6556505 vm/adb: print device<->console association 2016-11-15 12:09:40 +01:00
Dmitry Vyukov
85f78e771d vm/adb: support separate serial console cable
For Suzy-Q we matched usb bus/port between adb and console device.
This is not possible for separate serial cables: bus/port are unrelated.
So switch to a different algorithm that supports both Suzy-Q and separate cables.
The overall idea is as follows. We use 'adb shell' to write a unique string onto console,
then we read from all console devices and see on what console the unique string appears.
2016-11-11 14:02:03 -08:00
Dmitry Vyukov
e3653a25ed vm/adb: switch adb to root
Userdebug builds have adb under 'shell' user by default.
Switch to root user before starting fuzzing.
2016-11-11 13:51:23 -08:00
Dmitry Vyukov
6f057a2c04 vm/qemu: remove debug, add rodata=n to kernel cmd line
Debug leads to too verbose output in some cases.
Rodata is very slow with KASAN.
2016-10-16 08:15:24 +02:00
Dmitry Vyukov
f6a0e2933d vm/gce: don't wait for instance deletion on exit
VM.Close is called when syz-manager terminates on SIGINT.
Waiting for instance deletion in this case is unnecessary,
creation of a new instance will handle deleting instance.
So exit faster.
2016-10-10 12:36:17 +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
c80ed11098 vm/gce: fix bug introduced during refactoring 2016-10-07 19:14:26 +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
83374d77d3 vm/gce: add support GCE VMs 2016-10-06 16:22:35 +02:00
Dmitry Vyukov
e73ddfcb3a vm/adb: reboot devices in the beginning of each cycle
Issue #70 reports that a device can be permanently OOM,
if we don't reboot it new fuzzers will be always killed.
And it's generally safer to assume that a device is in
some bad shape initially. So always reboot them on start.

Fixes #70
2016-09-29 15:27:13 +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
c2918417cb vm: give preference to kernel oops over "lost connection"
If lost connection races with a kernel oops (which probably caused the lost),
give preference to the oops message (it should be more useful).
2016-09-28 18:05:28 +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
Vishwath Mohan
b9b1bb2a04 Improve Case Closed Debugging Port Detection.
The code to detect the ttyUSB number that a Suzy-Q connected device was
exposing wasn't handling the case when the devices were plugged in via a
USB hub (which extends the port numbering scheme). This CL changes the
regexp to detect the serial correctly in these cases as well.
2016-09-06 13:17:08 -07:00
Dmitry Vyukov
cac2fbeb8c vm/qemu: fix spurious failure during VM creation
When we recover from a transient failure, we want to cleanup
everything except for the workdir, because we will use it again
during next VM creation attempt.
Currently the next attempt always fails.
2016-09-05 12:49:47 +02:00
Dmitry Vyukov
40280fa543 syz-repro: fix false "not executing programs" 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
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
26a5cf9efa vm: fix potential deadlock in OutputMerger 2016-08-28 21:00:18 +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
6eb48645a4 vm/qemu: support 9p host-based image
If "image" is set to "9p" in config file,
qemu VM will create a minimalistic image based
on readonly-mapped host filesystem.
The main things that we need are working sshd and ssh-keygen.
/tmp, /etc/, /var, /root are remounted as tmpfs.
2016-08-22 13:48:51 -07:00
Dmitry Vyukov
a949600ee5 vm/qemu: use -no-reboot and -display=none
Rebooting only confuses syz-manager as it thinks that it's the same
dirty instance. Let syz-manager recreate the VM from scratch instead.

-display=none does not disable graphics subsystem which may be useful for fuzzing.
It also seems to be newer than -nographics.
2016-08-21 17:50:57 -07:00
Dmitry Vyukov
70e96a75ec config: add Initrd to known fields 2016-07-20 11:32:14 +02:00
JeremyHuang
19523ffdcc added an optional initrd flag. 2016-07-07 12:08:20 +08:00
JeremyHuang
6691f801bf add a initrd flag for qemu type and display the qemu command. 2016-06-20 17:54:25 +08:00
Lorenzo Stoakes
7c3d3bb8ae vm/qemu: strip ssh warnings
This patch sets the ssh loglevel to error to avoid noisy warnings, specifically
known host errors like:

Warning: Permanently added '[localhost]:1569' (ECDSA) to the list of known hosts.

Previously this appeared at the top of every crash report.
2016-03-10 07:33:23 +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
1c8e56b155 vm/qemu: support kernel embed into the image
Fixes #16
2016-02-15 21:33:00 +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
3247604265 vm/adb: fix instance leak 2016-01-21 16:12:42 +01:00
Dmitry Vyukov
2fb5e9b0d4 vm/qemu: fix latent output reading bug 2016-01-20 14:01:45 +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
dfd341e349 vm/qemu: use snapshot mode
This avoids image copy per instance.
Also page cache won't hold multiple copies of the image.
2016-01-19 15:48:32 +01:00
Dmitry Vyukov
b1f7eb0c30 vm: reformat 2016-01-15 20:33:09 +01:00
Dmitry Vyukov
1bdeb308d3 vm: add another crash message for older kernels 2016-01-15 20:15:36 +01:00
Dmitry Vyukov
12f3129e71 vm/local: implement debug mode 2016-01-14 11:04:49 +01:00
Dmitry Vyukov
91630fe39d sys: add support for /dev/snd/control 2016-01-13 16:54:29 +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
02aa995eb1 vm/local: minor improvements 2015-12-30 19:53:39 +01:00
Dmitry Vyukov
43815ce761 vm/local: revive local VM 2015-12-30 18:25:14 +01:00
Dmitry Vyukov
0451ffa50a qemu/kvm: improve output buffering
There seems to be some missed pieces in output.
2015-12-28 15:53:51 +01:00
Dmitry Vyukov
293e915415 vm: fix crash message extraction regexp
First, "cut here" is not interesting as it always follows
by a more descriptive message.
Unreferenced object is interesting.
Also, strip \r at the end.
Add a test.
2015-12-24 19:55:19 +01:00
Dmitry Vyukov
05b38edce2 vm/qemu: fix output reading bug
If qemu boot retries several times due to busy tcp port,
it ends up with several output reading goroutines.
That completely messes output.
2015-12-24 12:06:04 +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
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
Dmitry Vyukov
41126671ec manager: allow to run fuzzer under root 2015-12-17 14:38:46 +01:00
Dmitry Vyukov
db6bf8626d detect UBSAN error reports 2015-12-17 14:38:46 +01:00
Dmitry Vyukov
cf2089138e support kmemleak
If you set "leak":true in manager config, it will do leak checking.
It's quite slow, though. Also there seems to be false positives
and/or non-reproducible leaks.
2015-12-03 20:38:33 +01:00
Dmitry Vyukov
b1e98de8a6 fuzzer: parallel execution mode
Config now have procs parameter that controls number
of parallel executor's running in each VM.
2015-11-26 15:56:18 +01:00
Dmitry Vyukov
b0131d4eef manager: add support for suppressions
There are always some known bugs...
2015-11-20 19:58:27 +01:00
Dmitry Vyukov
be856bc9e4 allow local vm to not call setuid (not necessary if started not under root) 2015-11-18 16:30:29 +01:00
Dmitry Vyukov
d2c7f41bb0 fix ssh when you have too many keys
IdentitiesOnly=yes disables sending of irrelevant keys
2015-11-09 11:28:26 +01:00
Dmitry Vyukov
7ae6489b27 increase saved context size for crash logs
A bug can be caused by earlier programs,
so it is useful to be able to see them.
2015-11-06 21:51:19 +01:00
Dmitry Vyukov
bb15aa8bfd fix crash output 2015-11-06 21:51:19 +01:00
Dmitry Vyukov
f563cc395b minor improvements for kvm 2015-11-05 10:30:08 +01:00
Dmitry Vyukov
786414e8e9 don't emit unnecessary info into crash log
This was necessary because there was a bug in log offset calculation.
Not the bug is fixed and the additional output makes it harder to grep logs.
2015-11-04 20:23:48 +01:00
Dmitry Vyukov
9ef3f5494e fix crash report extraction from logs 2015-10-20 17:44:56 +02:00
Dmitry Vyukov
9c10c5a1fb fix crash report extraction from logs 2015-10-20 17:43:56 +02:00
Dmitry Vyukov
8264f54f5e improve lkvm support (still does not quite work) 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
74f5340ea6 allow to run local vm without coverage 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
30c9c31819 refactor enabled syscall handling 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
95fb739d94 aggregate vm params into a single struct (for ease of extension) 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
fb190a7fb9 remove ability to execute tests in parallel in fuzzer
it consumes more memory and makes it difficult to find crashing input
2015-10-16 22:21:02 +02:00
Dmitry Vyukov
587db99baa lkvm support 2015-10-16 13:33:24 +02:00
Dmitry Vyukov
8d0aa4f7c0 improvements for kdbus 2015-10-15 17:59:01 +02:00
Dmitry Vyukov
2971d4d4e0 allow to omit -kernel flag in vm/qemu
For the case when image already contains the right kernel.
2015-10-15 17:59:01 +02:00
Dmitry Vyukov
7a72606565 allow to specify additional kernel command line arguments in vm/qemu 2015-10-15 17:59:01 +02:00
Dmitry Vyukov
874c5754bb initial commit 2015-10-12 10:16:57 +02:00