Commit Graph

343 Commits

Author SHA1 Message Date
Dmitry Vyukov
0d231ceb73 syz-fuzzer: refactor
syz-fuzzer organically grew from a small nice main function
into a huge single-file monster with tons of global state.

Start refactoring it into something more managable.
This change separates 2 things:
1. Proc: a single fuzzing process (ipc.Env wrapper).
2. WorkQueue: holds global non-fuzzing work items.
More work needed, but this is good first step.
2017-12-18 09:50:17 +01:00
Dmitry Vyukov
c5826ff7aa pkg/ipc: make threaded/collide per-program options
Currently threaded/collide are global environment flags.
It can be useful to turn off collider during some executions
(minimization, triage, etc).
Make them per-program options.
2017-12-17 11:39:14 +01:00
Dmitry Vyukov
dcd99c6fd1 tools: fix create-image.sh
Uncomment unintentionally commented out lines from a previous commit.
2017-12-08 13:20:50 +01:00
Dmitry Vyukov
5c1e6a291b tools/syz-execprog: extend hints output
Print call number because one is usually interested
in a particular call only.
2017-12-08 10:25:41 +01:00
Dmitry Vyukov
c0e5b8c81f tools: include selinux packages when building images
These packages are required to actually activate selinux during boot.
2017-12-08 10:19:09 +01:00
Dmitry Vyukov
eddaedbb9c tools/syz-crush: fix for new multi-target world 2017-11-30 10:20:34 +01:00
Dmitry Vyukov
29b0fd90e6 pkg/report: include Maintainers into report
Currently getting a complete report requires a complex,
multi-step dance (including getting information that
external users are not interested in -- guilty file).

Simplify interface down to 2 functions: Parse and Symbolize.
Parse does what it did before, Symbolize symbolizes report
and fills in maintainers. This simplifies both implementations
of Reporter interface and all users of the interface.

Potentially we could get this down to 1 function Parse
that does everything. However, (1) Symbolize can fail,
while Parse cannot, (2) usually we want to ignore (log)
Symbolize errors, but otherwise proceed with the report,
(3) repro does not need symbolization for all but the
last report.
2017-11-29 18:24:30 +01:00
Dmitry Vyukov
34f2c2332b pkg/report: add Output to Report
Whole raw output is indivisble part of Report,
currently we always pass Output separately along with Report.
Make Output a Report field.

Then, put whole Report into manager Crash and repro context and Result.
There is little point in passing Report as aa bunch of separate fields.
2017-11-29 14:36:51 +01:00
Dmitry Vyukov
afba0b55e6 sys/linux: add binder descriptions 2017-11-27 15:09:30 +01:00
Andrey Konovalov
6834199b8c pkg/report: various corrupted report detection improvements 2017-11-23 16:17:40 +01:00
Dmitry Vyukov
ad0af9fff5 vm: return Report from MonitorExecution
This allows callers to get access to Report.Corrupted.
Better than adding 6-th return value and will allow
to pipe other report properties if necessary.
2017-11-21 19:02:35 +01:00
Dmitry Vyukov
4bd78cef05 pkg/report, pkg/repro, syz-manager: name crash attributes consistently
We currently have several names for crash attributes, which is disturbing.
E.g. crash title is called "Title" or "Desc". Name them consistently.

Title - single line bug identity.
Report - whole crash text.
Log - whole fuzzer/kernel output.
2017-11-14 10:04:22 +01:00
Dmitry Vyukov
10112655d7 vm: remove needOutput arg for MonitorExecution
Always wait 10 secs for output.
If anything this can only lead to missed crashes during repro.
Let's unify manager and repro behavior.
2017-11-14 09:45:34 +01:00
Dmitry Vyukov
7a53e7e35d pkg/report: combine report data into a struct
Parse returns 5 variables now. Later we may want to add crash "priority".
Introduce Report struct that holds all report data.
2017-11-14 09:41:55 +01:00
Andrey Konovalov
f9a8d567eb pkg/report: add corrupted report detection
This change makes pkg/report try to detect corrupted reports by
using some heuristics.
2017-11-13 17:18:16 +03:00
Andrey Konovalov
a2c64463a2 execprog: correctly handle fault injections
syz-execprog doesn't utilize info about fault injections from a prog log.
Since syz-execprog is used by the repro package to reproduce crashes,
crashes caused by fault injections might not reproduce.
2017-11-07 16:17:18 +01:00
Dmitry Vyukov
d5a1adcc06 tools/syz-execprog: allow to override target OS
This is currently useful for akaros, which is tested remotely.
2017-11-06 15:01:28 +01:00
Andrey Konovalov
26d265c811 docs, tools: add local link checker
This commit adds tools/check_links.py script, that checks that all local
links from documentation files are valid; fixes some of the invalid links
that we had; and makes travis buildbot check them as well.
2017-10-27 10:04:34 +02:00
Dmitry Vyukov
8fa0c867d4 syz-fuzzer: generates hints only for the call that gave new coverage
During smashing we know what call gave new coverage,
so we can concentrate just on it.
This helps to reduce amount of hints generated (we have too many of them).
2017-10-23 09:59:39 +02:00
Dmitry Vyukov
54ae9c6db3 tools/syz-execprog: print total number of comps/hints 2017-10-23 09:59:39 +02:00
Dmitry Vyukov
85c802e4cf pkg/report: support multiple OSes
Introduce report.Reporter interface.
Add an implementation per-OS.
Make users be explicit about OS they are testing.
2017-10-18 12:01:24 +02:00
Dmitry Vyukov
a8a0b01a8b tools/syz-mutate: allow to specify target 2017-10-17 10:54:19 +02:00
Dmitry Vyukov
aa2533b98d tools/syz-prog2c: allow to specify target OS 2017-10-16 14:21:54 +02:00
Dmitry Vyukov
9444f97045 tools/syz-stress: allow to specify target OS 2017-10-16 14:21:54 +02:00
Dmitry Vyukov
d49f04b345 tools/syz-prog2c: import targets
Currently syz-prog2c is broken as it does not import any targets.
Import sys package.
2017-10-02 13:57:04 +02:00
Dmitry Vyukov
64b6c0724d sys/windows: add more descriptions 2017-09-27 20:17:09 +02:00
Dmitry Vyukov
913d592f97 all: more assorted fuchsia support 2017-09-22 13:10:55 +02:00
Dmitry Vyukov
8cb7d3dcfc all: initial support for fuchsia
Nothing works, but builds.

Update #191
2017-09-20 21:19:29 +02:00
Dmitry Vyukov
52a33fd516 prog: remove default target and all global state
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.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
c0cabacda7 syz-fuzzer, syz-execprog: add -arch flag
arch flag specifies target arch, which can be different from GOARCH.
For example, 386 executor with amd64 fuzzer.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
f7b1163afb syz-manager/mgrconfig: explicitly specify target in config
Add target config parameter (e.g. linux/amd64) which controls target OS/arch.
No more explicit assumptions about target.
2017-09-15 16:02:37 +02:00
Dmitry Vyukov
ffe7e17368 prog, sys: move types to prog
Large overhaul moves syscalls and arg types from sys to prog.
Sys package now depends on prog and contains only generated
descriptions of syscalls.
Introduce prog.Target type that encapsulates all targer properties,
like syscall list, ptr/page size, etc. Also moves OS-dependent pieces
like mmap call generation from prog to sys.

Update #191
2017-09-05 15:52:42 +02:00
Dmitry Vyukov
5db39ab953 sys: rename Call to Syscall
In preparation for moving sys types to prog
to avoid confusion between sys.Call and prog.Call.
2017-09-05 10:38:22 +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
Dmitry Vyukov
4074aed7c0 pkg/compiler: more static error checking
Update #217
2017-08-27 20:19:41 +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
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
41bbf437e1 Makefile: enforce formatting of sys files in presubmit 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
a0330c0f5e tools/create-gce-image.sh: explicitly specify target for grub
On most distributions default grub target is i386-pc, which works.
However, on some default is x86_64-efi, which fails with:

grub-install: error: cannot find EFI directory.

Explicitly specify i386-pc target.
2017-08-11 20:04:33 +02:00
Dmitry Vyukov
ab0ced187d tools/syz-benchcmp: add execution speed
Exec total is affected by initial triage/minimize phase,
so two experiments can have the same execution speed
in the stable mode, but have constant diff due to the initial phase.
The one that is higher looks better, but that's not very important.
Provide execution speed characteristic that is not affected
by initial phase. It is not displayed by default.
2017-08-10 19:31:15 +02:00
Dmitry Vyukov
5766dbe796 syz-dash, syz-gce: remove
This is now superseded by dashboard/app and syz-ci.
2017-08-02 19:50:48 +02:00
Dmitry Vyukov
7c1ee0634b tools/create-gce-image.sh: ignore SIGINT
If the script is aborted at an unfortunate point, it leaves the whole system broken.
E.g. we've seen that fdisk cannot update partition table until the next reboot.
If you really need to kill it, use a different signal. But better wait.
2017-07-17 14:45:41 +02:00
Dmitry Vyukov
8382eb648f pkg/kernel: actually pass cmdline/sysctl files to the build script 2017-07-17 14:45:41 +02:00
Dmitry Vyukov
cc1c342923 syz-ci: allow to specify cmdline/sysctls
Allow to specify per-kernel command line and sysctl values
to more closely mimic the target kernel.
2017-07-17 12:39:11 +02:00
Dmitry Vyukov
558280a686 tools/create-image.sh: create 2G images
1G does not seem to be enough.
Create 2G images as we do in create-gce-image.sh.
2017-07-17 09:56:08 +02:00
Dmitry Vyukov
a7b199253f all: use consistent file permissions
Currently we have unix permissions for new files/dirs
hardcoded throughout the code base. Some places use 0644,
some - 0640, some - 0600 and a variety of other constants.

Introduce osutil.MkdirAll/WriteFile that use the default
permissions and use them throughout the code base.

This makes permissions consistent and also allows to easily
change the permissions later if we change our minds.

Also merge pkg/fileutil into pkg/osutil as they become
dependent on each other. The line between them was poorly
defined anyway as both operate on files.
2017-07-03 14:00:47 +02:00
Dmitry Vyukov
51a013e7b9 tools/syz-symbolize: add report mode
Currently syz-symbolize symbolizes whole input file.
Add a new mode (controlled with -report flag) when
it prints report as would be extracted by syz-manager.
2017-06-30 15:17:42 +02:00
Zach Riggle
c30c1ddc7b Fix incorrect argument in syz-tty (#260) 2017-06-27 16:55:11 +02:00
Dmitry Vyukov
f6267bfc36 tools/syz-tty: add utility for testing of usb console reading code 2017-06-26 16:22:29 +02:00
Dmitry Vyukov
9af3153420 syz-dash/dashboard: move from dashboard
Move the old dashboard API into syz-dash
to get it out of the way of the new dashboard.
2017-06-23 15:22:34 +02:00
raminfp
90d10743fc Added GCC and glibc 2017-06-22 17:22:32 +04:30
Dmitry Vyukov
e130d95518 vm/gce: accept un-tar-ed image
vm/gce differs from other VM types in that it accepts image
in a weird, GCE-specific format (namely, image named disk.raw
is put into .tar.gz file). This makes it impossible to write
generic code that creates images for any VM types.

Make vm/gce accept just image like e.g. vm/qemu
and handle own specifics internally.
2017-06-17 17:06:29 +02:00
Dmitry Vyukov
de258e6d7e tools/create-gce-image.sh: don't use verbose output for tar invocation 2017-06-17 15:25:29 +02:00
Dmitry Vyukov
97b58e7eae syz-manager/mgrconfig: move sshkey from vm config to manager config
Sshkey is a property of image, which is in manager config.
Move sshkey to the same location as image.

The motivation for the move is as follows.
Continuous build produces an image and the key,
both need to be passed manager instance.
Continuous build system should not distinguish
different VM types and mess with their configs.

NOTE FOR USERS: this breaks manager configs again.
Hopefully the last time for now. Docs are updated.
2017-06-17 15:02:58 +02:00
Dmitry Vyukov
68621900a3 pkg/report: move from report 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
e8e63830a6 pkg/ipc: move from ipc 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
baad3b4b02 pkg/csource: move from csource 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
ec95d17c32 pkg/cover: move from cover 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
6fd7a75a91 pkg/repro: move from pkg 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
4b2a9e225c pkg/host: move from host 2017-06-17 14:41:15 +02:00
Dmitry Vyukov
a853b91c58 syz-manager/mgrconfig: allow loading from memory
Allow loading manager config from memory.
Follow pkg/config naming convention,
i.e. LoadFile/LoadData instead of Parse.
2017-06-17 14:41:15 +02:00
Dmitry Vyukov
75c73461d8 syz-manager/config: rename to syz-manager/mgrconfig
We have 2 packages with the same name: pkg/config and syz-manager/config.
This leads to constant clashes. We either rename one to pkgconfig or
another to mgrconfig. This is not good and will become worse when/if
we have another program-specific config in a separate package.

Rename manager config to mgrconfig.
Other program-specific configs can use the same convention
in future -- fooconfig.
2017-06-17 14:41:10 +02:00
Dmitry Vyukov
4cc7e08628 all: use osutil.IsExist instead of os.Stat 2017-06-17 12:23:52 +02:00
Dmitry Vyukov
10d9c52cf0 tools/create-gce-image.sh: add nmi_watchdog=panic to cmd line 2017-06-15 18:29:47 +02:00
Andrey Konovalov
07335203da prog2c: use 1 prog by default 2017-06-12 19:48:23 +02:00
Andrey Konovalov
120e26c2fe csourse: don't generate debug printfs 2017-06-12 19:48:23 +02:00
Andrey Konovalov
c99b02d224 csource: try to simplify repeat loop 2017-06-12 19:48:23 +02:00
Andrey Konovalov
73a895df61 csource: use sandbox only when required 2017-06-12 19:48:23 +02:00
Andrey Konovalov
10c9064bfc csource: only handle SIGSEGV when necessary 2017-06-12 19:48:23 +02:00
Andrey Konovalov
5597911fbf csource: use tmp dir only when necessary 2017-06-12 19:48:23 +02:00
Andrey Konovalov
7d7c9c550f csource: add EnableTun option 2017-06-12 19:48:23 +02:00
Andrey Konovalov
4ca73f9c87 tools: repro: fix vm count calculation 2017-06-12 18:01:38 +02:00
Andrey Konovalov
d8ff00bacc tools: repro: fix vm count calculation 2017-06-07 16:20:53 +02:00
Dmitry Vyukov
af643baa32 vm: overhaul
VM infrastructure currently has several problems:
 - Config struct is complete mess with a superset of params for all VM types
 - verification of Config is mess spread across several places
 - there is no place where VM code could do global initialization
   like creating GCE connection, uploading GCE image to GCS,
   matching adb devices with consoles, etc
 - it hard to add private VM implementations
   such impl would need to add code to config package
   which would lead to constant merge conflicts
 - interface for VM implementation is mixed with interface for VM users
   this does not allow to provide best interface for both of them
 - there is no way to add common code for all VM implementations

This change solves these problems by:
 - splitting VM interface for users (vm package) and VM interface
   for VM implementations (vmimpl pacakge), this in turn allows
   to add common code
 - adding Pool concept that allows to do global initialization
   and config checking at the right time
 - decoupling manager config from VM-specific config
   each VM type now defines own config

Note: manager configs need to be changed after this change:
VM-specific parts are moved to own "vm" subobject.

Note: this change also drops "local" VM type.
Its story was long unclear and there is now syz-stress which solves the same problem.
2017-06-03 11:31:42 +02:00
Dmitry Vyukov
ea2295f3e2 pkg/db: move from db 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
23b94422d3 pkg/log: move from log 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
d1032c21a0 pkg/hash: move from hash 2017-06-03 10:41:09 +02:00
Dmitry Vyukov
61a577885b tools: more reliable network config in create-gce-image.sh
Currently we append to /etc/network/interfaces,
which can lead to duplicate lo entry.
Write out the whole interfaces file instead.
2017-06-03 10:41:09 +02:00
Dmitry Vyukov
ac2962a1c5 tools: sync create-image.sh and create-gce-image.sh
Move few additional settings from create-gce-image.sh to create-image.sh.
2017-06-03 10:41:09 +02:00
Dmitry Vyukov
84eb5fd389 config: split and refactor
Introduce generic config.Load function that can be
reused across multiple programs (syz-manager, syz-gce, etc).
Move the generic config functionality to pkg/config package.
The idea is to move all helper (non-main) packages to pkg/ dir,
because we have more and more of them and they pollute the top dir.
Move the syz-manager config parts into syz-manager/config package.
2017-06-01 11:17:54 +02:00
Michael Pratt
29fc5b76cd all: cleanup executor/ipc status checking
This is mostly a cleanup change with little functional change.

In ipc.command.exec, remove the status fallback from the pipe to the
exit status. Once the executor is serving, it always writes the status
over the pipe; anything else is an error.

Remove the panic check in syz-stress, which is no longer needed.
2017-05-30 09:33:51 -07:00
Dmitry Vyukov
220dc49106 csource: reproduce crashes with fault injection 2017-05-26 17:22:57 +02:00
Dmitry Vyukov
8f58526cb8 all: add fault injection capability
Systematically inject faults during smashing.
Requires kernel patch:
"fault-inject: support systematic fault injection"
(currently in linux-next).
2017-05-26 17:22:57 +02:00
Andrey Konovalov
f919224c44 sys, executor: extract tcp sequence numbers from /dev/net/tun
This commit adds a new pseudo syscall syz_extract_tcp_res, that reads
a packet from /dev/net/tun and extracts tcp sequence numbers to be used
in subsequent packets.

As a result this syzkaller program:

mmap(&(0x7f0000000000/0x10000)=nil, (0x10000), 0x3, 0x32, 0xffffffffffffffff, 0x0)
r0 = socket$inet_tcp(0x2, 0x1, 0x0)
bind$inet(r0, &(0x7f0000001000)={0x2, 0x0, @empty=0x0, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]}, 0x10)
listen(r0, 0x5)
syz_emit_ethernet(0x36, &(0x7f0000002000)={@local={[0xaa, 0xaa, 0xaa, 0xaa, 0xaa], 0x0}, @random="4c6112cc15d8", [], {{0x800, @ipv4={{0x5, 0x4, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0x6, 0x0, @remote={0xac, 0x14, 0x0, 0xbb}, @local={0xac, 0x14, 0x0, 0xaa}, {[]}}, @tcp={{0x1, 0x0, 0x42424242, 0x42424242, 0x0, 0x0, 0x5, 0x2, 0x0, 0x0, 0x0, {[]}}, {""}}}}}})
syz_extract_tcp_res(&(0x7f0000003000)={<r1=>0x42424242, <r2=>0x42424242}, 0x1, 0x0)
syz_emit_ethernet(0x38, &(0x7f0000004000)={@local={[0xaa, 0xaa, 0xaa, 0xaa, 0xaa], 0x0}, @remote={[0xbb, 0xbb, 0xbb, 0xbb, 0xbb], 0x0}, [], {{0x800, @ipv4={{0x5, 0x4, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x6, 0x0, @remote={0xac, 0x14, 0x0, 0xbb}, @local={0xac, 0x14, 0x0, 0xaa}, {[]}}, @tcp={{0x1, 0x0, r2, r1, 0x0, 0x0, 0x5, 0x10, 0x0, 0x0, 0x0, {[]}}, {"0c10"}}}}}})
r3 = accept$inet(r0, &(0x7f0000005000)={0x0, 0x0, @multicast1=0x0, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]}, &(0x7f0000006000)=0x10)

established a TCP connection:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:20000           0.0.0.0:*               LISTEN      5477/a.out
tcp        2      0 172.20.0.170:20000      172.20.0.187:20001      ESTABLISHED 5477/a.out

Similar program for IPv6:

mmap(&(0x7f0000000000/0x10000)=nil, (0x10000), 0x3, 0x32, 0xffffffffffffffff, 0x0)
r0 = socket$inet6_tcp(0xa, 0x1, 0x0)
bind$inet6(r0, &(0x7f0000000000)={0xa, 0x1, 0x0, @empty={[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]}, 0x0}, 0x1c)
listen(r0, 0x5)
syz_emit_ethernet(0x4a, &(0x7f0000001000)={@local={[0xaa, 0xaa, 0xaa, 0xaa, 0xaa], 0x0}, @random="de895db1468d", [], {{0x86dd, @ipv6={0x0, 0x6, "a228af", 0x14, 0x6, 0x0, @remote={0xfe, 0x80, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x0, 0xbb}, @local={0xfe, 0x80, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x0, 0xaa}, {[], @tcp={{0x0, 0x1, 0x42424242, 0x42424242, 0x0, 0x0, 0x5, 0x2, 0x0, 0x0, 0x0, {[]}}, {""}}}}}}})
syz_extract_tcp_res(&(0x7f0000002000)={<r1=>0x42424242, <r2=>0x42424242}, 0x1, 0x0)
syz_emit_ethernet(0x4a, &(0x7f0000003000)={@local={[0xaa, 0xaa, 0xaa, 0xaa, 0xaa], 0x0}, @random="de895db1468d", [], {{0x86dd, @ipv6={0x0, 0x6, "a228af", 0x14, 0x6, 0x0, @remote={0xfe, 0x80, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x0, 0xbb}, @local={0xfe, 0x80, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0], 0x0, 0xaa}, {[], @tcp={{0x0, 0x1, r2, r1, 0x0, 0x0, 0x5, 0x10, 0x0, 0x0, 0x0, {[]}}, {""}}}}}}})
r3 = accept$inet6(r0, &(0x7f0000004000)={0x0, 0x0, 0x0, @empty={[0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]}, 0x0}, &(0x7f0000005000)=0x1c)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp6       0      0 :::20001                :::*                    LISTEN      5527/a.out
tcp6       0      0 fe80::aa:20001          fe80::bb:20000          ESTABLISHED 5527/a.out
2017-05-26 14:28:09 +02:00
baishuai
6e254bdd13 manager: save and reuse allSymbols, vmOffset 2017-05-25 17:30:27 +08:00
Dmitry Vyukov
38b947b94f syz-symbolize: symbolize all console output
Currently syz-symbolize uses report.Parse function
that extracts crash messages from console output.
Symbolize all console output instead.
E.g. there can be something on the console that is not crash.
2017-05-23 14:44:07 +02:00
Michael Pratt
e19ceedd27 ipc: add an optional 'abort' signal
If an external sandbox process wraps the executor, it may be helpful to
send a signal other than SIGKILL to the sandbox when the program times
out or fails to respond. This gives the sandbox the opportunity to emit
additional debugging information before exiting.

Add an 'abort' signal to ipc, which is sent to the executor before
SIGKILL. If the executor fails to exit within 5s, the signal is upgraded
to SIGKILL.

The default abort signal remains SIGKILL, maintaining existing behavior.
2017-05-19 16:14:57 -07:00
Oscar Salvador
28e4817405 Add sudo for mkfs.ext4 2017-03-30 16:50:27 +02:00
Andrey Konovalov
91ea49ce25 vm: add Odroid support
This commit adds Odroid C2 support to syzkaller.
It's now possible to specify "type": "odroid" in manager config.

Documentation on how to setup fuzzing with Odroid C2 board is here:
https://github.com/google/syzkaller/wiki/Setup:-Odroid-C2

Note, that after this change libusb-1.0-0-dev package should be
installed to build syzkaller.
2017-03-10 17:10:52 +01:00
Dmitry Vyukov
757a32859a tools/syz-dashtool: allow uploading all crashes for a single bug 2017-03-05 14:41:13 +01:00
Dmitry Vyukov
a460a8a082 syz-dash: assorted improvments 2017-02-24 22:01:03 +03:00
Dmitry Vyukov
19d8bc6235 syz-dash: first version of dashboard app
syz-dash is an appengine app that aggregates crashes from multiple managers.
Very early version, still flashing out required functionality.
2017-02-17 22:22:01 +01:00
Andrey Konovalov
b4bdefbe9b prog, sys: add icmp descriptions and checksum 2017-02-06 20:24:49 +01:00
Andrey Konovalov
dd4e19c77a execprog: enable tun when syz_emit_ethernet is used 2017-01-31 18:39:24 +01:00
Dmitry Vyukov
8365c3838d all: implement edge coverage
Currently syzkaller uses per-call basic block (BB) coverage.
This change implements edge (not-per-call) coverage.
Edge coverage is more detailed than BB coverage as it captures
not-taken branches, looping, etc. So it provides better feedback signal.
This coverage is now called "signal" throughout the code.
BB code coverage is also collected as it is required for visualisation.
Not doing per-call coverage reduces corpus ~6-7x (from ~35K to ~5K),
this has profound effect on fuzzing efficiency.
2017-01-27 20:46:18 +01:00
Dmitry Vyukov
13134c3cf7 syz-prog2c: fix a typo in error message 2017-01-25 11:05:19 +01:00
Dmitry Vyukov
40c6a8ebf5 tools/create-image.sh: add psmisc package for killall
+ raise console output level, otherwise stack traces may be dropped
2017-01-24 10:03:42 +01:00
Dmitry Vyukov
3db67897de tools/kcovtrace: add KCOV-based tracing utility
kcovtrace is like strace but show kernel coverage collected with KCOV.
It is very simplistic at this point and does not support multithreaded processes, etc.
It can be used to understand, for example, exact location where kernel bails out
with an error for a particular syscall.
2017-01-20 14:56:20 +01:00
Dmitry Vyukov
f8b6a5831c tools/syz-benchcmp: add utility for visualization of syz-manager benchmarking results 2017-01-20 14:56:20 +01:00
Dmitry Vyukov
52165c91c2 tools/syz-stress: switch to the new corpus database format 2017-01-17 17:14:11 +01:00
Dmitry Vyukov
5d3f1d6614 tools/syz-db: add new utility
The utility allows to pack/unpack corpus database to/from seprate files.
2017-01-16 20:44:01 +01:00
Dmitry Vyukov
6f52004fcf tools/create-image.sh: simplify script
Checkout necessary packages during debootstrap instead of a separate step.
2017-01-16 20:34:35 +01:00
Dmitry Vyukov
e715b3c803 syz-gce: support continous build
Add "local" mode in which syz-gce clones, builds and
monitors for updates a linux kernel repo.
2017-01-16 20:33:22 +01:00
Dmitry Vyukov
83a8f430c9 vm/qemu: add some kvm-related kernel cmd line flags
In particular it is useful to enable nested.
Enable a bunch of others as well.
2017-01-09 20:20:49 +01:00
Dmitry Vyukov
b6f204a7e4 syz-stress: add flag that controls generation of new programs 2017-01-09 20:20:49 +01:00
Dmitry Vyukov
3f9152d9e2 vm/qemu: enable more kvm features in test kernel 2017-01-09 20:19:44 +01:00
Dmitry Vyukov
80b6c954f8 manager: add ability to ignore bugs
Add new config parameter "ignores" which contains list of regexp expressions.
If one of the expressions is matched against oops line,
crash report is not saved and VM is not restarted.
2016-12-19 17:39:03 +01:00
Dmitry Vyukov
f83633edbe tools/syz-symbolize: add report symbolizer utility 2016-12-16 15:53:30 +01:00
Dmitry Vyukov
60fd47e308 tools/create-image.sh: install sudo into the image 2016-12-07 15:58:51 +01:00
Dmitry Vyukov
2b1456887b tools/create-image.sh: use net.core.bpf_jit_enable = 1
bpf_jit_enable = 2 causes printing of all programs to console.
Produces lots of output and is not very useful. Disable it.
2016-12-07 10:17:46 +01:00
Dmitry Vyukov
ee3c2c3591 tools: enable bpg jit in create-image.sh
JIT should be more interesting to fuzz.
2016-11-28 18:26:56 +01:00
Dmitry Vyukov
ef040b21d2 tools: fix getty configuration in create-gce-image.sh 2016-11-28 18:25:49 +01:00
Alexander Popov
1e56aff95f tools: fix getty configuration in create-image.sh
create-image.sh adds the string "V0:23:respawn:/sbin/getty 115200 hvc0" to inittab
of a virtual machine, but a fresh debian-wheezy doesn't have a hvc0 device.
So getty fails to start and respawns over and over again:
  INIT: Id "V0" respawning too fast: disabled for 5 minutes

Let's fix create-image.sh to have a working VM terminal.

Signed-off-by: Alexander Popov <alex.popov@linux.com>
2016-11-28 16:10:09 +03:00
Andrey Konovalov
253a40f30d sys: add proc type to denote per proccess integers 2016-11-25 17:51:41 +01:00
Dmitry Vyukov
9604794dce manager: reproduce crashes on the fly
With this change manager will run reproduction on crashes
until reproducer is discovered, but at most 3 times.

If reproducer is discovered it is saved with crashes and shown on the web UI.
2016-11-25 11:07:52 +01:00
Andrey Konovalov
a5df734b8d fuzzer: combine progs from corpus 2016-11-25 09:58:17 +01:00
Dmitry Vyukov
c9ae0f69d8 vm: add ability to interrupt commands
This is required for crash reproduction in manager.
2016-11-19 11:14:11 +01:00
Dmitry Vyukov
59f7c210d0 repro: factor out of syz-repro tool
Factor out repro logic from syz-repro tool,
so that it can be used in syz-manager.
Also, support sandboxes in code generated by
csoure. This is required to reproduce crashes
that require e.g. namespace sandbox.
2016-11-19 10:00:36 +01:00
Dmitry Vyukov
2d05f5a6bc tools/create-gce-image.sh: enable bpf jit and update comments 2016-11-16 13:19:33 +01:00
Dmitry Vyukov
b6f882e066 tools/syz-crush: add new tool
syz-crush replays crash log on multiple VMs. Usage:
   syz-crush -config=config.file execution.log
Intended for reproduction of particularly elusive crashes.
2016-11-16 13:19:33 +01:00
Dmitry Vyukov
6f057a2c04 vm/qemu: remove debug, add rodata=n to kernel cmd line
Debug leads to too verbose output in some cases.
Rodata is very slow with KASAN.
2016-10-16 08:15:24 +02:00
Dmitry Vyukov
752469137f tools/create-gce-image.sh: add vsyscall=native to cmdline
Required for android as vdso is disabled by default for some reason.
2016-10-13 15:33:35 +02:00
Dmitry Vyukov
0c1a91b184 tools/create-gce-image.sh: create archive for syz-gce
Create archive ready to use with syz-gce (pack disk image,
vmlinux, key and tag into a single tar.gz).
Also use sudo only for specific commands, otherwise we create key
file readable only root which is inconvinient.
2016-10-10 18:08:58 +02:00
Dmitry Vyukov
222090e3b4 log: add package
Log is a simple wrapper around std log package.
It is meant to solve 2 main problems:
1. Logging from non-main packages (mainly, vm/* packages).
   Currently they can either always log or not log at all.
   But they can't respect program verbosity setting.
   Log package allows all packages to use the same verbosity setting.
2. Exposing recent logs in html UI.
   Namely we want to tee logs to console and html UI.
2016-10-09 11:27:48 +02:00
Dmitry Vyukov
a65c55ac2f tools/create-gce-image.sh: remove duplicate console argument 2016-10-07 19:58:25 +02:00
Dmitry Vyukov
13813fd6f6 tools: fix package name in a comment 2016-10-07 13:44:26 +02:00
Dmitry Vyukov
171bcbc050 tools: add script that creates GCE images 2016-10-06 16:22:35 +02:00
Dmitry Vyukov
83374d77d3 vm/gce: add support GCE VMs 2016-10-06 16:22:35 +02:00
Dmitry Vyukov
e3e75519de execprog: remove debug leftover 2016-09-06 15:43:24 +02:00
Dmitry Vyukov
e25b79fa98 stress: fix flag description 2016-09-05 12:49:47 +02:00
Dmitry Vyukov
cb3e5c28a0 execprog: make syz-execprog work more like syz-fuzzer
Respect max concurrency.
Optionally print programs to stdout.
2016-09-05 12:49:47 +02:00
Dmitry Vyukov
40280fa543 syz-repro: fix false "not executing programs" 2016-09-05 12:49:47 +02:00
Dmitry Vyukov
2c881152ef syz-report: fix printing of report 2016-09-05 12:49:47 +02:00
Dmitry Vyukov
0e77b5a187 manager, repro: unify VM monitoring
Unify and factor out VM monitoring loop used in syz-manager and syz-repro.
This allows syz-repro to detect all the same bugs (e.g. "no output", "lost connection", etc).
And also just deduplicates code.
2016-09-01 19:54:55 +02:00
Dmitry Vyukov
9ec6b54fae report: add a function that symbolizes reports 2016-09-01 15:09:39 +02:00
Dmitry Vyukov
bb1e3bfda5 report: extract better, unique identifiers of oopses 2016-08-31 13:20:57 +02:00
Dmitry Vyukov
14dfa4f109 report: add a new package for report parsing and processing
Move vm.FindCrash to the new package.
2016-08-30 15:19:28 +02:00
Dmitry Vyukov
bc9b349bd7 vm/adb: support multiple adb devices
Device IDs are specified in "devices" config param.
2016-08-30 14:33:39 +02:00
Dmitry Vyukov
0113f7f048 repro: a little bit more graceful shutdown
Bring down at least some VM instances.
Booting instances can still leak.
2016-08-28 20:09:05 +02:00
Dmitry Vyukov
f0eccc7052 repro: use correct sandbox mode
Update #59
2016-08-28 13:51:09 +02:00
Dmitry Vyukov
888b041f6d csource: support nonfailing argument copyin/copyout
Update #59
2016-08-28 12:24:39 +02:00
Dmitry Vyukov
4782c2b8e6 executor: revive setuid sandbox
The new namespace-based sanboxing is good,
but it's not always what one wants
(and also requires special kernel configs).

Change dropprivs config value to sandbox,
which can have different values (currently: none, setuid, namespace).
Setuid mode uses setuid(nobody) before fuzzing as before.

In future we can add more sandboxing modes or, say,
extend -sandbox=setuid to -sandbox=setuid:johndoe
to impersonolate into given user.
2016-07-01 22:26:33 +02:00
Dmitry Vyukov
85da6413f9 stress: expect syz-executor to be in the current dir by default 2016-06-22 15:23:56 +02:00
Jamie Liu
016f6be69b stress: fix "assignment to entry in nil map" panic 2016-06-14 16:03:26 -07:00
Alexander Potapenko
ed787856f2 Use readelf to obtain the upper 32 bits of addresses returned by kcov.
When executors send coverage data to the manager, they clamp the addresses
of covered blocks to 32 bits. Manager uses RestorePC() to restore the original
addresses.
Previously, RestorePC() assumed that the upper 4 bytes of a kernel code
address were 0xffffffff, which is not so on Android.
Instead we now parse `readelf -SW vmlinux` output to obtain the upper bytes of
PROGBITS sections VMAs in the case those VMAs are non-zero. We assume that
the upper 4 bytes are the same for every section.
2016-05-03 11:06:27 +02:00
Dmitry Vyukov
7bc74c0b97 stress: print program and output on more types of bugs 2016-04-04 20:22:10 +02:00
Dmitry Vyukov
9851bc6a97 fuzzer: improve kmemleak logic
Kmemleak has false positives. To mitigate most of them, it checksums
potentially leaked objects, and reports them only on the next scan
iff the checksum does not change. Because of that we do the following
intricate dance:
Scan, sleep, scan again. At this point we can get some leaks.
If there are leaks, we sleep and scan again, this can remove
false leaks. Then, read kmemleak again. If we get leaks now, then
hopefully these are true positives during the previous testing cycle.
2016-03-10 17:47:13 +01:00
Lorenzo Stoakes
827a93b21a tools: fix multi-line string.
An error in the multi-line string results in apt-get install not running in
create-image.sh, this fixes that.
2016-03-08 15:14:48 +00:00
Lorenzo Stoakes
b21724820c tools: fix path on create-image.sh chroot.
When chroot'ing into the generated debian rootfs PATH is inherited from the host
and assumed to reference each of: /bin, /sbin, /usr/bin, /usr/sbin,
/usr/local/bin and /usr/local/sbin. Not all distros use all of these, so enforce
these in the chroot command.
2016-03-06 18:47:43 +00:00
Dmitry Vyukov
96949534ae execprog: properly cleanup on ctrl+C 2016-02-18 21:41:50 +01:00
Dmitry Vyukov
9724efa335 config: check presence of syz-execprog only in syz-repro
syz-execprog is not built by 'make', so syz-manager fails for first-timers.
2016-02-16 15:14:25 +01:00
Dmitry Vyukov
d1163f0480 ipc: unify command line flag handling
It was duplicated in 3 programs.
2016-01-27 14:22:48 +01:00
Dmitry Vyukov
9aec072a77 ipc: remove strace support traces
It is not working and not tested,
and can't be restored with new namespace sandboxing code.
2016-01-27 13:42:00 +01:00
Dmitry Vyukov
1e06d2bafc executor: new namespace-based sandbox 2016-01-22 18:09:32 +01:00
Dmitry Vyukov
891b46a9a5 vm: faster output oops grepping
Use manual parsing instead of a regexp.
Regexp takes ~220ms for typical output size. New code takes ~2ms.
Brings manager CPU consumption from ~250% down to ~25%.
2016-01-19 17:22:36 +01:00
Dmitry Vyukov
7a94216729 csource: format source with clang-format 2016-01-15 20:32:32 +01:00
Dmitry Vyukov
4d906f05d4 vm/adb: add adb-based VM
vm/adb can be used to fuzz on real android devices.
2016-01-11 17:40:26 +01:00
Dmitry Vyukov
de48f7b019 vm: refactor VM interface in preparation for adb support
adb has more complex port forwarding setup, also / is mounted read-only.
Make VM interface more flexible to support such cases.
2016-01-11 17:33:44 +01:00
Dmitry Vyukov
ad969c98f1 tools: add script that creates a Linux image suitable for syzkaller 2016-01-07 13:12:36 +01:00
Dmitry Vyukov
3ccc84556b tools/stress: disable unsupported syscalls 2015-12-30 18:24:08 +01:00
Dmitry Vyukov
9f9ae3fcc3 tools/syz-upgrade: helper tool for corpus format upgrades 2015-12-28 12:49:19 +01:00
Dmitry Vyukov
80d60f7305 tools/syz-repro: fix repeat multiplier
For loop already increases multiplier on exit,
so additional incrase is not necessary.
2015-12-24 12:06:15 +01:00
Dmitry Vyukov
d4180ca5c7 tools/syz-repro: add reproduction tool 2015-12-23 19:19:45 +01:00
Dmitry Vyukov
1c801e8512 prog: factor out execution log parsing functionality
It will be needed to reproduction tool.
2015-12-23 19:18:13 +01:00
Dmitry Vyukov
7f3186abbb execprog: detect executor-detected bugs 2015-12-23 19:09:48 +01:00
Dmitry Vyukov
6af1c1f308 execprog: replace loop flag with repeat
This will be necessary for reproduction tool.
It needs to run a program a fixed number of times
instead of loop infinitely.
2015-12-23 13:39:14 +01:00
Dmitry Vyukov
e253cbc79f csource: new package
Move C source generation into a separate package.
Prog is too bloated already.
2015-12-23 13:38:31 +01:00
Dmitry Vyukov
bd75706280 add a flag to disable setpgid syscall
It is broken on some of our test systems.
2015-12-17 17:31:11 +01:00
Dmitry Vyukov
bbf4e35323 executor: export syscall execution results
Errno can be used to guide fuzzing, or detect not implemented syscalls.
2015-12-17 17:31:11 +01:00
Dmitry Vyukov
8e7ca7c5ff remove master and naming overhaul
Remove master process entirely, it is not useful in its current form.
We first need to understand what we want from it, and them re-implement it.

Prefix all binaries with syz- to avoid name clashes.
2015-12-17 16:06:33 +01:00
Dmitry Vyukov
d665e11e9d move Gate type to ipc package and use it in stress tool
This allows to print what programs stress executes.
2015-12-17 14:38:46 +01:00
Dmitry Vyukov
48d0a3662e tools/stress: minor improvements 2015-12-17 14:38:46 +01:00
Dmitry Vyukov
8bda33214d execprog: rate limit printing
Otherwise it happen too frequently when executing a single program in a loop.
2015-11-28 11:27:44 +01:00
Dmitry Vyukov
83e92abf50 tools/stress: support missing flags 2015-11-23 17:08:53 +01:00
Dmitry Vyukov
0165a4b2e4 use fork server in executor
This avoids exec per test.
Also allows to pre-map shared memory regions.
And will allow to pre-map coverage regions, etc.

Seems to work already, but probably there are still some bugs.
2015-11-10 20:30:50 +01:00
Dmitry Vyukov
760fa7e724 go fmt 2015-11-10 14:32:37 +01:00
Dmitry Vyukov
54af41532d merge execlog and execprog tools
Functionality was duplicated to significant degree.
Now execprog can do all execlog could do.
2015-11-10 13:56:10 +01:00
Dmitry Vyukov
18220dd54e support parallel execution in stress utility 2015-11-10 13:38:08 +01:00
Dmitry Vyukov
a44473e4a4 add collide mode to executor
In this mode we execute pairs of syscalls concurrently
to provoke data races in kernel.
2015-11-06 23:15:40 +01:00
Dmitry Vyukov
a7d2a521f3 support dropprivs in execlog/execprog 2015-11-05 10:30:39 +01:00
Dmitry Vyukov
727e8240ff read corpus from a zip archive in stress tool 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
304c1de389 add threaded and timeout flags to execlog 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
505473bd9b allow to specify timeout in execprog 2015-10-20 15:46:04 +02:00
Dmitry Vyukov
6d84c5d2d7 add mutate tool that allows to manually investigate mutator behavior 2015-10-16 22:00:16 +02:00
Dmitry Vyukov
c9b915608d initial support for call priorities 2015-10-14 16:55:09 +02:00
Dmitry Vyukov
38493312da allow to specify parallelism level in tools/execlog 2015-10-14 10:54:04 +02:00
Dmitry Vyukov
78514887ec clean up temp files in tools/execprog 2015-10-14 10:53:46 +02:00
Dmitry Vyukov
a02244e114 deduplicate coverare in executor
This allows to use larger coverage buffer
and not overflow output at the same time.
2015-10-13 15:29:07 +02:00
Dmitry Vyukov
c90d728595 dump coverage in execprog command 2015-10-13 15:29:07 +02:00
Dmitry Vyukov
29e95fbb26 process covereage in ipc package instead of fuzzer 2015-10-13 15:29:07 +02:00
Dmitry Vyukov
9145be6961 make ipc.Env.Exec accept the program to execute 2015-10-13 15:29:07 +02:00
Dmitry Vyukov
874c5754bb initial commit 2015-10-12 10:16:57 +02:00