aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmimpl
Commit message (Collapse)AuthorAgeFilesLines
* vm: use error wrapping to detect ssh connection errorsAleksandr Nogikh2025-10-011-1/+3
| | | | This is a much cleaner logic than string matching.
* pkg/osutil: make VerboseError nest other errorsAleksandr Nogikh2025-10-012-2/+5
| | | | | After this change it fits more naturally into the Go's error functionality.
* 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/vmimpl: show BBLog entries for all locked tcpcbsMichael Tuexen2025-06-141-1/+1
|
* vm/vmimpl: show BBLog entries for all locked tcpcbsMichael Tuexen2025-06-141-1/+1
|
* vm/vmimpl: show all locked tcpcbsMichael Tuexen2025-05-281-0/+1
| | | | | | | Add a command to show all locked TCP control blocked. If a panic is related to the TCP stack, most likely the affected TCP control block is locked. Therefore, this is show. This is much less noisy than showing all TCP control blocks.
* vm: func Run accepts contextTaras Madan2025-05-191-7/+5
| | | | It allows to use context as a single termination signal source.
* vm/vmimpl: explicitly indicate empty boot outputAleksandr Nogikh2025-05-051-0/+5
| | | | | | | | It will help distinguish the cases when the output was collected, but lost somewhere during the reporting pipeline, or it was empty in the first place, e.g. because qemu could not start at all. Cc #5986.
* vm: use SSHOptions instead of 4 paramsTaras Madan2025-03-271-3/+9
| | | | It reduces WaitForSSH parameter count from 9 to 6.
* vm: support console_cmd to run cmd to collect console logJoey Jiao2025-02-101-29/+23
| | | | | | | | - Sometimes we need customized cmd to get serial log, ex FTDI4232H chip gets serial log through usb directly, thus we need to call cmd like `pyterm.py ftdi://ftdi:4232:FT7JLD0U/1`. - There are seveval places in console implementation to call osutil.Command, move the command code into one function.
* all: use min/max functionsDmitry Vyukov2025-01-171-4/+1
| | | | They are shorter, more readable, and don't require temp vars.
* vm: fix deadlock in UnusedTCPPortIvan Gulakov2025-01-131-0/+15
| | | | | | | | | | | | If localhost is not configured on a system, UnusedTCPPort will loop forever without producing any errors. By checking EADDRINUSE and ENOACC and then skipping only in these cases, we'd avoid at least the mentioned deadlock. On top of this, this change should catch other errors without locking, like other DNS errors and so on. Signed-off-by: Ivan Gulakov <gulakov@amazon.de>
* vm: add snapshot interfaceDmitry Vyukov2024-07-251-0/+1
|
* vm: check preemption string only for gce instancesDmitry Vyukov2024-07-231-0/+4
| | | | Fixes #5028
* vmimpl: refactor VM type registrationDmitry Vyukov2024-07-231-6/+5
| | | | | | | | | 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/vmimpl: don't wait commands that have not failedDmitry Vyukov2024-07-111-8/+10
| | | | | | | | | The sleep in Multiplex is unconditional and it sleeps idle even for commands that has nothting to do with executor, and for executor in other modes that has nothing to do with fuzzing. Since the original reason for the sleep was related to failing executor, sleep only when the command fails. This allows to at least run successful commands fast.
* vm: make Instance implement io.CloserAleksandr Nogikh2024-07-111-1/+1
| | | | It's better to follow standard interfaces.
* vm/gce: use vmimpl.Multiplex()Aleksandr Nogikh2024-07-021-5/+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.
* vm: refactor vm.Multiplex argumentsAleksandr Nogikh2024-07-011-10/+21
| | | | | Introduce a MultiplexConfig structure that contains optional parameters. Include a Scale parameter to control the intended slowdown.
* vmimpl: add a delay after an error from the tracked processAleksandr Nogikh2024-07-011-0/+5
| | | | | It usually means a kernel crash, in which case we want to give the kernel some more time to print the whole coverage report to the console.
* vm/qemu: use the default vmimpl.Multiplex() functionAleksandr Nogikh2024-07-011-4/+9
|
* executor: add runner modeDmitry Vyukov2024-06-241-8/+0
| | | | | | | Move all syz-fuzzer logic into syz-executor and remove syz-fuzzer. Also restore syz-runtest functionality in the manager. Update #4917 (sets most signal handlers to SIG_IGN)
* pkg/rpctype: prepare for not using for target communicationDmitry Vyukov2024-05-031-7/+5
| | | | | | 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-5/+7
| | | | | | | | 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-15/+19
| | | | | | | | | | | | 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: refactor pprof endpoint configurationAleksandr Nogikh2024-01-221-0/+5
| | | | | | | | | | | | | In some cases (e.g. gVisor instances using host's network namespace) attempts to bind() all syz-fuzzer processes to the same port result in conflicts and fuzzing breakages. Refactor the code to enable custom pprof configuration depending on the vm type. For now, just disable pprof endpoints for gVisor VMs. Once we actually need the feature there, we can generate custom ports for every gVisor VM.
* syz-fuzzer: export pprof endpointsAleksandr Nogikh2024-01-101-0/+3
| | | | | This will let us have a better understanding of what's going on inside a fuzzed VM.
* vmimpl: don't build console.go under WindowsAleksandr Nogikh2024-01-101-0/+1
|
* all: use errors.As instead of .(type)Taras Madan2023-07-242-6/+7
|
* all: use special placeholder for errorsTaras Madan2023-07-241-5/+5
|
* vm: separate boot time and infrastructure errorsAleksandr Nogikh2023-05-091-0/+17
| | | | | | | | | | | | | | | It's not correct to mix them since they point to fundamentally different issues: 1) Boot time errors are caused by a problematic kernel image and can only be resolved by using another kernel version or config. 2) Infrastructure errors are temporary, so we can just try again some time later. Reserve the existing BootError for (1) errors and let all other VM handling errors refer to (2). To make it possible to attach more output to the infra error, introduce the VerboseInfraError type.
* vm/starnix: add support for fuzzing starnix (#3624)juanPabloMiceli2023-01-191-10/+11
| | | | | | | This commit adds a new VM for fuzzing starnix. The VM will boot a fuchsia image using the `ffx` tool and will connect to an adb server inside it. Fuzzing will be done using HostFuzzer mode due to some features not being implemented yet in starnix. Once this is possible, fuzzing will be performed without HostFuzzer mode. Co-authored-by: Juampi Miceli <jpmiceli@google.com>
* vm/vmimpl: improve port selectionmischa2022-04-191-2/+7
| | | | | | Selecting the monitor port for qemu using an unseeded pseudo-random generator can lead to failed VM startups, as the code contains race conditions. This happens frequently if multiple instances are started with a script. Using real random ports provided by crypto/rand reduces the risk of failing VM starts.
* vm/adb: support both old and new device formatHuizi Yang2021-09-101-1/+3
|
* vm/vmimpl/console: tail to kernel log to get serial outputHuizi Yang2021-09-101-0/+27
|
* vm/adb: add startup_script configJoey Jiao2021-04-141-0/+41
|
* vm/qemu: provide info about qemu version/argsDmitry Vyukov2021-03-181-0/+6
|
* vm/qemu: restrict network accessDmitry Vyukov2021-02-081-3/+11
| | | | | | | Restrict access to the external network from within the VM and access to VM SSH to local interface only. Fixes #332
* vm/qemu: scale ssh timeoutDmitry Vyukov2020-12-291-9/+11
| | | | Increase ssh wait timeout according to the target slowdown.
* vm/qemu, vm/gce: dump LOCKDEP state in DiagnoseDmitry Vyukov2020-11-211-0/+26
| | | | | For context see the discussion at: https://groups.google.com/g/syzkaller/c/ruwaYUvwHTw/m/E9Cg9OfvAgAJ
* vm: pass Report to DiagnoseDmitry Vyukov2020-11-211-6/+8
| | | | | | | | | 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-1/+2
| | | | | | | | | | | | 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/vmimpl/merger: remove all CRs from outputAlexander Egorenkov2020-10-022-3/+8
| | | | | | | Get rid of all places stripping \r in pkg/report. And adapt all tests. Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
* vm/vmimpl: update console code for the new unix packageDmitry Vyukov2020-09-151-8/+5
| | | | | | | | The current code is now broken on darwin: syzkaller$ GOOS=darwin go install ./vm/... vm/vmimpl/console.go:30:33: undefined: unix.SYS_IOCTL vm/vmimpl/console.go:45:32: undefined: unix.SYS_IOCTL
* Revert "vm/vmimpl: disallow ssh authentication agent"Dmitry Vyukov2020-08-181-1/+0
| | | | | | | | | | This reverts commit b9683dbdfdbea5815c2cf48b20aada181dca1be3. Majority of syzbot instances started failing with: failed to run ["ssh" "-p" "22" "-F" "/dev/null" "-o" "UserKnownHostsFile=/dev/null" "-o" "BatchMode=yes" "-o" "IdentitiesOnly=yes" "-o" "IdentityAgent=none" "-o" "StrictHostKeyChecking=no" "-o" "ConnectTimeout=10" "-i" "/syzkaller/managers/upstream-bpf-next-kasan-gce/latest.tmp/key" "root@10.128.15.195" "pwd"]: exit status 255 command-line: line 0: Bad configuration option: identityagent command-line: line 0: Bad configuration option: identityagent
* vm/vmimpl: disallow ssh authentication agentMarco Vanotti2020-08-181-0/+1
| | | | | | | This commit adds a new option to SSH options, disallowing the authentication agent. This is specially useful when you are testing in a machine that sets the `SSH_AUTH_SOCK` environment variable, as ssh will try to use that authentication agent on each ssh connection.
* all: fix comments formatDmitry Vyukov2020-07-123-9/+9
| | | | | | | Fix capitalization, dots at the end and two spaces after a period. Update #1876
* vm/vmimpl: add support for linux/riscv64Tobias Klauser2020-06-261-0/+15
| | | | Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
* sys/linux: first 64bit big-endian architecture s390xAlexander Egorenkov2020-06-251-0/+15
| | | | | | | | | | | | | | | * 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>
* .golangci.yml: enable godot checkerDmitry Vyukov2020-06-051-1/+1
| | | | | A good one. Lots of fixed comments are contributed by episodic contributors. So it's good to catch these earlier.