Commit Graph

101 Commits

Author SHA1 Message Date
Tobias Klauser
f5b2c665da vm/qemu: add support for linux/riscv64
Since the qemu riscv64 port does not work with the default -net nic
parameter, add support to use in the modern way of specifying network devices
to qemu, i.e. -device virtio-net-device,netdev=0 -netdev user,id=net0,host=...

The same applies for the -hda qemu option. Provide a way to use the
modern way of specifying image devices as well.

Other/new ports may use these options as well in the future by setting
UseNewQemuNetOptions and/or UseNewQemuImageOptions.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-27 15:04:27 +02:00
Alexander Egorenkov
aea82c003a sys/linux: first 64bit big-endian architecture s390x
* mmap syscall is special on Linux s390x because
  the parameters for this syscall are passed as a struct
  on user stack instead of registers.
* Introduce the SyscallTrampolines table into targets.Target
  to address the above problem.
* There is a bug in Linux kernel s390x which causes QEMU TCG
  to hang when KASAN is enabled. The bug has been fixed
  in the forthcoming Linux 5.8 version. Until then do not enable
  KASAN when using QEMU TCG, QEMU KVM shall have no problems with
  KASAN.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-25 23:08:45 +02:00
Jouni Hogander
07bfd71dac Implement basic support for MIPS64LE
Add basic stuff to enable MIPS64ELR2 target:
 - build
 - make extract
 - make generate
 - qemu execution
 - system call parsing from /proc/kallsyms
2019-12-17 11:10:52 +01:00
Dmitry Vyukov
a2d178996b vm: add workdir_template functionality
The new manager config argument workdir_template refers to a directory. Optional.
Each VM will get a recursive copy of the files that are present in workdir_template.
VM config can then use these private copies as needed. The copy directory
can be referenced with "{{TEMPLATE}}" string. This is different from using
the files directly in that each instance will get own clean, private,
scratch copy of the files. Currently supported only for qemu_args argument
of qemu VM type. Use example:
Create a template dir with necessary files:
$ mkdir /mytemplatedir
$ truncate -s 64K /mytemplatedir/fd
Then specify the dir in the manager config:
	"workdir_template": "/mytemplatedir"
Then use these files in VM config:
	"qemu_args": "-fda {{TEMPLATE}}/fd"
2019-12-03 18:48:14 +01:00
Dmitry Vyukov
b5c36524a2 sys/targets: add HostFuzzer flag
Move HostFuzzer from vm/qemu.
It's needed in a number of other packages
and strictly saying is not specific to qemu
(it just happened that both fuchsia and akaros only support qemu).
2019-11-16 09:58:54 +01:00
Matthew Dempsky
fd37b39ea8 all: convert Fuchsia to use "host fuzzing" mode
Go support is not a priority for Fuchsia at the moment, so it's
preferable to use host fuzzing mode for Fuchsia like currently done
for Akaros.

This commit basically looks for all the places where there was special
logic for OS=="akaros" and extends the same logic for OS=="fuchsia".
2019-08-27 14:39:18 -07:00
Alexander Popov
6732e2c033 qemu: support advanced hard drive configurations
Currently the 'image_device' config option in qemu.go doesn't properly
support the modern '-drive' argument for describing qemu hard disks.

In fact the various old ways to define qemu drives all boil down to
the common form '-drive if=TYPE,bus=BUS,unit=UNIT,OPTS...'
For example '-hda img' is equivalent to '-drive index=0,media=disk,file=img'.

Let's make the 'image_device' config option support both forms.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
2019-07-15 18:12:29 +03:00
Dmitry Vyukov
e503f048b0 docs: don't duplicate manager config parameters
Currently we have them duplicated in docs/configuration.md
and the actual source in pkg/mgrconfig/config.go.
Documentation is missing in one place or another,
some is outdated, some is phrased slightly differently.
Move all docs to pkg/mgrconfig/config.go and reference it
from docs/configuration.md instead.
2019-05-21 11:47:51 +02: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
d31d239855 vm/qemu: s/Boot/boot/
Make Boot lower-case to not confuse readers that it's somehow exported.
It is not. Pure implementation detail.
2019-03-17 18:06:44 +01:00
Siddharth M
7fa29a5895 pkg/build: added feature to copy kernel image for netbsd
* Modified pkg/build/netbsd.go
1. Made kernel build incremental
2. Added code to copy kernel to disk image

* Fix formating issues

* Fixed basic issues

* Fixed copy kernel to disk
1. Added CPU option to default
2. Added snapshot option to vm/qemu/qemu.go
3. Hacky solution to get the build working

* Fixed issues and added vm.MonitorExecution

* Added sync instead of poweroff
2019-02-22 13:18:44 +01:00
Dmitry Vyukov
f16dce862b vm/qemu: fix default flags for arm/arm64
The console and root that we use are specific for 386/amd64.
arm/arm64 usually use a different console and root device.
Use separate settings for 386/amd64 and arm/arm64.
2019-02-13 15:58:42 +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
Andrew Donnellan
4cdc0f5f6b vm/qemu: Disable VGA on ppc64le
Disable qemu VGA output on ppc64le. The current pseries console code in
the kernel has a bunch of bugs, and if you don't disable VGA syzkaller
won't see console output.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +01:00
Andrew Donnellan
c7d8a8c07b vm/qemu: Enable KVM on ppc64le
ppc64le supports KVM, let's use it.

This obviously won't work on an x86 host, but at present there are issues
using syzkaller on ppc64le with qemu in TCG mode anyway.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-01-15 16:45:20 +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
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
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
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
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
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
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
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
ea88000dd9 vm/qemu: add akaros support 2018-07-05 13:12:39 +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
Dmitry Vyukov
ee885b87a4 vm/qemu: fix 9p for latest distros
9p stopped working on Debian rolling.
Update the init script.
2018-06-11 11:20:55 +02:00
Dmitry Vyukov
0ac1284d5f vm/qemu: fuchsia support
Move most of linux-isms to os/arch configs.
Add proper configs for fuchsia.
2018-06-06 20:45:09 +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
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
ca03d6881a vm/qemu: don't be too clever with cpu configuration
Some machine configurations have strict limits on number of CPUs
and don't support NUMA (e.g. arm vexpress-a15).
maxcpu and numa options make qemu fail.
Don't be too clever. If necessary maxcpu and numa options
can be added in qemu_args.
2018-04-20 20:14:10 +02:00
Dmitry Vyukov
5e6a2eea61 vm/qemu: add image_device config parameter
For some configurations device is "sd" instead of "hda".
2018-04-16 21:44:30 +02:00
Dmitry Vyukov
1bf59f0525 vm: make sshkey argument optional
An image can well be setup without a key.
Just password-less root login.
2018-04-16 21:33:13 +02:00
Dmitry Vyukov
f032e929b9 vm/qemu: don't enable usb/sound by default
Such options can be enabled in qemu_args if necessary.
2018-04-16 21:25:38 +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
1db7a350a9 vm/qemu: respect cpu config parameter
Fixes #42
2017-12-17 11:39:14 +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
eea051f798 vm/qemu: fix up osutil.RunCmd call 2017-11-24 13:41:08 +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
da63ec6526 vm/qemu: support netbsd 2017-10-23 10:19:38 +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
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