aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: use any instead of interface{}Dmitry Vyukov2025-12-221-1/+1
| | | | Any is the preferred over interface{} now in Go.
* prog: pkg/compiler: docs: introduce the `no_squash` attributeAlexander Potapenko2025-09-091-0/+26
| | | | | | | | | | | | | | | | | The `no_squash` per-syscall attribute prevents the fuzzer from generating squashed arguments to a particular syscall. This is particularly helpful for pseudo-syscalls with elaborate arguments that are hard to reason about when they are squashed - e.g. for syz_kvm_add_vcpu() that takes a SYZOS program as an input. I've considered an alternative solution that prohibits ANY for all pseudo-syscalls. But there is a bunch of existing programs (both the tests and the repros) for syscalls like syz_mount_image() for which the benefit of not passing ANY is not immediately obvious. I therefore decided to go with an explicit attribute that can later be enforced for every pseudo-syscall at compile time.
* all: remove loop variables scopingTaras Madan2025-02-171-2/+0
|
* tools/syz-linter: check t.Logf/Errorf/Fatalf messagesDmitry Vyukov2024-04-171-4/+4
| | | | | Fix checking of Logf, it has string in 0-th arg. Add checking of t.Errorf/Fatalf.
* prog: use optimized mutation parametersAleksandr Nogikh2024-04-021-0/+2
| | | | | | | | | These parameters have been selected by a local experiment. On syz-testbed, they seem to help syzkaller find +15% more different crash types per single run and +30% more crash types overall. Later we might want to choose these parameters during the actual run.
* pkg/testutil: move iterCount from prog packageDmitry Vyukov2022-12-221-1/+1
|
* pkg/mgrconfig, prog, syz-fuzzer: manager-configurable syscall mutationHrutvik Kanabar2022-09-221-4/+4
| | | | | | | | | | | | | | | | | | Allow manager configuration to specify that certain syscalls should not be mutated. This is expected to be useful when mutating certain syscalls is unlikely to produce interesting executions. For example, mutating a `syz_mount_image` call will likely produce a corrupt image. Some implementation details: - Add a `no_mutate_syscalls` manager config entry, with the same format as `enable_syscalls`. Ensure this is parsed and stored in the config as a set of syscall IDs. - Send this set to fuzzers when they connect to their managers via RPC. Ensure each fuzzer stores a copy of the set. - When mutating arguments of a syscall, check first whether it has been specified as non-mutatable. - For all mutations not managed by a `syz-manager`, retain previous behaviour by ensuring that no syscalls are considered non-mutable.
* prog: generate very long file namesDmitry Vyukov2022-08-101-0/+10
| | | | | Generate very long file names once in a while to provoke bugs like: https://github.com/google/gvisor/commit/f857f268eceb1cdee0b2bdfa218c969c84033fcd
* pkg/testutil: add packageDmitry Vyukov2021-12-211-2/+4
| | | | | | | | Add package with RaceEnabled const that can be used in test to skip long tests in race mode. Switch existing tests to use the new package. Update #2886
* prog: reduce size of tests in race modeDmitry Vyukov2020-10-011-0/+3
| | | | | More race timeouts on CI. Exclude more tests. This reduces prog test time fron 81 to 15 sec with GOMAXPROCS=1.
* prog: don't run mutation tests in race modeDmitry Vyukov2020-09-281-0/+3
| | | | They take too long.
* all: fix comments formatDmitry Vyukov2020-07-121-7/+7
| | | | | | | Fix capitalization, dots at the end and two spaces after a period. Update #1876
* tools/syz-linter: fix comments checkDmitry Vyukov2020-07-101-10/+0
| | | | | | | Turns out ast.Inspect does not visit most comments. Walk file.Comments manually. Update #1876
* prog: reduce number of allocations in MutateDmitry Vyukov2020-05-181-33/+0
| | | | Don't allocate 3 parallel slices.
* prog: reduce size of -short testsDmitry Vyukov2020-05-181-5/+5
| | | | Reduce size of tests that run for more than 1s in short mode.
* prog: support disabled attributeDmitry Vyukov2020-05-041-24/+14
| | | | | Update #477 Update #502
* pkg/compiler: check that flags values fit into base typeDmitry Vyukov2020-03-171-4/+4
| | | | | | | | flags[foo, int8] foo = 0x12345678 is always an error, detect these cases. Found some bugs in mptcp, packet sockets, kvm.
* pkg/compiler: ensure consistency of syscall argument typesDmitry Vyukov2020-03-171-54/+54
| | | | | | | | | | | | | | | | | | Ensure that we don't have conflicting sizes for the same argument of the same syscall, e.g.: foo$1(a int16) foo$2(a int32) This is useful for several reasons: - we will be able avoid morphing syscalls into other syscalls - we will be able to figure out more precise sizes for args (lots of them are implicitly intptr, which is the largest type on most important arches) - found few bugs in linux descriptions Update #477 Update #502
* prog: control program lengthDmitry Vyukov2020-03-131-3/+3
| | | | | | | | | | | | | | | | | | | We have _some_ limits on program length, but they are really soft. When we ask to generate a program with 10 calls, sometimes we get 100-150 calls. There are also no checks when we accept external programs from corpus/hub. Issue #1630 contains an example where this crashes VM (executor limit on number of 1000 resources is violated). Larger programs also harm the process overall (slower, consume more memory, lead to monster reproducers, etc). Add a set of measure for hard control over program length. Ensure that generated/mutated programs are not too long; drop too long programs coming from corpus/hub in manager; drop too long programs in hub. As a bonus ensure that mutation don't produce programs with 0 calls (which is currently possible and happens). Fixes #1630
* prog: remove use of unsafeDmitry Vyukov2020-02-091-0/+18
| | | | | | | | | | | Unsafe is, well, unsafe. Plus it fails under the new checkptr mode in go1.14. Remove use of unsafe. No statistically significant change in performance: name old time/op new time/op delta StoreLoadInt-8 21.2ns ± 5% 21.6ns ± 9% ~ (p=0.136 n=20+20)
* prog: mutate length of output buffersVeronica Radu2019-10-101-6/+50
| | | | Update #480
* prog: use type size when generating/mutating intsVeronica Radu2019-09-231-0/+31
| | | | Update #1381
* prog: implemented argument and call prioritiesVeronica Radu2019-09-041-40/+200
|
* prog: measure memory allocation in benchmarksDmitry Vyukov2019-08-131-14/+4
| | | | | | Enable ReportAllocs. Also factor out common code into a helper function (duplicated in 3 places now).
* prog: add special mutation for binary flagsVeronica Radu2019-08-091-1/+33
|
* prog: speed up TestResourceCtorsDmitry Vyukov2018-12-311-1/+1
| | | | We check each resource multiple times. Check each resource once.
* prog: implement strict parsing modeDmitry Vyukov2018-12-101-1/+1
| | | | | | | Add bulk of checks for strict parsing mode. Probably not complete, but we can extend then in future as needed. Turns out we can't easily use it for serialized programs as they omit default args and during deserialization it looks like missing args.
* prog: introduce strict parsing modeDmitry Vyukov2018-12-101-3/+3
| | | | | | | | | | | Over time we relaxed parsing to handle all kinds of invalid programs (excessive/missing args, wrong types, etc). This is useful when reading old programs from corpus. But this is harmful for e.g. reading test inputs as they can become arbitrary outdated. For runtests which creates additional problem of executing not what is actually written in the test (or at least what author meant). Add strict parsing mode that does not tolerate any errors. For now it just checks excessive syscall arguments.
* prog: parallelize testsDmitry Vyukov2018-05-041-4/+17
| | | | | Parallelize more tests and reduce number of iterations in random tests under race detector.
* prog: rework address allocationDmitry Vyukov2018-02-191-1/+19
| | | | | | | | | | | | 1. mmap all memory always, without explicit mmap calls in the program. This makes lots of things much easier and removes lots of code. Makes mmap not a special syscall and allows to fuzz without mmap enabled. 2. Change address assignment algorithm. Current algorithm allocates unmapped addresses too frequently and allows collisions between arguments of a single syscall. The new algorithm analyzes actual allocations in the program and places new arguments at unused locations.
* prog: move Minimize tests to an own fileDmitry Vyukov2018-02-191-165/+0
|
* prog: reorder Minimize argumentsDmitry Vyukov2018-02-191-11/+11
| | | | | Make the predicate the last argument. It's more common and convenient (arguments are not separated by multiple lines).
* prog: don't serialize default argumentsDmitry Vyukov2018-02-011-5/+5
| | | | | | | This reduces size of a corpus in half. We store corpus on manager and on hub, so this will reduce their memory consumption. But also makes large programs more readable.
* pkg/compiler: allow unions with only 1 fieldDmitry Vyukov2018-01-271-24/+25
| | | | | | | | | | | | | Unions with only 1 field are not actually unions, and can always be replaced with the option type. However, they are still useful when there will be more options in future but currently only 1 is described. Alternatives are: - not using union (but then all existing programs will be broken when union is finally introduced) - adding a fake field (ugly and reduces fuzzer efficiency) Allow unions with only 1 field.
* prog: support opt for proc typesDmitry Vyukov2018-01-061-0/+6
|
* prog: add test for len mutationDmitry Vyukov2018-01-061-0/+6
| | | | Test we actually can get an unnatural len value.
* prog: fix TestMutateTableDmitry Vyukov2017-12-171-87/+94
| | | | | | Now works fast enough even for short mode. Fixes #208
* prog: add benchmark for MutateDmitry Vyukov2017-12-171-0/+20
|
* prog: support bytesizeN for vmaDmitry Vyukov2017-11-291-4/+9
| | | | | | I guess this is currently unused, but ignoring bytesizeN for vma looks wrong. If user asks for bytesizeN for vma, divide vma size by N.
* syz-fuzzer: don't send/check CallIndex for inputsDmitry Vyukov2017-10-101-0/+16
| | | | | | | | | | | | | | The call index check episodically fails: 2017/10/02 22:07:32 bad call index 1, calls 1, program: under unknown circumstances. I've looked at the code again and don't see where/how we can mess CallIndex. Added a new test for minimization that especially checks resulting CallIndex. It would be good to understand what happens, but we don't have any reproducers. CallIndex is actually unused at this point. Manager only needs call name. So remove CallIndex entirely.
* prog: remove default target and all global stateDmitry Vyukov2017-09-151-17/+15
| | | | | | 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.
* prog, sys: move types to progDmitry Vyukov2017-09-051-18/+9
| | | | | | | | | | | 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
* prog: reduce the "uber-mmap" sizeAlexander Potapenko2017-08-081-4/+4
| | | | | | | | During minimization we create a single memory mapping that contains all the smaller mmap() ranges, so that other mmap() calls can be dropped. This "uber-mmap" used to start at 0x7f0000000000 regardless of where the smaller mappings were located. Change its starting address to the beginning of the first small mmap() range.
* prog: properly remove calls when splicing progsAndrey Konovalov2017-08-011-2/+16
| | | | | | Use removeCall() to update use references. Also add a test and speed up other ones.
* prog: split Arg into smaller structsAndrey Konovalov2017-07-171-16/+16
| | | | | | | | | | | | | | | | | | | | | | Right now Arg is a huge struct (160 bytes), which has many different fields used for different arg kinds. Since most of the args we see in a typical corpus are ArgConst, this results in a significant memory overuse. This change: - makes Arg an interface instead of a struct - adds a SomethingArg struct for each arg kind we have - converts all *Arg pointers into just Arg, since interface variable by itself contains a pointer to the actual data - removes ArgPageSize, now ConstArg is used instead - consolidates correspondence between arg kinds and types, see comments before each SomethingArg struct definition - now LenType args that denote the length of VmaType args are serialized as "0x1000" instead of "(0x1000)"; to preserve backwards compatibility syzkaller is able to parse the old format for now - multiple small changes all over to make the above work After this change syzkaller uses twice less memory after deserializing a typical corpus.
* prog: fix buffer type with value 0x0 in testsAndrey Konovalov2017-05-261-5/+5
|
* prog: minimize based on individual argsAndrey Konovalov2016-11-251-11/+26
|
* fuzzer: combine progs from corpusAndrey Konovalov2016-11-251-2/+2
|
* Fix validate, detect nil non-optional pointerAndrey Konovalov2016-10-111-2/+2
|
* Refactor & improve len type handlingAndrey Konovalov2016-10-111-16/+16
|