3333 Commits

Author SHA1 Message Date
Michael Pratt
c912893981 docs: add instructions for running syz-execprog in gVisor
This configuration mounts the syzkaller bin/linux_amd64 folder as the
sandbox root, bind mounts a single input log, then runs syz-execprog on
the input.
2018-12-15 08:11:02 +01:00
Dmitry Vyukov
7624ddd6d8 executor: move setrlimit from setup_control_pipes to bsd os_init
This broke fuchsia build. We need setrlimit only for bsd.
2018-12-14 12:13:14 +01:00
Greg Steuck
fe7127be71 docs/openbsd/setup.md: micro-simplification
@mptre WDYT
2018-12-13 20:25:36 +01:00
Dmitry Vyukov
dd2fb82fa0 pkg/report: another gvisor OOM suppression 2018-12-13 16:45:56 +01:00
Dmitry Vyukov
61b76f0097 pkg/report: another gvisor OOM suppression 2018-12-13 16:40:18 +01:00
Dmitry Vyukov
e7cae6a7f2 pkg/report: another gvisor OOM suppression 2018-12-13 16:36:15 +01:00
Dmitry Vyukov
ecf8ceeef2 pkg/report: pkg/report: relaxed gvisor OOM suppressions more
There are more variations of this panic format.
2018-12-13 12:33:17 +01:00
Dmitry Vyukov
a553162c82 pkg/report: replace more moving parts in gvisor crash titles
"container" seems to have been renamed to "sandbox".
Also exact pid numbers are harmful.
2018-12-13 12:29:52 +01:00
Dmitry Vyukov
3f9ec66365 pkg/report: relaxed gvisor OOM suppressions
Existing ones don't match actual gvisor output after address mangling.
Not matching exact context in parens should be good enough re false positives.
2018-12-13 12:22:49 +01:00
Greg Steuck
f3d9d5948c pkg/csource: support tun and setuid repros on {free,open}bsd
* expose procid on BSD for tun, always declare loop()
* deal with terrible bsd includes
* replicate loop() declaration
2018-12-13 09:44:24 +01:00
Michael Pratt
ec0147d47f Merge pull request #874 from prattmic/bazel_version
pkg/build: fix bazel version parsing
2018-12-13 09:38:59 +01:00
Michael Pratt
d5cf08b04e vm/gvisor: don't close conn on error
If net.Dial returns an error, conn is nil and closing it will panic.
2018-12-13 09:38:49 +01:00
Michael Pratt
c9d6aae44b Merge pull request #872 from prattmic/patch-2
vm/gvisor: support forwarding on IPv6
2018-12-13 09:38:36 +01:00
Michael Pratt
1789e8d66c pkg/report: update gvisor ptrace regs suppressions
99d5958693
changed the format of these to include the registers.
2018-12-13 09:38:16 +01:00
Dmitry Vyukov
02613a4124 sys/linux: add basic tipc test 2018-12-12 13:14:26 +01:00
Dmitry Vyukov
7ed11ab916 vm: respect Shutdown signal in waitForOutput 2018-12-12 13:05:51 +01:00
Dmitry Vyukov
961cbc6f40 dashboard/config: update kernel configs to latest kernel 2018-12-12 13:05:51 +01:00
Dmitry Vyukov
0f9424b449 pkg/report: skip strncpy in linux reports 2018-12-12 13:05:51 +01:00
Michael Pratt
c3b10a5d6a vm/gvisor: replace signal panic with log
Diagnose currently sends the panic signal to generate a traceback for
additional context.

However, Diagnose is also called in otherwise successful scenarios
(vm.Instance.MonitorExecution -> vm.monitor.extractError). Triggering a
panic will make this successful scenario look like a failure.

We could simply suppress this panic, but 1) that means we never shutdown
cleanly (not important, but ugly), and 2) we're less likely to detect
delayed crashes since we kill the sandbox immediately (that's what
MonitorExecution is checking for).

Instead, switch from -panic-signal to -trace-signal, which simply logs a
traceback without exiting. This option was added to runsc in
24c1158b9c.

The other uses of Diagnose will always generate a report regardless of
an additional panic, so we're not losing any reports.
2018-12-12 10:12:35 +01:00
Greg Steuck
7795ae03c0 prog: detect invalid target.Syscalls in BuildChoiceTable
Without this check programs may end up panicing in places far away
from the real cause. E.g.

worker# ./syz-fuzzer -executor=./syz-executor -name=vm-0 -arch=amd64 -manager=10.128.0.101:21386 -sandbox=setuid -procs=2 -v=0 -cover=true -debug=false -test=false
2004/02/03 12:11:11 fuzzer started
2004/02/03 12:11:11 dialing manager at 10.128.0.101:21386
2004/02/03 12:11:12 syscalls: 1
2004/02/03 12:11:12 code coverage: enabled
2004/02/03 12:11:12 comparison tracing: support is not implemented in syzkaller
2004/02/03 12:11:12 setuid sandbox: support is not implemented in syzkaller
2004/02/03 12:11:12 namespace sandbox: support is not implemented in syzkaller
2004/02/03 12:11:12 Android sandbox: support is not implemented in syzkaller
2004/02/03 12:11:12 fault injection: support is not implemented in syzkaller
2004/02/03 12:11:12 leak checking: support is not implemented in syzkaller
2004/02/03 12:11:12 net packet injection: enabled
2004/02/03 12:11:12 net device setup: support is not implemented in syzkaller
panic: invalid argument to Intn

goroutine 27 [running]:
math/rand.(*Rand).Intn(0xc000dff530, 0x0, 0x40)
        /usr/local/go/src/math/rand/rand.go:169 +0x9c
github.com/google/syzkaller/prog.(*ChoiceTable).Choose(0xc000d92ec0, 0xc000dff530, 0xffffffffffffffff, 0xc000dff650)
        /syzkaller/gopath/src/github.com/google/syzkaller/prog/prio.go:241 +0x1a0
github.com/google/syzkaller/prog.(*randGen).generateCall(0xc000e145a0, 0xc000c2a200, 0xc000ce7f80, 0x2348f1940, 0xc000ce3440, 0xc000e6ee01)
        /syzkaller/gopath/src/github.com/google/syzkaller/prog/rand.go:451 +0x69
github.com/google/syzkaller/prog.(*Target).Generate(0xc00007f1e0, 0x8f8680, 0xc000ce3440, 0x1e, 0xc000d92ec0, 0x0)
        /syzkaller/gopath/src/github.com/google/syzkaller/prog/generation.go:19 +0x2b2
main.(*Proc).loop(0xc000d92f40)
        /syzkaller/gopath/src/github.com/google/syzkaller/syz-fuzzer/proc.go:93 +0x2a1
created by main.main
        /syzkaller/gopath/src/github.com/google/syzkaller/syz-fuzzer/fuzzer.go:236 +0xfe2
2018-12-11 11:14:20 +01:00
Greg Steuck
d90f8af59c executor: reapply setuid sandbox for bsd
* Revert "Revert "executor: add setuid sandbox for openbsd""

The problem is the low file descriptor limit.

This reverts commit 4093e33b1338f274ae0062f555de9d6af8640d61.

* executor/executor make sure the file descriptor limit is sufficient
2018-12-11 07:39:44 +01:00
Greg Steuck
4093e33b13 Revert "executor: add setuid sandbox for openbsd"
This reverts commit 6565f24da9f4eb36702339ba290213995fcc902f.
2018-12-10 20:09:24 +01:00
Dmitry Vyukov
28bd3e371b prog: support AUTO args in programs
AUTO arguments can be used for:
 - consts
 - lens
 - pointers

For const's and len's AUTO is replaced with the natural value,
addresses for AUTO pointers are allocated linearly.

This greatly simplifies writing test programs by hand
as most of the time we want these natural values.

Update tests to use AUTO.
2018-12-10 16:37:02 +01:00
Dmitry Vyukov
c7ba317e9b tools/syz-runtest: test program parsing before booting VMs
It sucks to wait for VMs to boot just to discover that programs don't parse.
2018-12-10 16:37:02 +01:00
Dmitry Vyukov
593b260b02 pkg/ipc: move sandbox helpers from ipcconfig
Currently syz-runtest fails to start because -debug flag is defined
both in syz-runtest and ipcconfig.
But moving sandbox functions we prevent ipcconfig from being imported into syz-runtest.
2018-12-10 16:37:02 +01:00
Dmitry Vyukov
083e78159d sys: consistently mark all paddings as const[0] 2018-12-10 16:37:02 +01:00
Dmitry Vyukov
ba64d006de prog: implement strict parsing mode
Add bulk of checks for strict parsing mode.
Probably not complete, but we can extend then in future as needed.
Turns out we can't easily use it for serialized programs
as they omit default args and during deserialization it looks like missing args.
2018-12-10 16:37:01 +01:00
Dmitry Vyukov
95fe19c19e prog: introduce strict parsing mode
Over time we relaxed parsing to handle all kinds of invalid programs
(excessive/missing args, wrong types, etc).
This is useful when reading old programs from corpus.
But this is harmful for e.g. reading test inputs as they can become arbitrary outdated.
For runtests which creates additional problem of executing not
what is actually written in the test (or at least what author meant).
Add strict parsing mode that does not tolerate any errors.
For now it just checks excessive syscall arguments.
2018-12-10 16:37:01 +01:00
Dmitry Vyukov
a5efea3ec3 prog: refactor deserialization code
Move target and vars into parser and make all
parsing functions methods of the parser.
This reduces number of args that we need to pass around
and eases adding more state that needs to be passed around.
2018-12-10 16:37:01 +01:00
Dmitry Vyukov
ceeb374637 tools/syz-cover: add utility for generation of coverage reports
syz-cover generates coverage HTML report from raw coverage files.
Raw coverage files are text files with one PC in hex form per line, e.g.:

	0xffffffff8398658d
	0xffffffff839862fc
	0xffffffff8398633f

Raw coverage files can be obtained either from /rawcover manager HTTP handler,
or from syz-execprog with -coverfile flag.

Usage:
	syz-cover [-os=OS -arch=ARCH -kernel_src=. -kernel_obj=.] rawcover.file*
2018-12-10 16:37:01 +01:00
Dmitry Vyukov
5dd495422e syz-manager: move coverage report code to pkg/cover
This will allow better testing and make it possible to reuse this code.
2018-12-10 16:37:01 +01:00
Dmitry Vyukov
158d613397
Update found_bugs.md 2018-12-10 16:35:25 +01:00
Greg Steuck
6565f24da9 executor: add setuid sandbox for openbsd
* executor/common_bsd: add setuid sandbox

Fixes #833

cc @mptre

* Reduced duplications, resolved TODO.
2018-12-10 11:20:16 +01:00
Michael Tuexen
96cc4c50c3 sys/openbsd: fix socketpair usage 2018-12-09 15:31:32 +01:00
Michael Tuexen
a320ef9292 sys/netbsd: fix socketpair usage 2018-12-09 15:31:32 +01:00
Michael Tuexen
99fd96656f sys/freebsd: fix socketpair usage 2018-12-09 15:31:32 +01:00
Dmitry Vyukov
82f11ef0c5 sys/linux: add AF_TIPC netlink interface and packet formats 2018-12-09 13:02:13 +01:00
Dmitry Vyukov
a3f232631f sys/linux: add AF_TIPC descriptions 2018-12-09 12:52:50 +01:00
Dmitry Vyukov
72a027681e sys/linux: socketpair returns sockets not just fd's 2018-12-09 12:35:07 +01:00
Greg Steuck
979179d6d6 tools/*openbsd*: use nc from base instead of curl from package
This worked fine for ci machine but gce workers have no packages.
2018-12-09 08:55:19 +01:00
Dmitry Vyukov
c791837863 executor: fix handling of big-endian bitfields
Currently we apply big-endian-ness and bitfield-ness in the wrong order in copyin.
This leads to totally bogus result. Fix this.
2018-12-08 19:08:08 +01:00
Anton Lindqvist
3350826625 pkg/report: add initial symbolize suppport to OpenBSD 2018-12-08 18:59:10 +01:00
Anton Lindqvist
977de94f01 tools/syz-symbolize: add optional arch flag with sensible default
The manager config passed to NewReporter() must include a valid arch by now.
2018-12-08 18:59:10 +01:00
Anton Lindqvist
4e1aade2fe pkg/report: pass the target to each OS report constructor
In order to use the already defined kernel name in sys/targets to reduce
duplications.
2018-12-08 18:59:10 +01:00
Anton Lindqvist
2b3ea5d7e0 docs/openbsd: update found_bugs.md 2018-12-08 18:17:29 +01:00
Anton Lindqvist
c5327c1c7f docs: mention OpenBSD in setup.md 2018-12-08 17:27:05 +01:00
Dmitry Vyukov
b554370c53 docs/darwin: add some info about darwin
Also move windows into separate dir,
mention windows/darwin in found bugs.
2018-12-08 15:26:30 +01:00
Michael Tuexen
579f36e1d8 sys/linux: improve recvmsg descriptions 2018-12-08 14:48:53 +01:00
Michael Tuexen
fabb98a11f sys/openbsd: improve recvmsg() description 2018-12-08 14:48:53 +01:00
Michael Tuexen
527daf788e sys/netbsd: improve recvmsg() description 2018-12-08 14:48:53 +01:00