Commit Graph

54 Commits

Author SHA1 Message Date
Dmitry Vyukov
ff8c0180ab sys, executor: more kvm improvements
1. Basic support for arm64 kvm testing.
2. Fix compiler warnings in x86 kvm code.
3. Test all pseudo syz calls in csource.
4. Fix handling of real code in x86.
2017-01-12 11:57:17 +01:00
Dmitry Vyukov
b8e1000d66 ifuzz: add package for generation/mutation of machine code
Add ifuzz package that can generate/mutate machine code.
It is based on Intel XED and for now supports only x86 code
(all of real, protected 16/32 and long modes).
This considerably increases KVM coverage.
2017-01-09 20:28:27 +01:00
Dmitry Vyukov
bbd4840872 sys: extend kvm support
Add new pseudo syscall syz_kvm_setup_cpu that setups VCPU into
interesting states for execution. KVM is too difficult to setup otherwise.
Lots of improvements possible, but this is a starting point.
2017-01-09 20:28:10 +01:00
Dmitry Vyukov
244c5f60fd prog: spoof resources less frequently
Passing -1 as file descriptors and passing wrong types
proved to be not very intersting.
2017-01-09 20:20:49 +01:00
Dmitry Vyukov
94b38efc1d sys: allow to specify number of pages for vma type
Allows to write vma[4] or vma[5-10] to specify desired number of pages.
2017-01-09 20:20:48 +01:00
Andrey Konovalov
55e1e51c1c prog: remove unused inport() and inaddr() 2016-11-29 17:46:02 +01:00
Andrey Konovalov
2429a7b034 sys: move sockaddr description to templates 2016-11-29 16:39:02 +01:00
Andrey Konovalov
86917cc3a7 sys: move in_addr description to templates 2016-11-29 16:39:02 +01:00
Andrey Konovalov
253a40f30d sys: add proc type to denote per proccess integers 2016-11-25 17:51:41 +01:00
Andrey Konovalov
fa9c44b568 prog: minimize based on individual args 2016-11-25 17:22:42 +01:00
Dmitry Vyukov
3a65453870 sys: allow to specify buffer size for strings
This allows to write:
  string[salg_type, 14]
which will give a string buffer of size 14 regardless of actual string size.

Convert salg_type/salg_name to this.
2016-11-11 14:34:41 -08:00
Dmitry Vyukov
588a542b2a sys: add string flags
Allow to define string flags in txt descriptions. E.g.:

  filesystem = "ext2", "ext3", "ext4"

and then use it in string type:

  ptr[in, string[filesystem]]
2016-11-11 14:33:37 -08:00
Dmitry Vyukov
f085c198ba sys: replace FileoffType with IntType{Kind: IntFileoff}
FileoffType is effectively an int, no need for a separate type.
Also remove fd option from fileoff as it is unused and use story is unclear.
2016-11-11 14:32:38 -08:00
Dmitry Vyukov
8b731ed4b7 sys: replace FilenameType with BufferType{Kind: BufferFilename}
FilenameType is effectively a buffer, there is no need for a separate type.
2016-11-11 14:32:19 -08:00
Dmitry Vyukov
b40d502736 prog: remote Type argument from Arg.Size/Value
They are not necessary since we now always have types attached to args.
Also remove sys.Type.InnerType as it is not necessary now as well.
2016-11-11 14:31:55 -08:00
Dmitry Vyukov
1838728cc1 prog: simplify assignSizes
Now that we always have types attached to args,
assignSizes can be considerably simplified.
2016-11-11 14:30:20 -08:00
Dmitry Vyukov
1a85811d68 prog: assign types to args during construction
Eliminate assignTypeAndDir function and instead assign
types to all args during construction.
This will allow considerable simplifation of assignSizes.
2016-11-11 14:29:52 -08:00
Dmitry Vyukov
d3a93e8370 sys: attach Dir to all types
Dir is a static info, so we don't need to compute, propagate and
attach it in prog whenever we generate/change programs.
Attach Dir to all types.
2016-11-11 14:27:54 -08:00
Dmitry Vyukov
959ec07095 sys: always use pointers to types
Currently we store most types by value in sys.Type.
This is somewhat counter-intuitive for C++ programmers,
because one can't easily update the type object.
Store pointers to type objects for all types.
It also makes it easier to update types, e.g. adding paddings.
2016-11-11 14:25:13 -08:00
Dmitry Vyukov
be566e352b prog: go fmt 2016-10-16 08:15:24 +02:00
Andrey Konovalov
78f79fee93 Refactor & improve len type handling 2016-10-11 20:09:19 +02:00
Andrey Konovalov
c99cbdbe58 Emit BufferBlob for array[int8] 2016-10-04 18:49:57 +02:00
Dmitry Vyukov
d18f8aa366 Merge pull request #73 from xairy/ranged_arrays
Allow range sized arrays
2016-09-19 19:42:00 +02:00
Andrey Konovalov
36d9371a19 prog: return struct size when generating args 2016-09-19 16:33:32 +02:00
Andrey Konovalov
f41935d53f Allow range sized arrays 2016-09-19 16:16:24 +02:00
Dmitry Vyukov
852e3d2eae sys: support recursive structs
A struct can have a pointer to itself directly or indirectly.
Currently it leads to inifinite recursion when generating descriptions.
Fix this.
2016-09-05 12:49:47 +02:00
Dmitry Vyukov
27b03f4ba3 prog: generate shifted integers with some probability
Useful for bitfield-like integers.
2016-09-01 17:17:37 +02:00
Dmitry Vyukov
7690667267 sys: specify resources in text descriptions
Currently to add a new resource one needs to modify multiple source files,
which complicates descirption of new system calls.
Move resource descriptions from source code to text desciptions.
2016-08-27 18:27:50 +02:00
Dmitry Vyukov
0d0fbbe73f overhaul syscall description generation process
This splits generation process into two phases:
1. Extract values of constants from linux kernel sources.
2. Generate Go code.

Constant values are checked in.
The advantage is that the second phase is now completely independent
from linux source files, kernel version, presence of headers for
particular drivers, etc. This allows to change what Go code we generate
any time without access to all kernel headers (which in future won't be
limited to only upstream headers).

Constant extraction process does require proper kernel sources,
but this can be done only once by the person who added the driver
and has access to the required sources. Then the constant values
are checked in for others to use.
Consant extraction process is per-file/per-arch. That is,
if I am adding a driver that is not present upstream and that
works only on a single arch, I will check in constants only for
that driver and for that arch.
2016-08-26 07:09:25 +02:00
Dmitry Vyukov
08e664c044 prog: generate SIGSEGVs with lower probability
Addresses that trigger SIGSEGV does not seem to uncover any bugs.
But they crash executor preventing programs from being executed.
Lower probability of generating addresses that lead to SIGSEGVs.
2016-08-13 15:28:07 -07:00
Dmitry Vyukov
7460de4a28 prog: generate ints outside of the specified range once in a while 2016-08-13 09:04:19 -07:00
Dmitry Vyukov
3b9fe41fe3 reformat sources 2016-08-13 09:02:44 -07:00
Baozeng Ding
7db2edcb33 sys/sysgen/prog: support ranged int
This commit supports inclusive ranged int, like foo int32[-10~10], which will
generate random integer between -10 and 10. In future we will support more than
one range, like int32[0, -5~10, 50, 100~200]
2016-08-10 13:43:15 +08:00
Dmitry Vyukov
71d0faff8c prog: add more filesystem names 2016-02-05 22:12:15 +01:00
Dmitry Vyukov
5dfefdb158 sys: fix write$tun description
Also remove \r in files.
2016-01-26 17:48:13 +01:00
Dmitry Vyukov
8bdf62d1b7 sys: implement array byte size arguments 2016-01-23 00:37:08 +01:00
Dmitry Vyukov
f675d35c97 prog: add some magic integers 2016-01-13 17:23:41 +01:00
Dmitry Vyukov
92bcba4b0b sys: implement fixed-size arrays 2015-12-30 19:43:15 +01:00
Dmitry Vyukov
28b3d1e1ab sys: add sctp support 2015-12-30 13:04:00 +01:00
Dmitry Vyukov
e6529b30ec sys: add union type 2015-12-29 15:00:57 +01:00
Dmitry Vyukov
b17c5726f6 sys: support for AF_UNIX sockets 2015-12-28 19:11:03 +01:00
Dmitry Vyukov
4eda9b07e5 prog: don't serialize paddings
Paddings in serialized programs are unnecessary and confusing.
Instead restore them implicitly.
Also use [,,,,] for arrays.
2015-12-28 12:58:10 +01:00
Dmitry Vyukov
4d3db6d4c8 host: detect unsupported syscalls
Also detect transitively unsupported syscalls,
that is, syscalls for which all syscalls that can create
input arguments are disabled.
2015-12-27 12:20:00 +01:00
Dmitry Vyukov
c4b809f85f sys: add support for PF_ALG 2015-12-17 14:38:46 +01:00
Dmitry Vyukov
9d1895c1bd add support for bpf syscall 2015-11-29 11:05:08 +01:00
Dmitry Vyukov
6892001bbc add tty-related ioctl's 2015-11-16 19:14:05 +01:00
Dmitry Vyukov
e9cf3f5aa1 minor tweaks to program generation heuristics 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
f8f416fb8f preliminary description of kdbus syscalls 2015-10-16 18:16:10 +02:00
Dmitry Vyukov
8d0aa4f7c0 improvements for kdbus 2015-10-15 17:59:01 +02:00
Dmitry Vyukov
c9b915608d initial support for call priorities 2015-10-14 16:55:09 +02:00