aboutsummaryrefslogtreecommitdiffstats
path: root/prog/minimization_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: apply linter auto fixesTaras Madan2025-07-171-3/+4
| | | | ./tools/syz-env bin/golangci-lint run ./... --fix
* prog: try to remove all unrelated calls during minimizationDmitry Vyukov2024-08-081-18/+101
| | | | | | | We have too many corpus minimization executions and the main source of these is call removal. Try to remove all "unrelated" calls at once. Unrelated calls are the calls that don't use any resources/files from the transitive closure of the resources/files used by the target call. This may significantly reduce large generated programs in a single step.
* prog: don't minimize file names for corpusDmitry Vyukov2024-08-081-18/+19
| | | | | | We have too many corpus minimization executions and for corpus we are only interested in reducing total number of args that will be considered for mutation. So don't minimize file names.
* prog: avoid duplicate programs during minimizationDmitry Vyukov2024-08-071-1/+11
| | | | | | | | Generally we try to avoid generating duplicates, but in some cases they are hard to avoid. For example, if we have an array with several equal elements, removing them leads to the same program. So check for duplicates explicitly.
* prog: don't minimize int/resource for corpusDmitry Vyukov2024-08-071-4/+4
| | | | | | | | | It makes little sense to minimize int's for corpus. Also replacing resource with a default value does not make sense as well. For corpus we are only interesting in reducing total number of args that will be considered for mutation. Add CrashSnapshot mode, mainly to keep the minimization code "alive" for now.
* prog: replace MinimizeParams with MinimizeModeDmitry Vyukov2024-08-071-4/+8
| | | | | | | | | | | | | | 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: make minimization parameters explicitAleksandr Nogikh2024-05-271-3/+3
| | | | Add an explicit parameter to only run call removal.
* 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: don't pass uncompressed zlib sizeDmitry Vyukov2022-11-231-2/+2
| | | | | | This will allow us to mutate the image size. Fixes #3527
* sys/linux, tools/syz-imagegen: update `syz_mount_image` to use ↵Hrutvik Kanabar2022-11-211-2/+2
| | | | | | | | | | | | | | | | `compressed_image` Rather than accepting "segments", `syz_mount_image` now accepts a compressed image. Since this is already a corpus-breaking change, also rearrange the arguments so that the image is at the end. This makes it easier to inspect what the other arguments are set to. We need to increase the timeout associated with `syz_mount_image`, as decompression and execution take a little longer. 5000ms should be very generous. This commit updates the descriptions and the `syz-imagegen` tool. The executor, seed images, and asset saving will be updated in future commits.
* executor: move syz_mount_image's sanity checks to syz-fuzzerAleksandr Nogikh2022-09-271-2/+2
| | | | | It will simplify the C code and let us extract the raw images in a more convenient way.
* sys/linux: make `syz_mount_image` a `no_minimize` syscallHrutvik Kanabar2022-09-221-0/+12
| | | | | | | | Minimizing of large images is time-consuming and unlikely to reproduce any errors. This commit therefore marks the `syz_mount_image` pseudo-syscall as ineligible for minimization. A test has also been added to `prog/minimization_test.go`.
* prog: generate very long file namesDmitry Vyukov2022-08-101-0/+12
| | | | | Generate very long file names once in a while to provoke bugs like: https://github.com/google/gvisor/commit/f857f268eceb1cdee0b2bdfa218c969c84033fcd
* all: add the `rerun` call propertyAleksandr Nogikh2021-12-101-0/+23
| | | | | | | | | | | | | | To be able to collide specific syscalls more precisely, we need to repeat the process many times. Introduce the `rerun` call property, which instructs `syz-executor` to repeat the call the specified number of times. The intended use is: call1() (rerun: 100, async) call2() (rerun: 100) For now, assign rerun values randomly to consecutive pairs of calls, where the first one is async.
* all: replace collide mode by `async` call propertyAleksandr Nogikh2021-12-101-0/+22
| | | | | | | | | | | | | 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: refactor fault injection into call propsAleksandr Nogikh2021-09-221-0/+22
| | | | | | | | | | | | Now that call properties mechanism is implemented, we can refactor fault injection. Unfortunately, it is impossible to remove all traces of the previous apprach. In reprolist and while performing syz-ci jobs, syzkaller still needs to parse the old format. Remove the old prog options-based approach whenever possible and replace it with the use of call properties.
* prog: support disabled attributeDmitry Vyukov2020-05-041-2/+4
| | | | | Update #477 Update #502
* prog: don't minimize ProcType to 0Dmitry Vyukov2019-07-261-0/+8
| | | | | | | | Default value for ProcType is 0 (same for all PID's). Usually 0 either does not make sense at all or make different PIDs collide (since we use ProcType to separate value ranges for different PIDs). So don't change ProcType to 0 unless the type is explicitly marked as opt (in that case we will also generate 0 anyway).
* prog: fix updating triedPaths when minimizing resourcesAndrey Konovalov2019-07-161-1/+27
|
* prog: fix minimization bugsDmitry Vyukov2019-07-021-4/+12
| | | | | | | | | | Fix several nasty bugs in minimization that could lead to almost arbitrary results. These bugs affected both crash minimization and corpus population. Extend the randomized test to catch these bugs. Add additional asserts to code to catch similar bugs in future. Reported-by @xairy
* prog: introduce strict parsing modeDmitry Vyukov2018-12-101-1/+1
| | | | | | | | | | | 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: try to nullify pointers when minimizingAndrey Konovalov2018-11-211-3/+23
| | | | | This patch changes minimization routines to try assigning a.Res to nil for each pointer arg.
* prog: sanitize calls after hints mutationDmitry Vyukov2018-07-121-3/+3
| | | | | | | | Hints mutation could produce unsanitized calls. Sanitize calls after hints mutation. Also sanitize on load (in validate), because bad programs can already be in corpuses. And it's just the right thing to do because sanitization rules can change over time.
* prog: deduplicate minimization testDmitry Vyukov2018-05-071-16/+9
| | | | Update #538
* executor: use proper default values for resourcesDmitry Vyukov2018-02-261-2/+2
| | | | | | | | | We currently use -1 as default value for resources when the actual value is not available. -1 is good for fd's, but is not the right default value for pointers/keys/etc. Pass from prog and use in executor proper default value for resources.
* prog: rework address allocationDmitry Vyukov2018-02-191-16/+0
| | | | | | | | | | | | 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-0/+174