Commit Graph

232 Commits

Author SHA1 Message Date
Dmitry Vyukov
06ece2ca66 pkg/host: rework host feature detection/setup
Currently host feature detection/setup code is spread
across platform-independent fuzzer code, pkg/host, pkg/ipc
and executor.
Move this all into pkg/host and show readable info
about features on manager start.

Fixes #46
2018-06-12 14:53:22 +02:00
Daniel Borkmann
ac9b19d2e4 bpf: enable hardening mode 1 for jited images
This will harden non-root programs from kernel side, but not
root-only ones. Helps also to increase coverage a bit since
syzkaller generates programs for both cases.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-06-07 12:39:12 +03:00
Daniel Borkmann
b17ae9398c bpf: enable full unwind and kallsym export support for jited images
Helps syzkaller in particular for unwinding full stack in case
of warnings or crashes.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-06-07 12:39:12 +03:00
Dmitry Vyukov
6479ab2a75 Makefile, sys/targets: move all native compilation logic to sys/targets
We currently have native cross-compilation logic duplicated
in Makefile and in sys/targets. Some pieces are missed in one
place, some are in another. Only pkg/csource knows how to check
for -static support.

Move all CC/CFLAGS logic to sys/targets and pull results in Makefile.

This should make Makefile work on distros that have broken x86_64-linux-gnu-gcc,
now we will use just gcc. And this removes the need to define NOSTATIC,
as it's always auto-detected.

This also paves the way for making pkg/csource work on OSes other than Linux.
2018-06-06 10:02:03 +02:00
Dmitry Vyukov
f48c20b8f9
tools/create-image.sh: fix watchdog_thresh value
watchdog_thresh is capped at 60, so 120 causes EINVAL.
2018-05-19 10:48:34 +02:00
Dmitry Vyukov
70c84d118a tools/create-image.sh: add few useful sysctl's 2018-05-18 19:29:06 +02:00
Dmitry Vyukov
61ef28da7a tools/syz-execprog: restore the previous tun disabling logic
This probably can break some things.
I feel that tun setup can affect other things even if
syz_emit_ethernet/syz_extract_tcp_res are not used.
So it can make sense to setup tun even if they are not used.
But let's be more careful.
2018-05-18 10:01:22 +02:00
Dmitry Vyukov
738d58ade0 pkg/csource: minimize netdevices and net reset
Add separate options to minimize netdevices setup and net namespace reset.

Fixes #581
2018-05-17 19:57:54 +02:00
Dmitry Vyukov
9753d3be5e tools/syz-prog2c: add missing csource option 2018-05-17 19:07:33 +02:00
Dmitry Vyukov
4e1c0dbaea pkg/bisect: add bisection logic
Add first version of bisection package
(supports both bug and fix bisection).
And tools/syz-bisect wrapper for testing.

Update #501
2018-05-17 14:52:39 +02:00
Dmitry Vyukov
6595937c34 tools/create-gce-image.sh: support both nbd and loop
Pass target OS/arch and VM type to kernel.CreateImage.
Use nbd for gce and loop for qemu VM type.
2018-05-17 14:50:18 +02:00
Dmitry Vyukov
a367c1d7a8 tools/create-gce-image.sh: support MKE2FS_CONFIG 2018-05-16 17:21:29 +02:00
Dmitry Vyukov
86ea19e4c2 tools/create-gce-image.sh: revert loop to nbd
loop devices are nice, but unfortunately this creates images
that does not boot on GCE. Reason is unclear.
Revert back to nbd for now.
2018-05-14 19:32:39 +02:00
Dmitry Vyukov
d5dc4006db tools/kcovtrace: add missing include 2018-05-14 11:17:41 +02:00
Dmitry Vyukov
ea9496cdbd tools/create-gce-image.sh: use loop instead of nbd
loop is much more standard than nbd and does not require additional modules.
nbd broke on Debian rolling.
loop also allows parallel execution thanks to losetup -f.

Use loop instead of nbd.
Also improve cleanup logic and add one missing sudo.

Update #501
2018-05-14 11:16:36 +02:00
Dmitry Vyukov
9e0846e8a4 all: get rid of underscores in identifiers
Underscores are against Go coding style.

Update #538
2018-05-07 17:59:06 +02:00
Dmitry Vyukov
3f70522c7e tools/syz-execprog: split overly large function
Update #538
2018-05-07 16:23:18 +02:00
Dmitry Vyukov
78b251cbd7 all: fix too long lines
Not sure why I have not seen warnings about
these lines on another machine...
2018-05-05 16:00:01 +02:00
Dmitry Vyukov
9fe5658a1b gometalinter: check dot imports
Update #538
2018-05-03 14:41:34 +02:00
Hyeongchan Kim
d23fcf6cfb syz-upgrade: fix typo in usage message 2018-04-21 10:41:19 +02:00
Dmitry Vyukov
bc77795d90 tools/syz-execprog: reduce log level of some messages
Too much output by default.
2018-04-08 13:37:24 +02:00
Dmitry Vyukov
10a8987f80 tools: fix create-image.sh again 2018-04-07 12:42:50 +02:00
Dmitry Vyukov
54907ddb1e tools: improve demo_setup.sh
1. Account for the fact that go can be already in path.
2. Unset GOROOT in case it is set already.
3. export variables (not sure how it worked for me).
2018-04-07 12:33:23 +02:00
Dmitry Vyukov
2a9c3edcda pkg/prog: explain why syscalls are transitively disabled 2018-04-06 19:43:06 +02:00
Dmitry Vyukov
4daf8570eb pkg/host: explain why syscalls are disabled 2018-04-06 18:47:56 +02:00
Dmitry Vyukov
a932eae671 tools: add a script that setups everything 2018-04-05 19:52:54 +02:00
Dmitry Vyukov
ad7d294798 tools/syz-execprog: dump coverage in text format
There is no point in using sancov,
it does not do anything other than transforming
binary format to a useful text format.
Write out text format directly.
2018-04-05 12:02:16 +02:00
Dmitry Vyukov
676bd07e7e sys/linux: test various binfmt's in execve 2018-04-02 20:10:48 +02:00
Dmitry Vyukov
99e3b0a7e8 sys/linux: add support for reading partition tables 2018-04-01 18:29:56 +02:00
Dmitry Vyukov
7c923cf8d4 sys/linux: add support for mounting filesystem images 2018-03-30 19:51:27 +02:00
Dmitry Vyukov
d47f0ed685 tools: remove stray comments in create-image.sh
The comments were unintentionally committed in a previous commit.
2018-03-29 11:59:14 +02:00
Dmitry Vyukov
c7e0d50a76 tools/syz-db: allow to specify db version in pack 2018-03-27 09:39:02 +02:00
Dmitry Vyukov
2675f92065 sys/linux: add cgroup descriptions 2018-03-25 12:46:05 +02:00
Dmitry Vyukov
36d1c4540a all: fix gometalinter warnings
Fix typos, non-canonical code, remove dead code, etc.
2018-03-08 18:48:26 +01:00
Dmitry Vyukov
42467f5b7b sys/linux: add syz_init_net_socket syscall
The new pseudo syscall allows opening sockets that can only
be created in init net namespace (BLUETOOTH, NFC, LLC).
Use it to open these sockets.

Unfortunately this only works with sandbox none at the moment.
The problem is that setns of a network namespace requires CAP_SYS_ADMIN
in the target namespace, and we've lost all privs in the init namespace
during creation of a user namespace.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
1f693e0219 tools/syz-mutate: allow limiting set of syscalls 2018-02-17 19:02:12 +01:00
Dmitry Vyukov
d39a1fe856 tools/syz-execprog: fix parsing of multiple logs 2018-01-31 15:50:36 +01:00
Dmitry Vyukov
b88de8e0bf tools/syz-symbolize: allow to symbolize arbitrary kernel output 2018-01-09 21:24:29 +01:00
Dmitry Vyukov
1d3e907710 tools/syz-symbolize: assume that kernel is in the current dir 2017-12-27 15:02:46 +01:00
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