aboutsummaryrefslogtreecommitdiffstats
path: root/vm/gce/gce.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/gce: vm/gce: allow specifying instance tags in manager configAlexander Potapenko2026-01-151-2/+3
| | | | | | | | | | | | GCE instance tags can be used for various purposes, such as applying network firewall rules or filtering VMs for scheduling onto specific hosts. To support these use cases, syzkaller needs the ability to set instance tags during VM creation. This patch introduces a new tags field to the gce VM configuration that allows users to specify a list of tags to be attached to GCE instances created by syz-manager.
* vm: add context to Pool.Create()Aleksandr Nogikh2025-10-011-1/+1
| | | | | | | | | | Enable external abortion of the instance creation process. This is especially useful for the qemu case where we retry the creation/boot up to 1000 times, which can take significant time (e.g. it timeouts syz-cluster pods on unstable kernels). The context can be further propagated to WaitForSSH, but that requires another quite significant vm/ refactoring.
* pkg/gce: set GVNIC feature for Compute imagesAleksandr Nogikh2025-08-081-1/+1
| | | | | | Google Cloud cannot automatically infer it from our images, so we need to explicitly set it. The flag is required to create a GVNIC-based GCE instance (the only type for C4A machines).
* vm: func Run accepts contextTaras Madan2025-05-191-3/+2
| | | | It allows to use context as a single termination signal source.
* vm: use SSHOptions instead of 4 paramsTaras Madan2025-03-271-22/+26
| | | | It reduces WaitForSSH parameter count from 9 to 6.
* pkg/gcs: define Client interfaceTaras Madan2025-03-251-1/+1
| | | | | | Some functions are not the struct members now. Some functions deleted. Client mock generated.
* vm: dedup VM count restriction in debug modeDmitry Vyukov2024-11-251-4/+0
| | | | | | | Move the VM count restriction logic info vm package. This avoids lots of duplication, makes it supported for VM types that failed to do this, and allows to unify more VM count logic in future.
* all: pkg/gcs supports AppEngine contextTaras Madan2024-08-121-1/+2
|
* vm: check preemption string only for gce instancesDmitry Vyukov2024-07-231-2/+3
| | | | Fixes #5028
* vmimpl: refactor VM type registrationDmitry Vyukov2024-07-231-1/+4
| | | | | | | | | Pass Type struct directly during registration. This allows to add additional optional parameters to VM types without changing all VM implementations. We we will need to add SupportsSnapshots flag and one flag to resolve #5028. With this change it will be possible to add "SupportsSnapshots: true" to just one VM type implemenetation.
* vm: make Instance implement io.CloserAleksandr Nogikh2024-07-111-3/+7
| | | | It's better to follow standard interfaces.
* vm/gce: use vmimpl.Multiplex()Aleksandr Nogikh2024-07-021-39/+17
| | | | | | It will let us reduce code duplication and use the more appropriate approach to the graceful Run() shutdown - by enforcing a delay between stopping the command and stopping the collection of the console output.
* pkg/rpctype: prepare for not using for target communicationDmitry Vyukov2024-05-031-1/+1
| | | | | | Remove things that are only needed for target VM communication: conditional compression, timeout scaling, traffic stats. To minimize diffs when we switch target VM communication to flatrpc.
* pkg/rpctype: make RPC compression optionalDmitry Vyukov2024-04-031-1/+1
| | | | | | | | RPC compression take up to 10% of CPU time in profiles, but it's unlikely to be beneficial for local VM runs (we are mostly copying memory in this case). Enable RPC compression based on the VM type (local VM don't use it, remove machines use it).
* vm/isolated: allow the use of system-wide SSH configFlorent Revest2024-03-191-4/+4
| | | | | | | | | | | | Most of the VM types tightly manage the target they SSH into and can safely assume that system wide SSH configuration would mess with the SSH flags provided by syzkaller. However, in the "isolate" VM type, one can connect to a host that is not at all managed by syzkaller. In this case, it can be useful to leverage system wide SSH config, maybe provided by a corporate environment. This adds an option to the isolated config to skip some of the SSH and SCP flags that would drop system wide config.
* vm/gce: use regional serial port connectionsAleksandr Nogikh2024-01-231-2/+2
| | | | | | | It's now the recommended approach. Co-authored-by: Alex Tyler <alextyler@google.com> Co-authored-by: Aleksandr Nogikh <nogikh@google.com>
* vm/gce: don't duplicate serial port args generationAleksandr Nogikh2024-01-231-30/+34
| | | | Use a single function instead.
* vm/gce: configure ssh-serialport.googleapis.com credentialsAleksandr Nogikh2024-01-121-3/+20
| | | | | | | | In GCP projects with OS Login, the per-VM keys don't play any role in the authentication. We need to attach an SSH key to a service account and use it to connect to ssh-serialport.googleapis.com. Add two new configuration options to enable that.
* vm/gce: retry GCE initAleksandr Nogikh2023-10-101-2/+27
| | | | | | We've been seeing an increase in "failed to init gce" errors on syzbot. These problems seem totally transient, so let's address it by retrying the initialization instead of aborting syz-manager's execution.
* vm/gce: only enable DisplayDevice for amd64Aleksandr Nogikh2023-10-021-3/+4
| | | | | | | GCE has begun to fail on arm64 instance creation with: Arm based instances do not support display device. Enable the feature for amd64 only.
* all: use errors.As instead of .(type)Taras Madan2023-07-241-2/+4
|
* all: use special placeholder for errorsTaras Madan2023-07-241-18/+18
|
* vm/gce: collect verbose scp outputAleksandr Nogikh2023-05-151-1/+1
| | | | | | | We're getting sporadic "failed to copy binary to VM" errors, but we lack the debug info to understand the nature of the problem. Always collect scp debug info for gce VMs.
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-231-2/+1
|
* vm/cuttlefish, vm/gce: add custom commands for reading consoleKris Alder2022-10-041-32/+45
| | | | | | | | | | | For Cuttlefish we want to read the console from the emulated device instead of the "host" GCE instance. This allows us to pass a custom command through to gce.Pool (and then to gce.instance) which is used instead. We also need to update runOnHost() to use osutil directly instead of delegating to gceInst.Run(), since it's called during VM creation. When setting up the VM the kernel logs don't exist yet.
* pkg/gce, vm/gce: leave nested virt support up to imagesKris Alder2022-09-021-7/+1
| | | | | | | Since this can be enabled on per-image basis, we don't need to specifically add this to the creation RPC. This is basically a revert of https://github.com/google/syzkaller/pull/3328.
* pkg/gce, vm/gce: add param to enable nested virtualizationKris Alder2022-08-251-1/+7
| | | | | | This is needed for Cuttlefish-on-GCE. It adds the field 'nested_virt' to the config file and then passes it through to the relevant field in the call to gce.CreateInstance().
* vm/gce: make zone_id configurableAleksandr Nogikh2022-04-121-1/+2
| | | | | At the moment syzkaller can only use the zone where it's running. Make it a configurable option instead (with the old behavior as a fallback).
* vm/gce: enable display device configurationAleksandr Nogikh2022-03-221-8/+10
| | | | Now we always enable it, make this configurable for GCE instances.
* 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/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/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/qemu, vm/gce: dump LOCKDEP state in DiagnoseDmitry Vyukov2020-11-211-10/+20
| | | | | For context see the discussion at: https://groups.google.com/g/syzkaller/c/ruwaYUvwHTw/m/E9Cg9OfvAgAJ
* vm: pass Report to DiagnoseDmitry Vyukov2020-11-211-1/+2
| | | | | | | | | 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.
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-4/+5
| | | | | | | | | | | | 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.
* .golangci.yml: enable whitespace checkerDmitry Vyukov2020-06-051-1/+0
| | | | Points to bad empty lines very precisely.
* vm/vmimpl: refactor DiagnoseFree/OpenBSDDmitry Vyukov2020-03-211-2/+2
| | | | | Make signatures of these functions match vm.Diagnose. Both more flexible, less code, more reasonable.
* vm: Get debug information when FreeBSD on panics (#1470)Andrew Turner2019-10-211-0/+3
| | | | The FreeBSD kernel debugger can provide more information when the kernel panics. Add support to bhybe and gce to print this information.
* vm/gce: allow non-preemptible VMsDmitry Vyukov2019-03-281-3/+6
| | | | | | | | | 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
* vm/qemu: detect boot errors fasterDmitry Vyukov2019-03-171-1/+1
| | | | | | | | | 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
* vm/vmimpl: produce better error in WaitForSSHDmitry Vyukov2019-01-241-1/+1
| | | | | Currently we squash VerboseError which leads to too lengthy build error titles. Handle verbose error more carefully.
* vm: allow Diagnose to directly return diagnosisMichael Pratt2018-12-211-3/+3
| | | | | | 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.
* vm/gce: close old consolew in RunDmitry Vyukov2018-12-021-0/+3
| | | | Run can be executed several times on a VM.
* vm/gce: use openbsd console diagnostic code for both vmm and gceGreg Steuck2018-12-021-11/+20
| | | | | | | | * openbsd: use console diagnostic code for both vmm and gce. * gometalinter wants less indentation and more stuff in scope * Comment no longer applies
* vm/qemu: improve debug outputMichael Tüxen2018-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | * 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.
* openbsd: run on gceGreg Steuck2018-11-271-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* syz-ci: de-hardcode list of VMs that support overcommitDmitry Vyukov2018-09-111-1/+1
| | | | | | | | 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
* vm/gce: move console check into separate functionDmitry Vyukov2018-08-021-38/+39
| | | | Update #538
* vm/gce: fix buildDmitry Vyukov2018-07-291-1/+0
| | | | fail