1586 Commits

Author SHA1 Message Date
Dmitry Vyukov
2cf0659df1 sys: don't assume vma size is 8
Use explicit size for vma.
This is the last use of hardcoded ptrSize in sys package.
2017-09-04 20:25:22 +02:00
Dmitry Vyukov
4ee497d22e pkg/compiler: use correct arch ptr size 2017-09-04 20:25:22 +02:00
Dmitry Vyukov
8c64b078d1 pkg/compiler: detect resources without ctors
Fixes #217
2017-09-04 20:25:22 +02:00
Dmitry Vyukov
b06c1bd324 pkg/compiler: verify validity of len targets
Update #217
2017-09-04 20:25:22 +02:00
Dmitry Vyukov
8094a4202f pkg/compiler: move checking code to a separate file 2017-09-04 20:25:22 +02:00
Dmitry Vyukov
f29b943c0b pkg/compiler: detect recursive struct declarations
Update #217
2017-09-04 20:25:22 +02:00
Dmitry Vyukov
f400a0da0f pkg/ast: fix struct comment parsing 2017-09-04 20:25:03 +02:00
Dmitry Vyukov
a54dce007d sys: allow custom size for PtrType
This is required to support ptr64 type.
2017-09-02 14:08:30 +02:00
Dmitry Vyukov
08c91ab698 sys: support ptr64 type
ptr64 is like ptr, but always takes 8 bytes of space.
Needed for some APIs. Unfortunately, most of these APIs
use buffer type, so we can't use ptr64 immidiately.
2017-09-02 13:44:28 +02:00
Dmitry Vyukov
9c995bedad sys: improve bpf descriptions 2017-09-02 13:38:16 +02:00
Dmitry Vyukov
2c0b7b7ff3 pkg/compiler: restore generation of unsupported syscalls
Unfortunately this is sitll needed, see the added comment.

Update #191
2017-09-02 13:21:47 +02:00
Dmitry Vyukov
a7206b24ca pkg/compiler: check and generate types
Move most of the logic from sysgen to pkg/compiler.

Update #217
2017-09-02 13:06:53 +02:00
Victor Chibotaru
aa51461a34 hints: add some more tests for DataArg 2017-09-01 18:14:53 +02:00
Andrey Konovalov
76bc1b9d35 sys: add AF_PACKET sockets description 2017-09-01 17:17:33 +02:00
Victor Chibotaru
d9a07bf6e9 hints: add new mutations and tests 2017-09-01 17:17:08 +02:00
Andrey Konovalov
70ab363e79 Update linux_kernel_reporting_bugs.md 2017-09-01 13:58:35 +02:00
Andrey Konovalov
83f1ca5484 Update linux_kernel_reporting_bugs.md 2017-09-01 13:55:37 +02:00
Dmitry Vyukov
4ccdd78294 sys: export struct/union attributes
Export struct/union attributes so that they can be filled in
by a different package.
2017-08-31 19:21:52 +02:00
Dmitry Vyukov
5a093b74f6 sys: change proc arguments to the format used by const/flags/len
All other types have optional underlying type as the last argument.
Proc have it as first. This creates very irregular syntax and
complicates parsing. Make type the last argument.

Note: this is a breaking change if you have descriptions on the side.
2017-08-31 14:31:21 +02:00
Thomas Garnier
ed7f95981b Fix reboot support for VM isolated
Do not fail a reboot if the reboot command returns an error. Reduces the
wait time per ssh commands to 30 seconds.

Signed-off-by: Thomas Garnier <thgarnie@google.com>
2017-08-30 19:30:38 +02:00
Victor Chibotaru
49c11eb514 ipc, prog, fuzzer, execprog: add hints generation code
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.
2017-08-30 18:40:14 +02:00
Victor Chibotaru
07c84b670b executor, ipc: modify the IO between KCOV<->executor<->fuzzer
Now executor is able to read comparisons data from KCOV and write them
to fuzzer.
2017-08-30 18:40:14 +02:00
Victor Chibotaru
1336586b42 executor, fuzzer: change the way Syzkaller opens the KCOV device
We have implemented a new version of KCOV, which is able to dump
comparison operands' data, obtained from Clang's instrumentation hooks
__sanitizer_cov_trace_cmp[1248], __sanitizer_cov_trace_const_cmp[1248]
and __sanitizer_cov_trace_switch.

Current KCOV implementation can work in two modes: "Dump only the PCs"
or "Dump only comparisons' data". Mode selection is done by the
following series of calls:

fd = open(KCOV_PATH, ...); // works as previous
ioctl(fd, KCOV_INIT_TRACE, ...); // works as previous
mmap(fd, ...); // works as previous
ioctl(fd, KCOV_ENABLE, mode);
// mode = KCOV_MODE_TRACE_CMP or mode = KCOV_MODE_TRACE_PC

Note that this new interface is backwards compatible, as old KCOV
devices will just return -EINVAL for the last ioctl. This way we can
distinguish if the KCOV device is able to dump the comparisons.

Main changes in this commit:
    1. Fuzzer now checks at startup which type (new/old) of KCOV device
is running.
    2. Executor now receives an additional flag, which indicates if
executor should read the comparisons data from KCOV. The flag works on
per-call basis, so executor can collect PCs or Comps for each
individual syscall.
2017-08-30 18:40:14 +02:00
Dmitry Vyukov
1d0002255d pkg/report: don't confuse "DEBUG:" with "BUG:"
Android sometimes prints "Boot_DEBUG:" during boot,
which we confuse with "BUG:".
2017-08-30 14:16:27 +02:00
Dmitry Vyukov
be2917712f pkg/compiler: actually tolerate unsupported consts
The previous commit removes errors on unsupported structs/resources,
but their usages still error. Fix that.
2017-08-28 19:00:31 +02:00
Dmitry Vyukov
0b652d7278 pkg/compiler: tolerate unsupported consts everywhere
Currently unsupported consts in structs and resources break build.
However, that can well happen for arch-specific devices (e.g. Android).
Make this non-fatal as it used to be.
2017-08-28 16:04:54 +02:00
Dmitry Vyukov
4074aed7c0 pkg/compiler: more static error checking
Update #217
2017-08-27 20:19:41 +02:00
Zubin Mithra
5857966468 docs: fix syz-headerparser documentation
Remove the --device option from the documentation file
docs/hedaerparser_usage.md
2017-08-27 18:17:00 +02:00
Dmitry Vyukov
e2ffb4fc91 pkg/compiler: move more const-processing code to compiler 2017-08-27 15:28:49 +02:00
Dmitry Vyukov
e71c87fbf5 sys/syz-sysgen: remove dead code 2017-08-27 12:04:16 +02:00
Dmitry Vyukov
a3857c4e90 pkg/compiler, sys/syz-sysgen: move const handling to pkg/compiler
Now pkg/compiler deals with consts.
2017-08-27 11:51:40 +02:00
Dmitry Vyukov
9ec49e082f prog: restore missing struct fields
We already do this for syscall arguments.
Helps to save some old programs after description changes.
2017-08-25 21:56:07 +02:00
Dmitry Vyukov
8f38cf7952 sys: improve tun descriptions 2017-08-25 20:44:37 +02:00
Zubin Mithra
c3631fc789 tools: add headerparser as a tool to assist in writing system call descriptions
The tool can be found inside tools/syz-headerparser. Details on how to use
headerparser can be found inside docs/headerparser_usage.md.
2017-08-25 17:23:52 +02:00
Dmitry Vyukov
3f1aca4826 executor: split a too long line 2017-08-24 10:59:27 +02:00
Dmitry Vyukov
f238fbd42d all: support i386 arch
Update #191
2017-08-19 19:17:27 +02:00
Dmitry Vyukov
6aad5879f7 sys: support arm arch
Not tested, but const extraction and build works.

Update #324
Update #191
2017-08-19 10:41:24 +02:00
Dmitry Vyukov
838e336594 sys, prog: switch values to to uint64
We currently use uintptr for all values.
This won't work for 32-bit archs.
Moreover in some cases we use uintptr but assume
that it is always 64-bits (e.g. in encodingexec).
Switch everything to uint64.

Update #324
2017-08-19 10:16:23 +02:00
Dmitry Vyukov
33b9e777cb syz-manager: remove unnecessary type conversion 2017-08-19 09:58:45 +02:00
Dmitry Vyukov
b19edae954 pkg/kernel: remove unused function 2017-08-18 20:03:52 +02:00
Dmitry Vyukov
13fd8fda08 vm/vmimpl: support linux/arm
Update #324
2017-08-18 19:24:26 +02:00
Dmitry Vyukov
4802b0fb74 sys/syz-sysgen: switch to new parser
For now we just generate the old structs from the new AST.
But this allows to delete the old parser entirely.
2017-08-18 18:47:39 +02:00
Dmitry Vyukov
19b893936b sys/syz-extract: switch to the new parser 2017-08-18 17:04:12 +02:00
Dmitry Vyukov
41bbf437e1 Makefile: enforce formatting of sys files in presubmit 2017-08-18 11:26:50 +02:00
Dmitry Vyukov
5b461e7ecd sys: reformat descriptions 2017-08-18 11:26:50 +02:00
Dmitry Vyukov
127a9c2b65 pkg/ast: new parser for sys descriptions
The old parser in sys/sysparser is too hacky, difficult to extend
and drops debug info too early, so that we can't produce proper error messages.

Add a new parser that is build like a proper language parser
and preserves full debug info for every token.
2017-08-18 11:26:50 +02:00
Dmitry Vyukov
5809a8e057 sys: fix a single case of field starting from a digit
In preparation for a stricter parser.
2017-08-18 11:26:50 +02:00
Dmitry Vyukov
172189e955 dashboard/app: heavylifting of email reporting
- save Message-ID and use In-Reply-To in subsequent messages
- remember additional CC entries added manually
- don't mail to maintainers if maintainers list is empty
- improve mail formatting and add a footer
- implement upstream/fix/dup/invalid commands over email
- add tests
2017-08-17 19:42:11 +02:00
Dmitry Vyukov
2dfba870d0 docs: add landing page for automatically reported bugs 2017-08-17 13:08:38 +02:00
Dmitry Vyukov
f93be58429 sys: add some known xattr names
Move xattr syscalls to own file and better describe xattr names.
They usually have prefix+name structure and there are some
known values.
2017-08-16 13:42:04 +02:00