Commit Graph

2947 Commits

Author SHA1 Message Date
Dan Austin
14f8a76fe7 executor: checkpoint net namespace in the right namespace
With checkpoint_net_namespace moved to setup_common,
and Android fuzzing session terminates prematurely due to
ipv4_tables not being initialized at this time.
Moving the call back to loop fixes this behavior.
2018-08-08 11:03:33 +02:00
Dmitry Vyukov
1beb81367c executor: check write return value
gcc complains:

error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]

Also fix includes.
2018-08-05 13:05:47 +02:00
Dmitry Vyukov
2b5d3da50f syz-manager: fix number of syscalls in web ui 2018-08-04 17:55:19 +02:00
Dmitry Vyukov
3a7200e49b executor: abort fuse connection
If the test process is not dying after 100ms,
abort all fuse connections in the system.
This gets rid at least of simple fuse deadlocks,
let's see how well this works in all cases.
2018-08-04 17:50:58 +02:00
Dmitry Vyukov
bf45aa5363 pkg/report: skip more spinlock frames
Currently this report is named:
"general protection fault in perf_trace_lock"
which is bad.
2018-08-04 17:39:21 +02:00
Dmitry Vyukov
3476a2dfb9 pkg/osutil: replace UmountAll with RemoveAll
In pkg/ipc we don't just want to UmountAll,
we want to remove all handling as many cases as possible
(mounts, read-only files, etc, similar to executor's remove_dir).
So unmounting and removing needs to be a single function,
so that it can handle all these cases.
2018-08-04 15:50:40 +02:00
Dmitry Vyukov
df7f6947ba pkg/runtest: skip 32-bit tests in short mode
Fails on travis...
2018-08-03 21:24:35 +02:00
Dmitry Vyukov
f557fcdfa6 vm/gvisor: fix current binary lookup
os.Args[0] can be just binary name which was looked up using $PATH.
In such case copy will fail because the path does not exist.
Lookup binary name using $PATH.
2018-08-03 21:08:11 +02:00
Dmitry Vyukov
2763e04c22 tools/syz-runtest: add tool for program unit testing
The tool is run as:

$ syz-runtest -config manager.config

This runs all programs from sys/*/test/* in different modes
on actual VMs and checks results.

Fixes #603
2018-08-03 21:08:02 +02:00
Dmitry Vyukov
78e3ad98f6 sys/test: add more tests
Add syz_errno syscall which sets errno to the argument,
and add a test with different errno values.
This mostly tests the testing infrastructure itself.

Add syz_compare syscall which compare two blobs,
this can be used for testing of argument memory layout.

Implement syz_mmap and fix Makefile to allow building syz-execprog for test OS.
Useful for debugging.

Update #603
2018-08-03 19:53:14 +02:00
Dmitry Vyukov
5ba57bfe16 pkg/runtest: add package for syzkaller program unit-testing
Package runtest is a driver for end-to-end testing of syzkaller programs.
It tests program execution via both executor and csource,
with different sandboxes and execution modes (threaded, repeated, etc).
It can run test OS programs locally via run_test.go
and all other real OS programs via tools/syz-runtest
which uses manager config to wind up VMs.
Test programs are located in sys/*/test/* files.

Update #603
2018-08-03 18:47:42 +02:00
Dmitry Vyukov
649477b6a5 pkg/ipc: remove abort signal and buffer size
They were needed for intermediate gvisor support.
Now that we have end-to-end support for gvisor,
they are not needed anymore. Remove.
2018-08-03 18:29:20 +02:00
Dmitry Vyukov
6bfd4f09db pkg/ipc: move flags into subpackage
Move all ipc flags into pkg/ipc/ipcconfig package
so that importing pkg/ipc does pull in the flags.
2018-08-03 18:12:24 +02:00
Dmitry Vyukov
5ff1f9faec pkg/csource: minor fixes
1. Print errno with %u instead of %d
2. Avoid unused var warning for syz_emit_ethernet
   when tracing is enabled.
2018-08-03 16:57:08 +02:00
Dmitry Vyukov
534859fe5a pkg/osutil: minor tweaks
1. Make it clear when a command times out.
2. Don't add trailing newline for VerboseError if output is empty.
3. Fix WriteExecFile for the case when the file already exists.
2018-08-03 16:51:48 +02:00
Dmitry Vyukov
0a2c27237b pkg/rpctype: ignore SetDeadline error
SetDeadline is not implemented on fuchsia and always fails.
2018-08-03 12:22:36 +02:00
Dokyung Song
cc4f6d0a87 sys/fuchsia: zx_log_* got replaced by zx_debuglog_* 2018-08-03 12:03:03 +02:00
Dmitry Vyukov
5b7e23bb61 sys/akaros: remove /dev/cons
Presumably it causes corrupted console output.
2018-08-02 19:47:32 +02:00
Dmitry Vyukov
41beddb6da executor: extend logging in netfilter code
We see some failures there, extend logging so that it's least
possible to understand what exactly call has failed.
2018-08-02 19:45:31 +02:00
Dmitry Vyukov
d9a893a554 Makefile: don't compile all targets into target binaries
Currently target binaries contain support for all OS/arch combinations.
However, obviously a fuchsia target binary won't test windows.
For target binaries we need support only for a single target
(with the exception of 386/arm target in amd64/arm64 binaries).
So compile in only _the_ target into target binaries.
This reduces akaros/amd64 fuzzer binary from 33 to 7 MB
and execprog from 28 to 2 MB.
2018-08-02 19:07:22 +02:00
Dmitry Vyukov
5cbdd9f444 gometalinter: strengthen gocyclo limit
Strengthen gocycle limit 35->24! Yay! No more jumbo functions!

Fixes #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
88d4a8fc56 sys/syz-extract: refactor main
main is too long and complex. Move more logic into helper functions.

Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
394e6910d0 pkg/compiler: refactor checkType
checkType is too long and complex.
Move basic type checks and args checks into separate functions.

Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
1baf121c2f pkg/csource: refactor generateCalls
Move call generation into a separate function.

Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
3c5c9177b5 pkg/csource: refactor defineList
Make it simpler and shorter.

Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
28e60b2339 vm/gce: move console check into separate function
Update #538
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
976e4de048 syz-manager: refactor work with hub
Move work with hub into a separate file and fully separate
its state from the rest of the manager state.
First step towards splitting manager into managable parts.
This also required to rework stats as they are used throughout the code.

Update #538
Update #605
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
fbedd425b5 pkg/mgrconfig: move from syz-manager/mgrconfig
mgrconfig was used only by syz-manager initially,
but now it's used by a dozen of packages and it's
weird to import from under a binary dir.
pkg/ is much more reasonable dir for a widely used
helper package.
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
d5b1542a54 syz-manager/mgrconfig: refactor more
Complete is still too long and complex. Split more.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
15d078f2b6 syz-manager/mgrconfig: remove the deprecated vmlinux parameter 2018-08-02 16:57:31 +02:00
Dmitry Vyukov
a5892295bf syz-manager/mgrconfig: refactor Complete
Split the very long function into 2.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
72ad4a3c4c pkg/report: refactor test
Split a long function.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
95a080a682 prog: strenghten type checking during validation
Check that argument types match expected static types.
I.e. detect when, say, syscall argument is a resource,
but actual generated argument is a pointer.
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
ae2f24aa70 prog: refactor calcStaticPriorities
Factor out several helper functions.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
c56465d568 prog: split and simplify Mutate
Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
1da82ae0f0 prog: introduce debugValidate
Move debug validation into a separate function.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
c8643744fe prog: refactor defaultArg/isDefaultArg
Refactor from single-big-switch to type methods.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
e002278dfb prog: refactor SerializeForExec
Factor copyin, copyout and checksums into separate functions.
Also slightly tidy csum analysis.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
1637002cde pkg/ipc: refactor output parsing
readOutCoverage was complete mess.
Split it into several functions.
Use callReply struct directly.
Make error handling more idiomatic.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
66d3e115e4 syz-fuzzer: slightly simplify main
Move output type parsing into a separate function.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
e65f4e79e3 syz-manager/mgrconfig: better handling of unknown os/arch
Produce a readable error instead of crashing on nil deref.
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
bdc8436c58 pkg/serializer: refactor
Factor out serialization of pointers, slices and
structs into separate functions.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
b24fab5550 dashboard/app: refactor incomingCommandTx
Factor out actual command handling out of incomingCommandTx.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
9b488fad5e dashboard/app: refactor addTestJob
Factor request checking from addTestJob into checkTestJob.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
906c09c71a dashboard/app: simplify reportCrash
Factor crash saving out of reportCrash into saveCrash.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
af15ef43a8 pkg/compiler: refactor checkNames
Too complex. Split into 2 functions.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
3a4641d90c pkg/compiler: refactor structGen
Still too complex. Split more.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
2e17e2c0ad vm: refactor MonitorExecution
Too complex. Split into several functions.

Update #538
2018-08-02 16:57:31 +02:00
Dmitry Vyukov
c67a9331a4 gometalinter: clean up some errcheck warnings
Check some errors where relevant.
Unfortunately enabling errcheck does not look feasible, too many warnings.

Update #538
2018-08-02 16:57:31 +02:00
Zach Riggle
0a7cf4ec63 manager: Fix default value for 'sandbox' (#666)
docs: fix default sandbox value

The docs and code comments state in several places that 'setuid'
is the default sandbox value.  However, the default is actually
'none'.  Fix docs.
2018-08-01 19:42:07 +02:00