Commit Graph

23 Commits

Author SHA1 Message Date
Dmitry Vyukov
5153aeaffd syz-ci: test images before using them
Boot and minimally test images before declaring them as good
and switching to using them.

If image build/boot/test fails, upload report about this to dashboard.
2017-11-30 14:50:50 +01:00
Dmitry Vyukov
c4d43f4773 pkg/osutil: don't leace runaway processes
When manager is stopped there are sometimes runaway qemu
processes still running. Set PDEATHSIG for all subprocesses.
We never need child processes outliving parents.
2017-11-16 12:48:02 +01:00
Dmitry Vyukov
afa9178d57 pkg/ipc: fix reading comp hints
if/else branches are intermixed
2017-10-23 09:59:39 +02:00
Dmitry Vyukov
296be8cc8d pkg/ipc: move fallback coverage into executor
It seems to explode linux corpus.
So make it freebsd-specific.
2017-10-18 16:49:25 +02:00
Dmitry Vyukov
f89294761c executor: use forkserver for freebsd
Use forkserver and shmem for freebsd.
This greatly improves speed.
Also introduce fallback coverage signal based
on unique (syscall+errno) pairs.
2017-10-18 12:01:24 +02:00
Dmitry Vyukov
85b1f93f8d executor, pkg/ipc: unify ipc protocol between linux and other OSes
We currently use more complex and functional protocol on linux,
and a simple ad-hoc protocol on other OSes.
This leads to code duplication in both ipc and executor.
Linux supports coverage, shared memory communication and fork server,
which would also be useful for most other OSes.

Unify communication protocol and parametrize it by
(1) use of shmem or only pipes, (2) use of fork server.

This reduces duplication in ipc and executor and will
allow to support the useful features for other OSes easily.

Finally, this fixes akaros support as it currently uses
syz-stress running on host (linux) and executor running on akaros.
2017-10-16 14:21:54 +02:00
Dmitry Vyukov
66aeb467de pkg/ipc: don't send program padding to executor
Currently we always send 2MB of data to executor in ipc_simple.go.
Send only what's consumed by the program, and don't send the trailing zeros.
Serialized programs usually take only few KBs.
2017-10-12 19:08:18 +02:00
Dmitry Vyukov
95a2bea795 pkg/ipc, pkg/osutil: remove filepath.Abs fuchsia workarounds
This claimed to be fixed:
https://fuchsia.atlassian.net/browse/DNO-158
2017-10-12 10:16:39 +02:00
Dmitry Vyukov
4906c32192 pkg/ipc: extend error when fail to start executor
We currently return raw error, so sometimes it's hard to tell
even what call produced the error (e.g. just "invalid argument").
Extend the error so that it's clear that it comes from cmd.Start.
2017-10-10 18:59:23 +02:00
Dmitry Vyukov
179a860885 all: basic freebsd support
For now we just make Go part build for freebsd.
2017-10-02 14:17:32 +02:00
Dmitry Vyukov
6350e5c2cf pkg/ipc: fix windows
Abs does not work on fuchsia only, use it on windows.
Also maintain stats.
2017-09-27 18:59:50 +02:00
Dmitry Vyukov
255e8b5e54 pkg/ipc: windows port 2017-09-25 15:19:06 +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
d606e60dfe executor: split source per-OS
Update #191
2017-09-20 21:19:29 +02:00
Dmitry Vyukov
19f9bc13d3 pkg/csource: support archs other than x86_64 2017-09-15 16:02:37 +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
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
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
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
e8e63830a6 pkg/ipc: move from ipc 2017-06-17 14:41:15 +02:00