aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc/ipc_test.go
Commit message (Collapse)AuthorAgeFilesLines
* executor: add runner modeDmitry Vyukov2024-06-241-262/+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)
* executor: remove noshmem modeDmitry Vyukov2024-06-041-6/+4
| | | | | | | | | All OSes we have now support shmem. Support for Fuchia/Starnix/Windows wasn't implemented, but generally they support shared memory. Remove all of the complexity and code associated with noshmem mode. If/when we revive these OSes, it's easier to properly implement shmem mode for them.
* pkg/ipc: remove ExecOptsDmitry Vyukov2024-05-211-2/+2
| | | | Switch to flatrpc.ExecOpts.
* pkg/ipc: remove ProgInfoDmitry Vyukov2024-05-211-8/+8
| | | | | | Switch to flatrpc.ProgInfo. Note: this disables syz-runtest and syz-verifier.
* pkg/ipc: use flatrpc flagsDmitry Vyukov2024-05-171-3/+4
| | | | | | Flatrpc flags are passed in RPC execution requests, so to avoid conversions and duplicate set of flags use flatrpc flags in pkg/ipc directly.
* pkg/vminfo: move feature checking to hostDmitry Vyukov2024-05-151-1/+1
| | | | | | | | | | | | | | | | | Feature checking procedure is split into 2 phases: 1. syz-fuzzer invokes "syz-executor setup feature" for each feature one-by-one, and checks if executor does not fail. Executor can also return a special "this feature does not need custom setup", this allows to not call setup of these features in each new VM. 2. pkg/vminfo runs a simple program with ipc.ExecOpts specific for a concrete feature, e.g. for wifi injection it will try to run a program with wifi feature enabled, if setup of the feature fails, executor should also exit with an error. For coverage features we also additionally check that we actually got coverage. Then pkg/vminfo combines results of these 2 checks into final result. syz-execprog now also uses vminfo package and mimics the same checking procedure. Update #1541
* pkg/ipc: move executor common_ext testDmitry Vyukov2024-05-081-0/+47
| | | | | | | | Move the test from executor to pkg/ipc to prevent import cycle in the next change. pkg/ipc looks like the most reasonable place for it (besides executor), it already builds executor binary. The test cannot be moved to pkg/csource b/c it will create csource<->ipc cycle.
* executor: make flatrpc build for C++Dmitry Vyukov2024-05-031-19/+4
|
* pkg/ipc: make it possible to change EnvFlags between executionsDmitry Vyukov2024-04-301-4/+2
| | | | | | | | | | | | | | | | Pass EnvFlags into Exec instead of New. This allows to change EnvFlags between executions. Change of EnvFlags forces executor process restart since it uses EnvFlags during setup. Currently this is intended to be NFC since we always pass the same EnvFlags. In future this will allow to (1) reduce part of the VM checking procedure to execution of programs with different options (e.g. we can probe for coverage/comparisons support, probe different sandboxes, etc); (2) use it during fuzzing/reproduction, e.g. we can check if the crash reproduces under setuid sandbox, or execute some fuzzing programs in significantly different modes.
* tools/syz-linter: check t.Logf/Errorf/Fatalf messagesDmitry Vyukov2024-04-171-1/+1
| | | | | Fix checking of Logf, it has string in 0-th arg. Add checking of t.Errorf/Fatalf.
* executor: skip executor tests on systems with BrokenCompilerGreg Steuck2024-04-051-0/+4
| | | | | OpenBSD in particular is not compatible with TestOS expectation of having a syscall function.
* all: use special placeholder for errorsTaras Madan2023-07-241-2/+2
|
* pkg/image: factor out from progDmitry Vyukov2022-12-221-2/+3
| | | | | | | Move image compression-related function to a separate package. In preperation for subsequent changes that make decompression more complex. Prog package is already large and complex. Also makes running compression tests/benchmarks much faster.
* executor: add test for zlib decompressionDmitry Vyukov2022-11-231-0/+38
|
* pkg/testutil: add RandSource helperDmitry Vyukov2022-11-231-6/+2
| | | | | The code to send rand source is dublicated in several packages. Move it to testutil package.
* pkg/csource, pkg/instance, pkg/ipc, pkg/mgrconfig, tools/syz-prog2c, ↵Andrey Artemiev2022-08-061-0/+2
| | | | syz-manager: introduce a new setting 'sandbox_arg' (#3263)
* executor: ignore async flag in the non-threaded modeAleksandr Nogikh2021-12-131-3/+11
| | | | | | | | pkg/repro tries to clear the Threaded flag during repro simplification, so it's easier just to ignore the remaining async flags in that case - they won't be in the C repro either. Add a test to pkg/ipc to verify the new behavior.
* all: replace collide mode by `async` call propertyAleksandr Nogikh2021-12-101-1/+1
| | | | | | | | | | | | | Replace the currently existing straightforward approach to race triggering (that was almost entirely implemented inside syz-executor) with a more flexible one. The `async` call property instructs syz-executor not to block until the call has completed execution and proceed immediately to the next call. The decision on what calls to mark with `async` is made by syz-fuzzer. Ultimately this should let us implement more intelligent race provoking strategies as well as make more fine-grained reproducers.
* all: make timeouts configurableDmitry Vyukov2020-12-281-4/+6
| | | | | | 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.
* pkg/ipc: fix running of executor testsDmitry Vyukov2020-12-091-2/+2
| | | | | We need to check GOARCH instead of GOOS, otherwise all executor failures are ignored...
* pkg/ipc: remove Config.TimeoutDmitry Vyukov2020-11-301-3/+0
| | | | | It's not used for anything useful and will conflict with automatic timeout tuning.
* sys/targets: add OS/Arch name constsDmitry Vyukov2020-10-261-1/+1
| | | | | | | | | | | | 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.
* pkg/ipc: fix cross-arch build in testDmitry Vyukov2020-08-221-1/+1
| | | | BrokenCompiler is only initialized after Get.
* pkg/ipc: run cross-arch executor testsDmitry Vyukov2020-08-221-10/+23
| | | | We may run some cross-arch tests using qemu-user.
* all: reformat codeDmitry Vyukov2020-05-081-1/+1
|
* all: replace TRAVIS env var with CIDmitry Vyukov2020-05-071-1/+1
| | | | | | | | In preparation to running some tests as github actions. Both Travis and Github define CI env var, while TRAVIS is, well, too Travis-specific. Update #1699
* prog: refactor target.MakeMmapDmitry Vyukov2020-04-181-2/+2
| | | | | | | | | | | Make MakeMmap return more than 1 call. This is a preparation for future changes. Also remove addr/size as they are effectively always the same and can be inferred from the target (will also conflict with the future changes). Also rename to MakeDataMmap to better represent the new purpose: it's just some arbitrary mmap, but rather mapping of the data segment.
* pkg/ipc: move target characteristics out of config flagsDmitry Vyukov2019-11-161-10/+11
| | | | | They don't belong there, executor does not know about them. In preparation for future changes.
* all: fix warnings pointed to by golangci-lintDmitry Vyukov2019-03-281-1/+1
| | | | Update #977
* pkg/ipc: generate better temp name for executorDmitry Vyukov2019-02-081-1/+2
| | | | | | | | | Just appending the pid number can produce conflicting names if the name itself ends with digits (standard temp file naming convention). So append ".PID". Also remove beginning from too long names instead of ending. Temp files in tests has unique numbers at the end, we need to preserve them to avoid file name conflicts.
* executor: remove ability to detect kernel bugsDmitry Vyukov2019-01-311-9/+2
| | | | | | | | This ability was never used but we maintain a bunch of code for it. syzkaller also recently learned to spoof this error code with some ptrace magic (probably intercepted control flow again and exploited executor binary). Drop all of it.
* prog, pkg/{csource,ifuzz,ipc,repro}: make tests deterministic on travisDmitry Vyukov2019-01-021-0/+3
| | | | | Don't use random seed on travis as it produces flaky coverage reports, and probably generally better for CI setting.
* ipc: add ProgInfo structAndrey Konovalov2018-11-221-6/+6
| | | | | | This patch add a new struct ProgInfo that for now holds info about each call in a program []CallInfo, but in the future will be expanded with remote coverage info. Update all the callers to use the new interface as well.
* pkg/ipc: move flags into subpackageDmitry Vyukov2018-08-031-2/+4
| | | | | Move all ipc flags into pkg/ipc/ipcconfig package so that importing pkg/ipc does pull in the flags.
* executor: overhaulDmitry Vyukov2018-07-241-1/+18
| | | | | | | | | | | | | | | | | Make as much code as possible shared between all OSes. In particular main is now common across all OSes. Make more code shared between executor and csource (in particular, loop function and threaded execution logic). Also make loop and threaded logic shared across all OSes. Make more posix/unix code shared across OSes (e.g. signal handling, pthread creation, etc). Plus other changes along similar lines. Also support test OS in executor (based on portable posix) and add 4 arches that cover all execution modes (fork server/no fork server, shmem/no shmem). This change paves way for testing of executor code and allows to preserve consistency across OSes and executor/csource.
* pkg/ipc: create default config based on targetDmitry Vyukov2018-07-051-1/+1
| | | | | Pass actual target to DefaultConfig, that's what we really want, not the stray ipc flag.
* pkg/ipc: fix cleanup in testDmitry Vyukov2018-06-291-8/+10
| | | | | | | Currently we first send on errs and then close env. As the result process can exit before env.Close finishes, which will leave garbage behind. Close env before sending on errs.
* pkg/csource: allow to build source fom memoryDmitry Vyukov2018-06-061-7/+3
| | | | | | In most cases we have source in memory, so provide a function to build right from memory without creating temp files.
* pkg/ipc: fix data race on config.TimeoutDmitry Vyukov2018-04-231-0/+55
|
* pkg/ipc: test only on simple progDmitry Vyukov2018-03-201-48/+20
| | | | | | Don't use random programs for testing. Sometimes they lead to flakes like: opendir(./1/file0) failed (errno 13)
* all: fix gometalinter warningsDmitry Vyukov2018-03-081-10/+0
| | | | Fix typos, non-canonical code, remove dead code, etc.
* sys/linux: fix mmap call argsDmitry Vyukov2018-02-201-7/+15
| | | | Also add a test for this.
* pkg/ipc: make threaded/collide per-program optionsDmitry Vyukov2017-12-171-13/+17
| | | | | | | Currently threaded/collide are global environment flags. It can be useful to turn off collider during some executions (minimization, triage, etc). Make them per-program options.
* syz-ci: test images before using themDmitry Vyukov2017-11-301-0/+3
| | | | | | | Boot and minimally test images before declaring them as good and switching to using them. If image build/boot/test fails, upload report about this to dashboard.
* executor, pkg/ipc: unify ipc protocol between linux and other OSesDmitry Vyukov2017-10-161-14/+16
| | | | | | | | | | | | | | | | | We currently use more complex and functional protocol on linux, and a simple ad-hoc protocol on other OSes. This leads to code duplication in both ipc and executor. Linux supports coverage, shared memory communication and fork server, which would also be useful for most other OSes. Unify communication protocol and parametrize it by (1) use of shmem or only pipes, (2) use of fork server. This reduces duplication in ipc and executor and will allow to support the useful features for other OSes easily. Finally, this fixes akaros support as it currently uses syz-stress running on host (linux) and executor running on akaros.
* executor: split source per-OSDmitry Vyukov2017-09-201-1/+3
| | | | Update #191
* pkg/csource: support archs other than x86_64Dmitry Vyukov2017-09-151-8/+13
|
* prog: remove default target and all global stateDmitry Vyukov2017-09-151-5/+6
| | | | | | Now each prog function accepts the desired target explicitly. No global, implicit state involved. This is much cleaner and allows cross-OS/arch testing, etc.
* syz-manager/mgrconfig: explicitly specify target in configDmitry Vyukov2017-09-151-0/+5
| | | | | Add target config parameter (e.g. linux/amd64) which controls target OS/arch. No more explicit assumptions about target.
* prog, sys: move types to progDmitry Vyukov2017-09-051-0/+1
| | | | | | | | | | | Large overhaul moves syscalls and arg types from sys to prog. Sys package now depends on prog and contains only generated descriptions of syscalls. Introduce prog.Target type that encapsulates all targer properties, like syscall list, ptr/page size, etc. Also moves OS-dependent pieces like mmap call generation from prog to sys. Update #191