aboutsummaryrefslogtreecommitdiffstats
path: root/vm
Commit message (Collapse)AuthorAgeFilesLines
* vm/cuttlefish: add vm type for cuttlefish on gcekalder2022-04-052-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm/cuttlefish: add vm type for cuttlefish on gce This new VM type embeds the existing 'gce' type to start an instance and then run a Cuttlefish Android VM on it using the 'launch_cvd' binary installed on it. This requires us to make a few fields on the 'gce' type visible so that 'cuttlefish' can set them when starting the instance. The remaining functionality (SSH forwarding, file copying, and running commands on the nested Android VM will be in following changes. For more information on Cuttlefish, see: https://source.android.com/setup/create/cuttlefish https://android.googlesource.com/device/google/cuttlefish/ * vm/cuttlefish: add vm type for cuttlefish on gce This new VM type embeds the existing 'gce' type to start an instance and then run a Cuttlefish Android VM on it using the 'launch_cvd' binary installed on it. This requires us to make a few fields on the 'gce' type visible so that 'cuttlefish' can set them when starting the instance. The remaining functionality (SSH forwarding, file copying, and running commands on the nested Android VM will be in following changes. For more information on Cuttlefish, see: https://source.android.com/setup/create/cuttlefish https://android.googlesource.com/device/google/cuttlefish/ * vm/cuttlefish: add vm type for cuttlefish on gce This new VM type embeds the existing 'gce' type to start an instance and then run a Cuttlefish Android VM on it using the 'launch_cvd' binary installed on it. This requires us to make a few fields on the 'gce' type visible so that 'cuttlefish' can set them when starting the instance. The remaining functionality (SSH forwarding, file copying, and running commands on the nested Android VM will be in following changes. For more information on Cuttlefish, see: https://source.android.com/setup/create/cuttlefish https://android.googlesource.com/device/google/cuttlefish/ * vm/cuttlefish: fix missed log.Logf(0 call to log.Logf(1 * vm/cuttlefish: remove unneeded log.Logf() calls These logging for Count() isn't terribly useful since it's a single-line call with very simple logic. For the unimplemented methods the log lines have limited utility since they're already returning error messages which will get logged.
* all: use `t.TempDir` to create temporary test directoryEng Zer Jun2022-03-281-7/+1
| | | | | | | | | This commit replaces all `ioutil.TempDir` with `t.TempDir` in tests. The directory created by `t.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* vm/gce: enable display device configurationAleksandr Nogikh2022-03-221-8/+10
| | | | Now we always enable it, make this configurable for GCE instances.
* vm/qemu/qemu.go: changed deprecated nowait option to preferred wait=offAdam Goska2021-12-201-1/+1
| | | | | | Invoking qemu with the nowait option produces a warning that the short-form boolean options are deprecated and that wait=off is preferred.
* syz-verifier: fix VM reboot every 5 minutes (#2923)Taras Madan2021-12-151-1/+1
| | | | Current state: every 5 minutes VM reboots. Fix: signal "executing program" to monitor to prevent this reboot.
* vm/qemu: handle QMP eventsAlexey Kardashevskiy2021-10-221-4/+17
| | | | | | | | | | | | QEMU occasionally sends events in the same stream used for QMP commands so from time time the received packet is not a QMP reponse but a QMP event which breaks the parser. For example, events are send when a machine state changed. This adds basic support for event. For now we skip them and wait until the expected QMP command response arrives. Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* vm/adb: unlink symlinks before calling rmMax Spector2021-10-201-2/+6
| | | | rm fails if a symlink exists but points to a nonexistent location.
* vm/adb: add localhost to ip regex of deviceHuizi Yang2021-10-141-2/+2
| | | | remote_device_proxy uses localhost for Android WFH connection.
* vm/gce: allow ssh-rsa from Run()Aleksandr Nogikh2021-09-301-0/+2
| | | | Allow ssh-rsa not only from getSerialPortOutput(), but also from Run().
* vm/gce: avoid ssh-rsa for user, for now allow it as host-keyGreg Steuck2021-09-301-1/+4
| | | | | | | | | | | | | | | | | OpenSSH 8.8 release disables RSA signatures using the SHA-1 hash algorithm by default. Sadly, the ssh-serialport.googleapis.com:9600 uses the deprecated algorithm for host-key. The end-point identifies itself as: debug1: Remote protocol version 2.0, remote software version Go debug1: no match: Go ... debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ssh-rsa This should be fixed on the server side, but for now I added a workaround of enabling this deprecated algorithm.
* vm/qemu: fix nil deref in qmpDmitry Vyukov2021-09-291-2/+2
| | | | | | | | | | | | | | | | | | | A user has reported the following crash: panic: runtime error: invalid memory address or nil pointer dereference goroutine 1021 [running]: github.com/google/syzkaller/vm/qemu.(*instance).qmp() vm/qemu/qmp.go:96 +0x1c9 github.com/google/syzkaller/vm/qemu.(*instance).hmp() vm/qemu/qmp.go:115 +0xbd github.com/google/syzkaller/vm/qemu.(*instance).Diagnose() vm/qemu/qemu.go:662 +0x18d qmp function accesses resp even if doQmp returns an error and doQmp can return a nil resp in this case if inst.monEnc.Encode fails. Don't access resp if error is returned. The only caller hmp does not use the returned object is an error is returned.
* vm/gce: adjust log level for timeout errorsAleksandr Nogikh2021-09-291-2/+2
| | | | | | These messages are of relevance to debugging problems on syz-ci's side, but due to log level 1 they are not saved to logs by default. Set their log level to 0.
* vm/adb: support both old and new device formatHuizi Yang2021-09-102-7/+37
|
* vm/vmimpl/console: tail to kernel log to get serial outputHuizi Yang2021-09-102-24/+28
|
* vm/adb: add new adb device format and console impl for CuttlefishHuizi Yang2021-09-101-10/+58
|
* vm/qemu: add apple_smc_osk and efi_{code,vars}_device optionsPatrick Meyer2021-09-031-2/+26
| | | | This way users don't have to overwrite qemu_args in their configs.
* vm/adb: invoke waitForSSH right after the `root` commandAleksandr Nogikh2021-08-311-2/+1
|
* vm/adb: mount debugfs on Android if it is not mountedMax Spector2021-08-311-0/+11
| | | | | On Android 12+ debugfs gets unmounted after boot. This remounts it as part of reset.
* all: use entire log to detect reports to suppressAleksandr Nogikh2021-08-061-8/+8
| | | | | | | | | | Currently syzkaller only applies its suppressions regexps to the oops message itself and a small number of its preceding bytes. A case has been reported (#2685), where it was important to analyse a bigger portion of output data. Pass the whole log and a starting position to the `Report.Parse` method separately instead of passing an already cut log there. Adjust use cases of the `Report.Parse` method to handle its new behavior.
* pkg/report: separate reporter wrapper from OS-specific implementationsAleksandr Nogikh2021-08-061-2/+2
| | | | | | | | | | | | | Currently a number of report post-processing activities are implemented as a decorator over the interface that defines OS-specific implementations. Following exactly the same interface is too restrictive in this case as adding extra parameters to the post-processing forces the developer to adjust all implementations thay may not need these parameters at all. Untie the wrapper from the Reporter interface. Use a package-private reporterImpl interface for the OS-specific implementations, while having an exported Reporter structure. Make sure that Reporter is stored and passed as a pointer.
* pkg: update generated files to go 1.17Alexey Kardashevskiy2021-07-074-0/+4
| | | | | | | | | | | "make generate" produces this diff when go 1.17 (go1.17-c95464f0ea3f==upstream) is used. Seems compatible with >=1.16. https://github.com/golang/go/commit/4d2d89ff42ca documents the syntax. https://github.com/golang/go/commit/eeadce2d8713 enforces "ignore" for unsatisfiable tags hence the pkg/csource/gen.go change. Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
* vm/gvisor: stop instances properly (#2624)Andrei Vagin2021-06-151-2/+14
| | | | | | | Let's stop instances with "runsc kill" instead of killing sandbox processes. This will guarantee that ongoing rpc calls will not fail with unexpected errors. Reported-by: syzbot+084fca334720887441e7@syzkaller.appspotmail.com
* vm/qemu: initial darwin supportPatrick Meyer2021-06-091-0/+7
|
* vm/qemu: stop using deprecated -chardev server=on short formPatrick Meyer2021-06-091-1/+1
| | | | | | | Qemu emits the following message when using the short form: warning: short-form boolean option 'server' deprecated -chardev", fmt.Sprintf("socket,id=SOCKSYZ,server=on
* vm/adb: add repair_script before adb availableJoey Jiao2021-04-141-10/+25
| | | | The repair script can bring the device out of crash mode.
* vm/adb: add startup_script configJoey Jiao2021-04-144-45/+65
|
* vm/adb: add flag to avoid adb reboot for testJoey Jiao2021-03-201-9/+17
|
* vm/qemu: remove panic_on_warn/kvm/etc cmdline argsDmitry Vyukov2021-03-181-39/+14
| | | | | | | | | Don't pass cmdline arguments that are not needed for basic operation. We used to enforce too many cmdline args that are really up to user. Users may not want panic_on_warn, or KVM configuration is really up to user (should be setup the way it's setup in real targets of interest). Leave all these args to user. CONFIG_CMDLINE is the right way for user to configure default args.
* vm/qemu: provide info about qemu version/argsDmitry Vyukov2021-03-183-0/+33
|
* Revert "all: add KernelModule cfg to show DLKM coverage"Dmitry Vyukov2021-03-051-1/+0
| | | | This reverts commit 69a06ca2b532ff4021a43fdead4e2ac1452a44c0.
* all: add KernelModule cfg to show DLKM coverageJoey Jiao2021-03-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PC returned for dynamic loaded module (DLKM) is not parsed in coverage page. So the commit is to use DLKM modules' load address to restore the PC and show coverage data of DLKM. As the load address is written in cfg file, so kaslr needs to be disabled. And for linux target, load address is getting from /proc/modules during instance setup. For either manual or auto address setting case, name and path are needed in config kernel_modules, where name is module name on target. path is module unstripped object path on host. addr is decimal value of module load address on target. Example of config: "kernel_modules": [ { "name": "nf_nat", "path": "/usr/src/linux-source/net/netfilter/nf_nat.ko", "addr": 18446744072637911040 } ]
* vm/qemu: improve parameter descriptionsDmitry Vyukov2021-03-051-15/+25
| | | | | For context see: https://groups.google.com/g/syzkaller/c/NBCGPtkMTWs/m/jVZnTnWcAgAJ
* vm/qemu: restrict network accessDmitry Vyukov2021-02-083-42/+47
| | | | | | | Restrict access to the external network from within the VM and access to VM SSH to local interface only. Fixes #332
* vm/gce: change how GCE ssh magic is enabledDmitry Vyukov2021-01-291-1/+1
| | | | | | We used to use empty ssh key as indication to use the GCE magic, but this conflicts with using no ssh key at all (empty password). Use string "GCE" instead to enable GCE magic.
* vm: scale "wait for output" timeoutDmitry Vyukov2021-01-051-1/+1
| | | | | | Significant portion of oopses with qemu emulation gets truncated. Hard to say if we don't wait long enough or there is something else, but scaling "wait for output" timeout seems reasonable regardless.
* vm/qemu: fix arm qemu argsDmitry Vyukov2020-12-301-6/+19
| | | | | ARM only supports virtio-net-device and virtio-rng-device and the new way of passing image file.
* vm/qemu: scale ssh timeoutDmitry Vyukov2020-12-293-21/+26
| | | | Increase ssh wait timeout according to the target slowdown.
* all: make timeouts configurableDmitry Vyukov2020-12-282-19/+18
| | | | | | Add sys/targets.Timeouts struct that parametrizes timeouts throughout the system. The struct allows to control syscall/program/no output timeouts for OS/arch/VM/etc. See comment on the struct for more details.
* vm: declare executingProgram vars simplerDmitry Vyukov2020-12-252-11/+9
| | | | We don't need indirection via strings to declare executingProgram var.
* pkg/mgrconfig: move derived fields into separate structDmitry Vyukov2020-11-301-5/+7
| | | | | | Users should not be concerned with the internal derived fields. Move all derived fields into a separate struct before adding more. This leaves config.go as a better documentation for end users.
* vm/qemu, vm/gce: dump LOCKDEP state in DiagnoseDmitry Vyukov2020-11-213-10/+60
| | | | | For context see the discussion at: https://groups.google.com/g/syzkaller/c/ruwaYUvwHTw/m/E9Cg9OfvAgAJ
* vm: pass Report to DiagnoseDmitry Vyukov2020-11-2112-38/+60
| | | | | | | | | The way to diagnose generally depends on the issue. E.g. do we need register dump to debug this issue? Do we need host dmesg dump? Some diagnosis may be directly specific to a particular problem (e.g. dumping a particular debugfs/procfs file). Pass Report to Diagnose to make this possible.
* vm: remove code duplication in MonitorExecutionDmitry Vyukov2020-11-211-26/+12
| | | | | | The "no output" handling mostly duplicates extractError logic (with open-coded report.VMDiagnosisStart). Deduplicate this logic.
* vm/qemu: use virtio-rng-ccw on s390x archAlexander Egorenkov2020-10-311-1/+5
| | | | | | | | | | | | MSI-X support is mandatory for any PCI device on s390x but virtio-rng-pci doesn't support it. Fixes the following error on s390x: qemu-system-s390x: -device virtio-rng-pci: MSI-X support is mandatory in the S390 architecture The problem was introduced in commit 36e8b020 ("vm/qemu: enable virtio-rng-pci"). Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
* vm/vmware: improve kernel log collection and VM managementRadoslav Gerganov2020-10-301-26/+16
| | | | | | | | | | * Collecting kernel logs with dmesg over ssh doesn't work well and sometimes we miss call traces when a crash occurs. Getting the kernel log from a virtual serial port is much more effective. * Creating linked clone VMs is faster then full clone VMs but it requires snapshot management and this will bring more complexity to syzkaller. Keep it simple and create full clone VMs for now. * Use host-only networking because the VM gets its IP faster that way
* vm/qemu: enable virtio-rng-pciDmitry Vyukov2020-10-291-0/+1
| | | | | Can help with entropy initialization during boot and can be tested as /dev/hwrng as well.
* vm/qemu: default target dir to /Dmitry Vyukov2020-10-291-40/+32
| | | | | Everybody except for fuchsia use /. Does not make sense to repeat for everybody.
* vm/bhyve: add config variable cputigergao992020-10-271-1/+3
| | | | Add a new configuration variable to specify number of bhyve VM vCPUs
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-264-9/+12
| | | | | | | | | | | | We use strings to identify OS/Arch. These strings are duplicated throughout the code base massively. golangci-lint points to possiblity of typos and duplication. We already had to define these names in pkg/csource and disable checking for prog package. A future change triggers such warnings in another package. Add OS/Arch name consts to sys/targets so that they can be used to refer to OS/Arch. Use the consts everywhere.
* vm/qemu: fix {{TCP_PORT}} replacementDmitry Vyukov2020-10-261-1/+4
| | | | | | | compiler says: vm/qemu/qemu.go:501:49: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)