Commit Graph

42 Commits

Author SHA1 Message Date
Dmitry Vyukov
a54c2b7b92 syz-ci: de-hardcode list of VMs that support overcommit
We currently have this list in multiple places (somewhat diverged).
Specify this "overcommit" property in VM implementations.
In particular, we also want to allow overcommit for "vmm" type.

Update #712
2018-09-11 15:33:45 +02:00
Dmitry Vyukov
c67a9331a4 gometalinter: clean up some errcheck warnings
Check some errors where relevant.
Unfortunately enabling errcheck does not look feasible, too many warnings.

Update #538
2018-08-02 16:57:31 +02:00
Zach Riggle
0889ba7a79 adb: Add console logic for ttyUSB.serial
By using UDEV rules, we can create device nodes which exist at

	/dev/ttyUSB.{android device serial}

Which makes it easier to determine which console belongs to a device.

While this is non-standard behavior, it's an inexpensive path check
and makes the lookup faster and deterministic.
2018-07-26 20:13:37 +02:00
Dmitry Vyukov
d3bbcc35ee vm/vmimpl: add vm.Diagnose method
Diagnose is called on machine hang to try to get
some additional diagnostic information from it.
For now it's all stubs.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
0f0e5db62d vm/adb: don't fail if port 35099 is busy 2018-06-11 16:47:12 +02:00
Billy Lau
75b2448a26 vm/adb: disable kptr_restrict for Android
echo 0 to kptr_restrict in /proc/sys/kernel to unhide
kernel pointers when fuzzing for more reliable crash
dedup and easier debugging when analyzing crash.
2018-05-16 10:33:18 +02:00
Dmitry Vyukov
9e0846e8a4 all: get rid of underscores in identifiers
Underscores are against Go coding style.

Update #538
2018-05-07 17:59:06 +02:00
Dmitry Vyukov
037b77dc65 vm/{adb,isolated}: dudup common code
Found with gometalinter/dupl.

Update #538
2018-05-06 14:24:42 +02:00
Dmitry Vyukov
78b251cbd7 all: fix too long lines
Not sure why I have not seen warnings about
these lines on another machine...
2018-05-05 16:00:01 +02:00
Dmitry Vyukov
9fe5658a1b gometalinter: check dot imports
Update #538
2018-05-03 14:41:34 +02:00
Jean-Baptiste Théou
52643b4414 adb: add debug level to ALERT for UART detector
The UART output may filter lower level messages.
This ensure proper detection of the unique ID

Signed-off-by: Jean-Baptiste Théou <jb@essential.com>
2018-04-18 09:26:01 +02:00
Dmitry Vyukov
36d1c4540a all: fix gometalinter warnings
Fix typos, non-canonical code, remove dead code, etc.
2018-03-08 18:48:26 +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
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
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
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
23b94422d3 pkg/log: move from log 2017-06-03 10:41:09 +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
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
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
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
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
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
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
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
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
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
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
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
8cff5843fb vm/adb: use a more reliable way to reboot devices 2016-01-20 13:58:57 +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