Commit Graph

229 Commits

Author SHA1 Message Date
Dmitry Vyukov
7dcaeaf322 vm/gce: close old consolew in Run
Run can be executed several times on a VM.
2018-12-02 13:23:51 +00:00
Greg Steuck
7a0edfbe7c vm/gce: use openbsd console diagnostic code for both vmm and gce
* openbsd: use console diagnostic code for both vmm and gce.

* gometalinter wants less indentation and more stuff in scope

* Comment no longer applies
2018-12-02 13:22:10 +00:00
Michael Tüxen
271b354c51 vm/qemu: improve debug output
* vm/qemu: Improve debug output.

When running in debug mode, the number of VMs is reduced to 1.
State this in the debug output.

* vm/qemu: Don't start debug output with a capital letter.

As requested by Dimitry.

* vm: Provide debug message when reduing number of VMs.

Apply this change to all affected platforms for consistency.
Suggested by Dmitry.

* Add myself to AUTHORS/CONTRIBUTORS files.

* vm: Fix compilation issues missed in earlier commit.

* vm: Use logging to write debug message.
2018-11-30 17:12:03 +00:00
Michael Tuexen
ade12e9162 vm/qemu: Allow empty qemu-args.
Allow setting qemu_args to "" in the config file. This is needed
when running qemu from the qemu-devel package on FreeBSD, which
does not support the -enable-kvm option.
Without this patch, an entry "" is added to the list of command
line parameters, which breaks the starting of the qemu instances.
2018-11-30 13:12:57 +00:00
Greg Steuck
6419afbb77 openbsd: run on gce
* build/openbsd: minor cleanup (use tuples instead of maps)

* Grammar nits in comments.

* Simplify openbsd.Create, will defer when there's more than one error exit.

* pkg/build: Support copying kernel into GCE image

* Simple test for openbsd image copy build.

* Cleanup in case something failed before.

* Support multi-processor VMs on GCE.

* More debug

* Reformat

* OpenBSD gce image needs to be raw.

* GC

* Force format to GNU directly on Go 1.10 or newer.

* Use vmType passed as a parameter inside openbsd.go

* gofmt

* more fmt

* Can't use GENERIC.mp just yet.

* capitalize

* Copyright
2018-11-27 13:14:06 +01:00
Greg Steuck
5bb36a9ef8 openbsd: include process information into crashes 2018-11-21 05:52:48 +01:00
Anton Lindqvist
f5e275d1d9 vm/vmm: make sure to always end ddb commands with a newline
Missed one in my previous commit.
2018-11-15 14:28:30 -08:00
Anton Lindqvist
74dbb80644 vm/vmm: disable pagination and show panic in Diagnose()
The ddb(4) debugger defaults to showing 24 lines at a time, the next chunk of
lines will be displayed only after receiving keyboard input. Setting maxlines to
0 disables pagination completely.
2018-11-12 12:03:13 -08:00
Dmitry Vyukov
6d8b3311b9 vm/qemu: don't use e1000 on arm64
arm64 uses virtio net by default and does not support e1000.
So don't override the default and use e1000 only for 386/amd64.
2018-10-28 19:07:22 +01:00
Dmitry Vyukov
75f4f60336 vm/qemu: use -cpu host,migratable=off
This exposes the maximum amount of features to the guest.
migratable=off exposes features that qemu does not know about too.
2018-10-28 19:07:22 +01:00
Nicolas Lacasse
d257b2d2d8 Pass -debug flag to runsc.
As of commit 3f053259, gVisor sentry panics are no longer sent to the
stderr for "runsc run" by default, as that stderr belongs exclusively to
the application.

As a result, syzbot never sees the gVisor panic stack trace, and is only
reporting errors that occur when waiting for a dead sandbox.

Passing the "-debug" flag to runsc will make the sentry panics visible
to syzbot again.
2018-10-17 21:43:37 +02:00
Anton Lindqvist
4b94574dd4 vm/vmm: use derived disks for VMs
As a result, the boot time is significantly improved since there's no longer any
need to copy the complete disk.

This feature was recently committed to OpenBSD-current. Any existing base image
used must be recreated, this time using the qcow2 disk format.
2018-10-11 19:47:20 +02:00
Dmitry Vyukov
2d41b5d964 vm/vmm: recover from vmctl errors faster
vmctl start periodically fails with:
	vmctl: start vm command failed: Operation already in progress

So try to sleep for a bit after vmctl stop.
And detect when vmctl start terminates prematurely
to avoid 10 minute timeout for ip extraction.
2018-09-20 19:44:50 +02:00
Dmitry Vyukov
565a5452a1 vm/vmm: don't start separate process for console
vmctl console fails from time to time with:

vmctl: console not found

Probably there is some race (most of these things assume
that there is a human typing commands with delays).

Also, vmctl start can connect to console itself with -c flag.
So use that because it both solves the console race and
also makes code much more similar to other VM implementations (qemu, gvisor).
This also eliminates 3 additional goroutines per VM.
2018-09-20 14:54:07 +02:00
Dmitry Vyukov
23db2ea6f9 vm/vmm: fix fd leaks
Close pipe fd's on failure paths.
Don't close outr because OutputMerger closes all passed in fd's.
2018-09-20 14:54:03 +02:00
Dmitry Vyukov
88f20b7bcc vm/vmm: increase timeouts
A dozen of vmm's running on a GCE machine can be really slow to boot.
Timeouts have only single goal: preventing complete system stalls
when/if external commands episodically hang. There is no value
in keeping them as close as possible to expected durations.
This can only lead to various flakes. Increase timeouts by an
order of magnitude.
2018-09-20 14:53:59 +02:00
Dmitry Vyukov
d1086008f6 vm/vmm: properly shutdown output reading goroutine
The goroutine sends on bootOutputStop to notify about its completion,
but the main goroutine is not receiving from the chan on success
and since the chan in unbuffered, the output reading goroutine
hangs on the send forever.
2018-09-20 14:53:56 +02:00
Dmitry Vyukov
3af0330c9e vm/vmm: make more robust after restarts
Instances from the previous run can still be running,
so always stop the previous instances before starting new ones.
2018-09-20 14:53:52 +02:00
Dmitry Vyukov
1c10e8337a vm/vmm: don't prefix vm name with syzkaller
I am getting:
failed to run vmctl -name syzkaller-ci-openbsd-main-test-0
vmctl: name too long

The name is auto-generated from parts which ensure that it is unique.
We can't easily name it shorter. So strip the syzkaller prefix,
which is not strictly necessary.
2018-09-20 14:53:48 +02:00
Dmitry Vyukov
845e8c5895 vm/vmm: remove cpu parameter, make template optional
CPU is not used. Remove it.
Template is not strictly necessary. Make it optional.
2018-09-20 14:53:44 +02:00
Dmitry Vyukov
a6a09fb2a0 vm/vmm: increase maximum number of VMs
8 is way too low. A modern beefy machine can host a hundred of VMs freely.
Make the limit consistent for all of qemu/kvm/gvisor/vmm and set it to 128.
2018-09-20 14:53:40 +02:00
Dmitry Vyukov
7819680a0b vm/vmm: enable network
Without -L local interface vio0 is not enabled
and we can't connect to the machine.

Update #712
2018-09-17 10:51:00 +02:00
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
ec887defaf vm/gvisor: use new signal-based diagnose
Presumably "debug -stacks" sometimes fails to actually dump stacks (some runtime hangs?).
Use new mechanism that just sends a signal.
2018-08-29 18:32:26 -07:00
Anton Lindqvist
14b78b9701 vm/vmm: fix IP address detection
The IP address of a VM is calculated based on the formula 100.64.X.3 where X
being the ID of the VM, starting from 0. After starting 256 VMs 64 will flip
over to 65 and so on. A more robust solution to calculating the IP is to simply
read it from output during boot.

While here, stop using the VM ID as the identifier since the VM name also works.
2018-08-29 13:31:38 -07:00
Anton Lindqvist
de20bcbb68 vm/vmm: support for vmm found on OpenBSD (#678)
vm/vmm: add vmm implementation found on OpenBSD
2018-08-18 13:06:44 -07:00
Dmitry Vyukov
f557fcdfa6 vm/gvisor: fix current binary lookup
os.Args[0] can be just binary name which was looked up using $PATH.
In such case copy will fail because the path does not exist.
Lookup binary name using $PATH.
2018-08-03 21:08:11 +02:00
Dmitry Vyukov
28e60b2339 vm/gce: move console check into separate function
Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
fbedd425b5 pkg/mgrconfig: move from syz-manager/mgrconfig
mgrconfig was used only by syz-manager initially,
but now it's used by a dozen of packages and it's
weird to import from under a binary dir.
pkg/ is much more reasonable dir for a widely used
helper package.
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
2e17e2c0ad vm: refactor MonitorExecution
Too complex. Split into several functions.

Update #538
2018-08-02 16:57:31 +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
Dmitry Vyukov
0824d7a1bf vm/gce: fix build
fail
2018-07-29 10:16:20 +02:00
Dmitry Vyukov
419000cc0a vm: fix "kill fuzzer on first kernel bug"
The problem with that commit is that for GCE implementation
we immidiately kill console connection too when receive diagnose signal.
This leads to truncated output.
2018-07-29 10:07:30 +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
beb957b793 vm/qemu, vm/gce: kill fuzzer on first kernel bug
Some kernel bugs don't stop kernel.
For such bugs whiel vm.MonitorExecution waits for kernel output for 10 secs,
fuzzer continues running programs and produces tons of output
after the kernel bug message. Kill fuzzer once MonitorExecution
detects a kernel bug.
2018-07-24 13:44:48 +02:00
Dmitry Vyukov
a0512a53a3 vm/qemu: use e1000 instead of e1000e
e1000e fails on recent Debian distros with:
Initialization of device e1000e failed: failed to find romfile "efi-e1000e.rom
2018-07-23 20:28:18 +02:00
Dmitry Vyukov
e9da9436ad vm: fix "no output" detection
We obviously need ticker instead of timer in MonitorExecution.
2018-07-08 22:52:24 +02:00
Dmitry Vyukov
8c2335a205 vm/vmimpl: factor out common code for ssh args and waiting for ssh
Move common code from 4 vm implementations to vmimpl.
2018-07-06 14:02:06 +02:00
Dmitry Vyukov
d3b2a0e212 dashboard/config: tune kernel timeouts
See #516 for description of the problem.

The new scheme is:

1. RCU stalls the highest priority.
CONFIG_RCU_CPU_STALL_TIMEOUT=100
which results in stalls detected after 100-101 secs.

2. Then softlockup detector.
kernel.watchdog_thresh = 55 (sysctl)
which surprisingly detects stalls after 110-132 secs.

3. Then hung tasks and workqueue stalls.
Unfortunately we can't separate them because that would
require setting "no output" timeout to 10+ minutes.
workqueue.watchdog_thresh=140 (cmdline)
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=140
Both are detected after 140-280 secs.

4. Finally, "no output" crashes.
Detected by vm.MonitorExecution after 300 secs.

Fixes #516
2018-07-05 17:43:41 +02:00
Dmitry Vyukov
be77c6967a vm/gvisor: enable watchdog panic
We need it to crash to detect hangs.
2018-07-05 17:41:06 +02:00
Dmitry Vyukov
ea88000dd9 vm/qemu: add akaros support 2018-07-05 13:12:39 +02:00
Dmitry Vyukov
3e16f33c65 vm: suppress "no output" and "lost connection" reports 2018-06-30 14:51:07 +02:00
Dmitry Vyukov
e2f6c7543e vm: simplify MonitorExecution
Simplify "no output" detection logic.
Don't allocate byte slices on every iteration.
2018-06-30 14:47:20 +02:00
Dmitry Vyukov
89d2e60023 vm/gvisor: fix empty runsc_args 2018-06-22 20:50:19 +02:00
Dmitry Vyukov
bf0a1af0cb vm/gvisor: always give vm all caps
runsc can crash on nil deref without any caps.
So give all of them all the time.
2018-06-22 19:56:39 +02:00
Dmitry Vyukov
39a5713d72 vm/gvisor: allow specifying arbitrary runsc flags 2018-06-22 19:00:12 +02:00
Dmitry Vyukov
412bfd3c58 vm/gvisor: use timeout for all runsc invocations
runsc likes to hang dead. Add timeouts to all invocations.
2018-06-22 18:37:02 +02:00
Dmitry Vyukov
2a075d57ab pkg/report: allow to specify suppressions per OS
Currently all (linux-specific) suppressions are hardcoded in mgrconfig.
This is very wrong. Move them to pkg/report and allow to specify per OS.
Add gvisor-specific suppressions.
This required a bit of refactoring. Introduce mgrconfig.KernelObj finally.
Make report.NewReporter and vm.Create accept mgrconfig directly
instead of passing it as multiple scattered args.
Remove tools/syz-parse and it always did the same as tools/syz-symbolize.
Simplify global vars in syz-manager/cover.go.
Create reporter eagerly in manager. Use sort.Slice more.
Overall -90 lines removed.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
c31f96a8c6 executor: rework fallback coverage
We have fallback coverage implmentation for freebsd.
1. It's broken after some recent changes.
2. We need it for fuchsia, windows, akaros, linux too.
3. It's painful to work with C code.

Move fallback coverage to ipc package,
fix it and provide for all OSes.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
14e6c472f5 vm/gvisor: add package
gvisor package provides support for gVisor, user-space kernel, testing.
See https://github.com/google/gvisor
2018-06-22 16:40:45 +02:00