aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vm_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: remove unused nolint directivesDmitry Vyukov2026-01-021-1/+0
|
* 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: extract all the crashes from the logTaras Madan2025-08-281-9/+170
|
* vm: refactoringTaras Madan2025-08-071-9/+17
| | | | | 1. func Run optionally accepts the opts. 2. Some refactoring, more comments.
* vm: func Run accepts contextTaras Madan2025-05-191-2/+3
| | | | It allows to use context as a single termination signal source.
* all: remove loop variables scopingTaras Madan2025-02-171-1/+0
|
* pkg/report: detect the lost connection crash typeAleksandr Nogikh2024-12-031-0/+8
|
* vm: check preemption string only for gce instancesDmitry Vyukov2024-07-231-1/+2
| | | | Fixes #5028
* 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.
* vmimpl: add a delay after an error from the tracked processAleksandr Nogikh2024-07-011-1/+1
| | | | | 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.
* executor: add runner modeDmitry Vyukov2024-06-241-14/+3
| | | | | | | 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)
* sys/targets: add consts for gvisor/starnixDmitry Vyukov2024-05-271-1/+1
| | | | | Lint started warning about duplicate "gvisor" const in pkg/cover. Add gvisor/starnix consts to sys/targets package to avoid duplication.
* syz-fuzzer: remove ipc gateDmitry Vyukov2024-05-271-31/+20
| | | | | | | | | | | | | | | | | Ipc gate slows down overall execution a lot. Without ipc gate I am getting ~20% more executions with debug kernel and ~100% more executions with a fast non-debug kernel. Replace ipc gate with explicit tracking of last executing programs per proc in syz-manager. Ipc gate was also used for leak checking, but leak checking seems to be still broken. At least in my local runs I am not getting any leaks even with the previous fix. So remove the gate completly for now. Taking into account that we are likely to rewrite this code in C++ soon, it makes little sense to create a special gate for leak checking only in Go. Update #4728
* vm: call finish callback alwaysDmitry Vyukov2024-05-171-1/+6
| | | | | | | | | | | | | | | | Always call the finish callback to make control flow consistent if VM crash/does not crash. Then users can rely on the callback being always called. Fix a bug highlighted by the extended test: currently we call extractError/callback twice when the fuzzer is preempted. If the fuzzer is preempted, extractError returns nil, which makes appendOutput return nil as well, which makes the main loop continue as if no crash/preemption happened. It will exit, but only after 5 min "no output" timeout. Most likley the output will still contain the preemption message, so no "no output" will be reported, but the additional 5 min wait is unnecessary.
* 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.
* vm: fix logical race in a testDmitry Vyukov2024-04-221-0/+1
| | | | | | | | | | | | | Currently the inject-error test injects "BUG: foo\n" and expects VM to fail with this error. However, the command immidiatly exists, so it may exist before the output is injected. In that case the test fails with: === NAME TestMonitorExecution/inject-error vm_test.go:431: got no report Make the command execute for a second so that output is always injected.
* tools/syz-linter: check t.Logf/Errorf/Fatalf messagesDmitry Vyukov2024-04-171-2/+2
| | | | | Fix checking of Logf, it has string in 0-th arg. Add checking of t.Errorf/Fatalf.
* vm: allow to inject additional outputDmitry Vyukov2024-04-151-1/+33
| | | | This will allow manager to inject executing programs into output.
* vm: combine Run and MonitorExecutionDmitry Vyukov2024-04-111-5/+4
| | | | | | All callers of Run always call MonitorExecution right after it. Combine these 2 methods. This allows to hide some implementation details and simplify users of vm package.
* 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).
* syz-manager: don't set up pprof endpoints for host fuzzingAleksandr Nogikh2024-02-031-0/+1
| | | | | | | | In this mode, all syz-fuzzers will be on the same network and will start competing with each other for binding to the same port. For now, we don't have the need to use pprof in the host fuzzer mode, so let's just disable it.
* vm/vm_test.go: allow duplicatesTaras Madan2023-11-081-0/+1
| | | | | These duplicates improve test code readability. It contributes to #4317 unblocking.
* pkg/build: add build code for Android devicesKris Alder2023-03-081-0/+16
| | | | | | | | | Booting physical Android devices requires building a few artifacts, as described at https://source.android.com/docs/setup/build/building-kernels. When a ProxyVM type is used, we need to differentiate whether or not to use the Android build logic, so we add an additional mapping which uses a different name but the same VM logic.
* vm: add the proxyapp support (#3269)Taras Madan2022-09-261-0/+5
| | | | | | | * vm: add pool.Close() support * vm: add proxyapp client implementation * vm/proxyapp: autogenerate mocks * vm/proxyapp: add proxyapp tests * pkg/mgrconfig: add proxyapp type tests
* vm: support variable output buffer sizeAleksandr Nogikh2022-04-291-1/+1
| | | | | Also update syz-crush to save RawOutput instead of output from the Report.
* 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>
* all: make timeouts configurableDmitry Vyukov2020-12-281-1/+5
| | | | | | 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-251-2/+2
| | | | 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: pass Report to DiagnoseDmitry Vyukov2020-11-211-1/+1
| | | | | | | | | 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-3/+4
| | | | | | | | | | | | 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.
* all: fix comments formatDmitry Vyukov2020-07-121-2/+2
| | | | | | | Fix capitalization, dots at the end and two spaces after a period. Update #1876
* vm: better handle VM diagnosis outputDmitry Vyukov2020-03-211-1/+26
| | | | | | | | 1. Always append diagnosis output at the end. Don't intermix it with kernel output. It's confusing and not useful. 2. Don't include diagnosis output into Report. It's too verbose and is not the crash. Keep it only in the Output.
* vm: fix spurious crash detection caused by trimmed linesDmitry Vyukov2019-06-241-1/+21
| | | | | | We've got a case when "ODEBUG:" was incorrectly detected as crash. That was caused by a flaw in matchPos logic. Fix that. See the added test for details.
* pkg/repro: fix no output timeoutDmitry Vyukov2019-05-201-1/+1
| | | | | | We duplicated the no output timeout in the repro package, and it got out of sync. It's not 3 mins now, but 5 mins. Remove the duplication and fix this.
* vm: allow fine-grained control over program exit conditionsDmitry Vyukov2018-12-241-15/+32
| | | | | | | | | Currently we only support canExit flag. However there are actually 3 separate conditions: - program can exit normally - program can timeout (e.g. fuzzer test or runtest can't) - program can exit with error (e.g. C test can) Allow to specify these 3 conditions separately.
* vm: allow Diagnose to directly return diagnosisMichael Pratt2018-12-211-12/+35
| | | | | | 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: don't call Diagnose when VM hasn't crashedDmitry Vyukov2018-12-161-7/+14
| | | | Fixes #875
* vm: add tests for MonitorExecutionDmitry Vyukov2018-12-161-0/+301
| | | | | | | | This gives almost 100% coverage for MonitorExecution. Test all corner cases like lost connection, no output, diagnose, exiting/non-exiting programs, etc. Update #875
* report: add a new package for report parsing and processingDmitry Vyukov2016-08-301-97/+0
| | | | Move vm.FindCrash to the new package.
* vm: faster output oops greppingDmitry Vyukov2016-01-191-12/+9
| | | | | | Use manual parsing instead of a regexp. Regexp takes ~220ms for typical output size. New code takes ~2ms. Brings manager CPU consumption from ~250% down to ~25%.
* vm: fix crash message extraction regexpDmitry Vyukov2015-12-241-0/+100
First, "cut here" is not interesting as it always follows by a more descriptive message. Unreferenced object is interesting. Also, strip \r at the end. Add a test.