aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rand_test.go
Commit message (Collapse)AuthorAgeFilesLines
* prog: replace MinimizeParams with MinimizeModeDmitry Vyukov2024-08-071-2/+2
| | | | | | | | | | | | | | All callers shouldn't control lots of internal details of minimization (if we have more params, that's just more variations to test, and we don't have more, params is just a more convoluted way to say if we minimize for corpus or a crash). 2 bools also allow to express 4 options, but only 3 make sense. Also when I see MinimizeParams{} in the code, it's unclear what it means. Replace params with mode. And potentially "crash" minimization is not "light", it's just different. E.g. we can simplify int arguments for reproducers (esp in snapshot mode), but we don't need that for corpus.
* prog: restricts hints to at most 10 attempts per single kernel PCDmitry Vyukov2024-07-221-2/+2
| | | | | | | | | We are getting too many generated candidates, the fuzzer may not keep up with them at all (hints jobs keep growing infinitely). If a hint indeed came from the input w/o transformation, then we should guess it on the first attempt (or at least after few attempts). If it did not come from the input, or came with a non-trivial transformation, then any number of attempts won't help. So limit the total number of attempts (until the next restart).
* prog: make minimization parameters explicitAleksandr Nogikh2024-05-271-1/+1
| | | | Add an explicit parameter to only run call removal.
* 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.
* prog: speed up TestDeterminism()Aleksandr Nogikh2024-03-141-1/+5
| | | | | We don't need to try out all possible mutations. It can be very slow for large programs, so let's limit the number of hint mutations to 100.
* prog: enable MutateWithHints() abortionAleksandr Nogikh2024-03-141-1/+2
| | | | | The call may potentially generate a very large number of possible mutations. Add a way to abort the process.
* pkg/mgrconfig, prog, syz-fuzzer: manager-configurable syscall mutationHrutvik Kanabar2022-09-221-3/+3
| | | | | | | | | | | | | | | | | | 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: add an attribute for syscalls which should not be generatedHrutvik Kanabar2022-09-221-0/+31
| | | | | | | | | | | | | | Create a `no_generate` attribute to be used with syscalls that `syzkaller` should not try to generate from scratch. In other words, `syzkaller` will only use seeds of this call. This will be useful for syscalls which are unlikely to be correctly generated. In particular, prevent these syscalls from being included in the choice table or from being considered as possible resource constructors. Also add a test which will attempt to generate programs with a bias towards `no_generate` syscalls, and flag up any that make it into result programs. Currently there are no `no_generate` syscalls, but the next commit will add some.
* prog: generate very long file namesDmitry Vyukov2022-08-101-1/+5
| | | | | Generate very long file names once in a while to provoke bugs like: https://github.com/google/gvisor/commit/f857f268eceb1cdee0b2bdfa218c969c84033fcd
* prog: pass ctx by pointer to ForeachType callbackDmitry Vyukov2022-01-111-1/+1
| | | | | This will allow callbacks to stop iteration early by setting ctx.Stop flag (as it works for ForeachArg).
* prog: extend TestEnabledCalls testDmitry Vyukov2021-05-101-3/+10
| | | | Enable random set of syscalls to test more combinations.
* prog: reduce size of -short testsDmitry Vyukov2020-05-181-2/+3
| | | | Reduce size of tests that run for more than 1s in short mode.
* prog: support disabled attributeDmitry Vyukov2020-05-041-5/+6
| | | | | Update #477 Update #502
* prog: remove StructDescDmitry Vyukov2020-05-031-15/+13
| | | | | | | | | | | | Remove StructDesc, KeyedStruct, StructKey and all associated logic/complexity in prog and pkg/compiler. We can now handle recursion more generically with the Ref type, and Dir/FieldName are not a part of the type anymore. This makes StructType/UnionType simpler and more natural. Reduces size of sys/linux/gen/amd64.go from 5201321 to 4180861 (-20%). Update #1580
* prog: remove Dir from TypeDmitry Vyukov2020-05-011-2/+2
| | | | | | | | | | | | | | | | | | Having Dir is Type is handy, but forces us to duplicate lots of types. E.g. if a struct is referenced as both in and out, then we need to have 2 copies and 2 copies of structs/types it includes. If also prevents us from having the struct type as struct identity (because we can have up to 3 of them). Revert to the old way we used to do it: propagate Dir as we walk syscall arguments. This moves lots of dir passing from pkg/compiler to prog package. Now Arg contains the dir, so once we build the tree, we can use dirs as before. Reduces size of sys/linux/gen/amd64.go from 6058336 to 5661150 (-6.6%). Update #1580
* prog: add test for truncateToBitSizeDmitry Vyukov2020-03-241-0/+21
|
* prog: control program lengthDmitry Vyukov2020-03-131-4/+6
| | | | | | | | | | | | | | | | | | | 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: tune flags generation/mutationDmitry Vyukov2020-01-181-0/+56
| | | | | Tune flags to generate more sane values over insane values based on examination of results for common cases.
* syz-manager: fix unwanted syscalls that were enabledVeronica Radu2019-09-241-0/+22
| | | | Update #1424
* prog: use type size when generating/mutating intsVeronica Radu2019-09-231-0/+21
| | | | Update #1381
* prog: remove several sources of non-determinismDmitry Vyukov2019-01-031-0/+46
| | | | | | | | | | | | | | Non-determinism is bad: - it leads to flaky coverage reports - it makes test failures non-reproducible Remove 4 sources of non-determinism related to maps: - file name generation - string generation - resource generation - hints generation All a test that ensures all main operations are fully deterministic.
* prog: prevent sandbox escaping files from entering s.filesGreg Steuck2018-11-271-0/+26