aboutsummaryrefslogtreecommitdiffstats
path: root/vm/isolated
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* vm: func Run accepts contextTaras Madan2025-05-191-3/+3
| | | | It allows to use context as a single termination signal source.
* vm: use SSHOptions instead of 4 paramsTaras Madan2025-03-271-27/+25
| | | | It reduces WaitForSSH parameter count from 9 to 6.
* vm: dedup VM count restriction in debug modeDmitry Vyukov2024-11-251-7/+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.
* vmimpl: refactor VM type registrationDmitry Vyukov2024-07-231-1/+3
| | | | | | | | | 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-1/+2
| | | | It's better to follow standard interfaces.
* vm: refactor vm.Multiplex argumentsAleksandr Nogikh2024-07-011-1/+10
| | | | | Introduce a MultiplexConfig structure that contains optional parameters. Include a Scale parameter to control the intended slowdown.
* 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-6/+8
| | | | | | | | | | | | 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-7/+7
|
* all: ioutil is deprecated in go1.19 (#3718)Taras Madan2023-02-231-5/+4
|
* vm/adb: add startup_script configJoey Jiao2021-04-142-43/+7
|
* vm/qemu: restrict network accessDmitry Vyukov2021-02-081-6/+1
| | | | | | | Restrict access to the external network from within the VM and access to VM SSH to local interface only. Fixes #332
* vm: pass Report to DiagnoseDmitry Vyukov2020-11-211-1/+4
| | | | | | | | | 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/isolated: remove dup log messageRadoslav Gerganov2020-10-051-1/+0
|
* all: fix comments formatDmitry Vyukov2020-07-121-1/+1
| | | | | | | Fix capitalization, dots at the end and two spaces after a period. Update #1876
* vm/isolated: fix hang when target_reboot is not setDipanjan Das2020-05-211-3/+3
| | | | | | | | | | | | | | | * updated the contributor list * Fixes #1750, syz-manager hangs with "target_reboot:" false in isolated VM mode If in the isolated VM mode, "target_reboot": false option is set in the syz-manager's configuration, it hangs forever. syz-manager essentially keeps on waiting for the VM to reboot, while a reboot is never triggered due to target_reboot option being set to false. The fix is to perform the waitRebootAndSSH() check only when target_reboot is set to true. File(s) changed: vm/isolated/isolated.go: Move the waitRebootAndSSH() check inside the correct block
* vm/isolated: add initial support for fuzzing chromebooksZubin Mithra2020-02-202-34/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | (WIP PR) Add support for StartupScript. * Modify Config{} to contain PostRepairScript. * Allow repair() to execute a startup_script after reboot. The contents of this script execute on the DUT. Add pstore support: * Modify Config{} to contain Pstore. * Modify Diagnose() to reboot the DUT and fetch pstore logs, conditional on inst.cfg.Pstore. * Add readPstoreContents(). * Allow clearing previous pstore logs upon Create() and after use inside readPstoreContents(). * Fetching pstore crashlogs relies on reliably getting lost connection on DUT reboot. Use "ServerAliveInterval=6 ServerAliveCountMax=5" ssh options when running syz-fuzzer with Pstore support enabled. Allow parsing pstore contents: * Diagnose() now returns pstore contents. Refactoring: * Move out some reusable parts of repair() to waitRebootAndSSH(). * Have an early return inside repair() if inst.waitForSSH() fails.
* vm/isolated: update isolated vmJonghyuk Song2020-01-081-18/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm/isolated: update isolated vm Old isolated.go cannot hard reset the target device when the target device is stuck, because it used SSH command to reboot. New isolated.go can reboot the target device using USB hub, so it can reboot the device when its kernel is crashed during fuzzing. It also doesn't require 'CGO' like odroid.go * vm/isolated: set default Host, comment modification * vm/isolated: restore ssh reboot in repair() In the previous commit, ssh reboot is removed. but it should be remained, so this commit restore the ssh reboot. Now, repair() func can reboot the target using ssh or /sys/bus/usb/devices/.../authorized/ * vm/isolated: update USBdev rebooting method and etc, ... - change reboot method from using /bin/sh to file method - change USBDevNum to array type - restore waiting time when rebooting * vm/isolated: update USBdev rebooting method and etc, ... - change reboot method from using '/bin/sh' to file i/o - change USBDevNum to array type - restore waiting time when rebooting * vm/isolated: update USBdev rebooting method and etc, ... - change reboot method from using '/bin/sh' to file i/o - change USBDevNum to array type - restore waiting time when rebooting * vm/isolated: some fixes based on feedback - change variable name: USBDevNum -> USBDevNums, USBAuth -> usbAuth - check whether USBDevNums is empty in ctor(), repair() - move usbAuth declaration from Create() to repair() * vm/isolated: remove empty line * vm/isolated: fix some conditions * vm/isolated: change comment, add validate length of USBDevNums * vm/isolated: check whether the len(USBDevNums) and len(Targets) is same * vm/isolated: change repair() func based on review - wait 30*time.Minute even if TargetReboot is not set. - reduce/combine logs - e -> err * vm/isolated: In repair(), print error log and return error when ssh is failed
* 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: allow Diagnose to directly return diagnosisMichael Pratt2018-12-211-2/+2
| | | | | | 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/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.
* 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/vmimpl: factor out common code for ssh args and waiting for sshDmitry Vyukov2018-07-061-56/+30
| | | | Move common code from 4 vm implementations to vmimpl.
* vm/vmimpl: add vm.Diagnose methodDmitry Vyukov2018-06-221-0/+4
| | | | | | Diagnose is called on machine hang to try to get some additional diagnostic information from it. For now it's all stubs.
* all: get rid of underscores in identifiersDmitry Vyukov2018-05-071-9/+9
| | | | | | Underscores are against Go coding style. Update #538
* vm/{adb,isolated}: dudup common codeDmitry Vyukov2018-05-061-37/+1
| | | | | | Found with gometalinter/dupl. Update #538
* all: fix too long linesDmitry Vyukov2018-05-051-1/+2
| | | | | Not sure why I have not seen warnings about these lines on another machine...
* gometalinter: some fixes for unparamDmitry Vyukov2018-05-031-8/+8
| | | | | | But we still can't enable it as there are more [uninteresting] warnings. Update #538
* gometalinter: check dot importsDmitry Vyukov2018-05-031-18/+18
| | | | Update #538
* vm: make sshkey argument optionalDmitry Vyukov2018-04-161-4/+0
| | | | | An image can well be setup without a key. Just password-less root login.
* all: fix gometalinter warningsDmitry Vyukov2018-03-081-10/+10
| | | | Fix typos, non-canonical code, remove dead code, etc.
* vm/isolated: allow to specify ssh port for target machinesDmitry Vyukov2017-12-171-13/+40
|
* pkg/osutil: don't leace runaway processesDmitry Vyukov2017-11-161-4/+3
| | | | | | When manager is stopped there are sometimes runaway qemu processes still running. Set PDEATHSIG for all subprocesses. We never need child processes outliving parents.
* vm/gce: windows supportDmitry Vyukov2017-09-271-8/+8
| | | | | | | Support custom pre-created images. Support non-root user. Use dir instead of pwd on windows. Don't use sudo on windows.
* Fix reboot support for VM isolatedThomas Garnier2017-08-301-6/+7
| | | | | | | Do not fail a reboot if the reboot command returns an error. Reduces the wait time per ssh commands to 30 seconds. Signed-off-by: Thomas Garnier <thgarnie@google.com>
* vm/isolated: reformatDmitry Vyukov2017-07-181-1/+0
|
* Add Isolated VMThomas Garnier2017-07-181-0/+359
Add a new isolated VM for machines that you cannot easily manage. It assumes the machine is only available through SSH and create a reverse proxy to ensure the machine can connect back to syz-manager. Signed-off-by: Thomas Garnier <thgarnie@google.com>