aboutsummaryrefslogtreecommitdiffstats
path: root/prog/clone.go
Commit message (Collapse)AuthorAgeFilesLines
* prog: fix validation of DataMmapProgDmitry Vyukov2024-05-061-0/+8
| | | | | | | Allow to serialize/deserialize DataMmapProg and fix validation in debug mode. Fixes #4750
* prog: optimize resourceCentric()Aleksandr Nogikh2024-03-201-1/+4
| | | | | | | | | In practice, we need to try out many different corpus programs before we may find a matching resource. It's very inefficient to Clone() each of them. This change gives a +76% speed improvement in the BenchmarkMutate() test.
* sys/linux: clone args before mutationAleksandr Nogikh2024-03-131-0/+4
| | | | | | | | Not cloning the argument results in replaceArg() replacing a union argument with itself, which may lead to inconsistent resource references. Add an assertion to detect such cases in the future.
* Revert "sys/linux: clone args before mutation"Aleksandr Nogikh2024-03-081-4/+0
| | | | This reverts commit 4097c8d7a8596ddbc9a9db7b7f39c5cbdb1bd742.
* sys/linux: clone args before mutationAleksandr Nogikh2024-03-081-0/+4
| | | | | | | | Not cloning the argument results in replaceArg() replacing a union argument with itself, which may lead to inconsistent resource references. Add an assertion to detect such cases in the future.
* prog: add a new DupCallCollide collide typeAleksandr Nogikh2023-02-141-11/+15
| | | | | | | | | | | | | | | | | | | | | | It duplicates random calls in a program and makes the duplicated copies async. E.g. it could transform r0 = test() test2(r0) to r0 = test() test2(r0) (async) test2(r0) or test() (async) r0 = test() test2(r0)
* all: add the `DoubleExecCollide` strategyAleksandr Nogikh2021-12-101-9/+19
| | | | | | | | | | Add a strategy that resembles the previous collide mode, but detaches not every other call, rather all calls during the second execution (or at least as much as possible). Follow the strategy for 33% of all collide executions. It was shown during the experiments that this strategy has a positive effect on the number of discovered crashes and bugs.
* all: introduce call propertiesAleksandr Nogikh2021-09-221-0/+1
| | | | | | | | | Call properties let us specify how each individual call within a program must be executed. So far the only way to enforce extra rules was to pass extra program-level properties (e.g. that is how fault injection was done). However, it entangles the logic and not flexible enough. Implement an ability to pass properties along with each individual call.
* prog: extend panic messagesDmitry Vyukov2019-11-261-1/+5
| | | | We see this panic firing sometimes. Print the actual arg.
* prog: introduce debugValidateDmitry Vyukov2018-08-021-5/+1
| | | | | | Move debug validation into a separate function. Update #538
* prog: make c.Ret optionalDmitry Vyukov2018-05-051-1/+3
| | | | | No reason to allocate return value if there is no return type. c.Ret == nil is the reasonable indication that this is a "void" call.
* prog: simplify codeDmitry Vyukov2018-05-051-16/+13
| | | | | | Now that we don't have ReturnArg and only ResultArg's refer to other ResultArg's we can remove ArgUser/ArgUsed and devirtualize lots of code.
* prog: remove ReturnArgDmitry Vyukov2018-05-051-4/+0
| | | | It's not all that needed.
* prog: don't serialize output data argsDmitry Vyukov2017-12-171-1/+1
| | | | | | | | Fixes #188 We now will write just ""/1000 to denote a 1000-byte output buffer. Also we now don't store 1000-byte buffer in memory just to denote size. Old format is still parsed.
* prog: speedup and simplify hints codeDmitry Vyukov2017-12-081-19/+14
| | | | | | | | | | | | | Clone program only once. Preallocate slices in clone. Remove the clone full mode. Always mutate args in place. Allocate replacers map lazily. Don't allocate res map at all (calculate valus on the go). Remove sliceToUint64, pad. benchmark old ns/op new ns/op delta BenchmarkHints 122100048 7466013 -93.89%
* prog: remove default target and all global stateDmitry Vyukov2017-09-151-1/+3
| | | | | | 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.
* ipc, prog, fuzzer, execprog: add hints generation codeVictor Chibotaru2017-08-301-7/+14
| | | | | | | | | | | | | | | | | | | | | | A hint is basically a tuple consisting of a pointer to an argument in one of the syscalls of a program and a value, which should be assigned to that argument. A simplified version of hints workflow looks like this: 1. Fuzzer launches a program and collects all the comparisons' data for every syscall in the program. 2. Next it tries to match the obtained comparison operands' values vs. the input arguments' values. 3. For every such match the fuzzer mutates the program by replacing the pointed argument with the saved value. 4. If a valid program is obtained, then fuzzer launches it and checks if new coverage is obtained. This commit includes: 1. All the code related to hints generation, parsing and mutations. 2. Fuzzer functions to launch the process. 3. Some new stats gathered by fuzzer and manager, related to hints. 4. An updated version of execprog to test the hints process.
* prog: split Arg into smaller structsAndrey Konovalov2017-07-171-25/+54
| | | | | | | | | | | | | | | | | | | | | | 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: validate deserialized programsDmitry Vyukov2017-01-241-2/+4
| | | | | | | The optimization change removed validation too aggressively. We do need program validation during deserialization, because we can get bad programs from corpus or hub. Restore program validation after deserialization.
* all: spot optimizationsDmitry Vyukov2017-01-201-2/+4
| | | | | | | | | | | | | A bunch of spot optmizations after cpu/memory profiling: 1. Optimize hot-path coverage comparison in fuzzer. 2. Don't allocate and copy serialized program, serialize directly into shmem. 3. Reduce allocations during parsing of output shmem (encoding/binary sucks). 4. Don't allocate and copy coverage arrays, refer directly to the shmem region (we are not going to mutate them). 5. Don't validate programs outside of tests, validation allocates tons of memory. 6. Replace the choose primitive with simpler switches. Choose allocates fullload of memory (for int, func, and everything the func refers). 7. Other minor optimizations.
* prog: assign types to args during constructionDmitry Vyukov2016-11-111-1/+0
| | | | | | Eliminate assignTypeAndDir function and instead assign types to all args during construction. This will allow considerable simplifation of assignSizes.
* sys: add union typeDmitry Vyukov2015-12-291-0/+2
|
* initial commitDmitry Vyukov2015-10-121-0/+49