aboutsummaryrefslogtreecommitdiffstats
path: root/vm/cuttlefish/cuttlefish.go
Commit message (Collapse)AuthorAgeFilesLines
* vm: add context to Pool.Create()Aleksandr Nogikh2025-10-011-2/+2
| | | | | | | | | | 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.
* vm: func Run accepts contextTaras Madan2025-05-191-2/+3
| | | | It allows to use context as a single termination signal source.
* 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-2/+2
| | | | It's better to follow standard interfaces.
* 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-1/+1
| | | | | | | | | | | | 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.
* all: use special placeholder for errorsTaras Madan2023-07-241-11/+11
|
* vm/cuttlefish: increase cuttlefish memoryLiz Prucka2023-04-271-1/+1
| | | | | | Cuttlefish instances are running out of memory; increased size to allow for a margin on running processes.
* vm/cuttlefish: ignore timeout in Forward()Liz Prucka2022-10-201-2/+7
| | | | | | | The current refactor does not return vmimpl.ErrTimeout() when a timeout occurs. The error handling has been changed to parse the return string for the "timedout after" from osutil.RunCmd().
* vm/cuttlefish, vm/gce: add custom commands for reading consoleKris Alder2022-10-041-20/+22
| | | | | | | | | | | 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.
* vm/cuttlefish: disable cuttlefish sandboxLiz Prucka2022-09-051-1/+2
| | | | | | | | The Cuttlefish sandbox uses SecComp to filter crosvm signals, resulting in crosvm being killed during running. Disabling this option allows Cuttlefish to run successfully. Additionally, the report_anonymous_usage_stats flag is disabled to prevent hanging when Cuttlefish is run from the daemon
* vm/cuttlefish: run commands from deviceRootLiz Prucka2022-09-021-3/+7
| | | | | | | | Create the the deviceRoot directory, then run adb commands from deviceRoot (data/fuzz). Additionally, added quotes in adb shell mounting command; commands should be run inside shell.
* vm/cuttlefish: mount debugfsLiz Prucka2022-09-011-0/+5
| | | | | | Mounting debugfs to sys/kernel/debug. Fixing error that /sys/kernel/debug/kcov does not exist.
* vm/cuttlefish: pass -kernel_path and -initramfs_path flagsKris Alder2022-05-271-3/+3
| | | | | The artifacts are copied in by the build() function in pkg/build/android.go. If we don't pass these flags, Cuttlefish will start with the normal kernel, not the KASan-instrumented one we've built.
* vm/cuttlefish: reduce host forwarding timeout to one secondKris Alder2022-04-121-1/+1
|
* vm/cuttlefish: use nohup with socat to forward portKris Alder2022-04-121-25/+11
| | | | | | | | 'nohup' allows us to let the process run after a timeout. We can check the error message we get back from the command to see if it was vmimpl.ErrTimeout and ignore it for commands we expect to continue running in the background. We have to remove the wrapping of the error with fmt.Errorf to do this comparison.
* vm/cuttlefish: implement forward functionKris Alder2022-04-121-7/+37
| | | | | | | | | | | | | | We need to tunnel ports from the Manager instance all the way through to the virtual device. We do this by tunneling from the Manager to the worker GCE instance using 'socat' on the worker instance and 'adb reverse' to forward the port on the device. We need the 'socat' process to keep running for the tunnel to stay open. We can check for an error on launch, but to check if the process is still running we send it a zero signal after waiting an appropriate amount of time. The 'adb reverse' command, by comparison returns immediately after the connection is established and keeps the tunnel open. We loop until we find a valid/available port, similar to what is done in vm/adb/adb.go. In practice, this nearly always finds a valid port on the first attempt.
* vm/cuttlefish: implement copy and run functionsKris Alder2022-04-071-4/+19
| | | | | | | | | | To copy files onto the virutal device, we first copy them to the host GCE instance using the 'gce.Copy()' function and then push it to the device using 'adb push <src> <dst>'. Running commands on the device is also simple and merely prepends "adb shell" to the command run on the GCE instance. This results in an overall command along the lines of "ssh adb shell <command>".
* vm/cuttlefish: add vm type for cuttlefish on gcekalder2022-04-051-0/+126
* 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.