Commit Graph

60 Commits

Author SHA1 Message Date
Dmitry Vyukov
503fd5b2f7 .golangci.yml: enable whitespace checker
Points to bad empty lines very precisely.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
d60b9c6b0e vm/vmimpl: refactor DiagnoseFree/OpenBSD
Make signatures of these functions match vm.Diagnose.
Both more flexible, less code, more reasonable.
2020-03-21 16:08:02 +01:00
Andrew Turner
b24d2b8a21 vm: Get debug information when FreeBSD on panics (#1470)
The FreeBSD kernel debugger can provide more information when the
kernel panics. Add support to bhybe and gce to print this information.
2019-10-21 14:25:55 +02:00
Dmitry Vyukov
742f448304 vm/gce: allow non-preemptible VMs
We are seeing some flakes during bisection and image testing.
Hard to tell what's the root cause because they are episodic.
But using non-preemptible VMs for bisection and image testing
looks good on all fronts.

Update #501
2019-03-28 13:22:37 +01:00
Dmitry Vyukov
c298c98302 vm/qemu: detect boot errors faster
Currently we try to ssh into the machine for 10 minutes
even if it crashed right away. Make qemu exit on kernel panic
and stop ssh'ing when qemu exits.
Handling bad kernels fast is actually important for bisection.

Update #501
2019-03-17 18:06:44 +01:00
Dmitry Vyukov
fea4b504d8 vm/vmimpl: produce better error in WaitForSSH
Currently we squash VerboseError which leads to too lengthy build error titles.
Handle verbose error more carefully.
2019-01-24 18:56:19 +01:00
Michael Pratt
2fc01104d0 vm: allow Diagnose to directly return diagnosis
Rather than writing the diagnosis to the kernel console, Diagnose can
now directly return the extra debugging info, which will be appended ot
the kernel console log.
2018-12-21 18:08:49 +01:00
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
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
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
28e60b2339 vm/gce: move console check into separate function
Update #538
2018-08-02 16:57:32 +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
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
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
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
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
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
a630fd8b41 gometalinter: some fixes for unparam
But we still can't enable it as there are more [uninteresting] warnings.

Update #538
2018-05-03 15:48:26 +02:00
Dmitry Vyukov
9fe5658a1b gometalinter: check dot imports
Update #538
2018-05-03 14:41:34 +02:00
Dmitry Vyukov
39302300d9 gometalinter: check unkeyed composite literals
Update #538
2018-05-03 14:01:48 +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
64482eb948 pkg/gce: use current instance network
The current instance is not necessary in the default network.
2018-02-27 11:58:41 +01:00
Dmitry Vyukov
376f424e08 vm/gce: connect to instances by ip
Don't connect by hostname, this seems to be broken on GCE.
Episodically connecting by hostname gives:

Could not resolve hostname: Name or service not known
2017-12-27 09:18:26 +01:00
Dmitry Vyukov
d9c79f8842 vm/gce: always ignore serial relay errors
GCE serial reply seems to be buggy, we see lots of "serialport: VM disconnected"
and "packet_write_wait: Connection to 1.2.3.4 port 9600: Broken pipe"
errors, which do not have any explanation.
Ignore all serial relay errors.
2017-12-05 20:08:06 +01:00
Dmitry Vyukov
5153aeaffd syz-ci: test images before using them
Boot and minimally test images before declaring them as good
and switching to using them.

If image build/boot/test fails, upload report about this to dashboard.
2017-11-30 14:50:50 +01:00
Dmitry Vyukov
31af2ce022 vm/gce: fix boot output capture
Turns out GetSerialPortOutput API does not work if instance has
serial port connections enabled (which we always have).
Get output from serial port relay service instead.
2017-11-22 17:56:48 +01:00
Dmitry Vyukov
2d24bbb225 vm/gce: fix nil deref
New console output code crashes with nil deref,
because we shadow outer err variable and then
dereference nil err.

Also express ssh connect timeout in real time.
Currently the timeout is on par of ~25 mins
(5s sleep + 10s connect timeout) * 100.
Reduce timeout to 5m of real time.
2017-11-20 11:57:42 +01:00
Dmitry Vyukov
9badd05327 vm/gce: provide VM console output on boot failures
"can't ssh into the instance" is not a very useful error.
2017-11-19 12:29:00 +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
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
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
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
ed1e09a88a vm/gce: support debug mode
Print ssh/console output to stdout in debug mode.
2017-06-30 14:32:17 +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
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
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
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