Commit Graph

634 Commits

Author SHA1 Message Date
Dmitry Vyukov
a4718693a3 sys/linux: add syz_execute_func
The function executes random code.

Update #310
2018-08-30 21:45:04 -07:00
Dmitry Vyukov
4239b99abb sys/linux: add nbd descriptions
Update #533
2018-08-30 21:45:03 -07:00
Dmitry Vyukov
0ed59d7fcd sys/linux: generate better block device names for mount 2018-08-30 21:45:03 -07:00
Dmitry Vyukov
e8dd2c6713 prog: add concept of "special pointers"
Currently we only generate either valid user-space pointers or NULL.
Extend NULL to a set of special pointers that we will use in programs.
All targets now contain 3 special values:
 - NULL
 - 0xfffffffffffffff (invalid kernel pointer)
 - 0x999999999999999 (non-canonical address)
Each target can add additional special pointers on top of this.

Also generate NULL/special pointers for non-opt ptr's.
This restriction was always too restrictive. We may want to generate
them with very low probability, but we do want to generate them.

Also change pointers to NULL/special during mutation
(but still not in the opposite direction).
2018-08-30 21:45:03 -07:00
Dmitry Vyukov
6ba5fe3e62 sys/openbsd: disable mknod sanitization as tests fail
TestSerializeDeserializeRandom fails from time to time
because program is different after we serialize/deserialize it.
Turns out openbsd SanitizeCall is not idempotent.
Add a test for this and disable the logic for now.
2018-08-30 21:44:56 -07:00
Dokyung Song
99c7e4ecfa sys/fuchsia: describe method response types & handles; add support for union
* create a response handle structure for each FIDL method
* generate zx_channel_write for requests having no response
* generate zx_channel_read for events (no request but just response)
* translate FIDL union types to syzkaller union types
  (see fuchsia_io_ObjectInfoHandles)
2018-08-29 19:08:11 -07:00
Dmitry Vyukov
edb2f5f1e1 sys/linux: add ext4 ioctls and overlayfs
Update #533
2018-08-29 15:59:16 -07:00
Anton Lindqvist
b771b17ec9 Add mandatory OpenBSD bits (#689)
all: add openbsd support

squash of the following commits:

* openbsd: add mandatory bits
* report: add OpenBSD support
* executor: skip building kvm on OpenBSD
* executor: add OpenBSD support
Linking against libutil is necessary due to usage of openpty(3).
* executor: fix typo in fail() message
* fixup! report: add OpenBSD support
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! report: add OpenBSD support
* gometalinter: skip sys/openbsd
2018-08-28 10:07:26 -07:00
Dokyung Song
7ef1de9ea4 sys/fuchsia: description for fuchsia.io FIDL interfaces 2018-08-27 14:01:34 -07:00
Dmitry Vyukov
758cd203cb sys/linux: fix kvm_ioeventfd layout 2018-08-26 05:54:16 +02:00
Dmitry Vyukov
0be67307ca sys/linux: add few assorted new flags/ioctls 2018-08-26 05:51:30 +02:00
Dmitry Vyukov
98b0bddc4d sys/linux: treat cuse as fuse
It's mostly fuse.

Also regenerate consts on latest kernel.
2018-08-26 05:17:40 +02:00
Dmitry Vyukov
ce0eccdea6 sys/linux: add IOCB_CMD_POLL 2018-08-26 05:01:08 +02:00
Dmitry Vyukov
77e79ca08e sys/linux: add userio descriptions
Update #533
2018-08-26 04:54:54 +02:00
Dmitry Vyukov
76e7c3dfb4 sys/netbsd: use posix helper instead of copy-pasted code
We now have this common logic in sys/targets,
so use it instread of copy-pasted code.
I missed this file during the refactoring.
2018-08-25 09:05:51 -07:00
Dokyung Song
1d9f787ea6 sys/fuchsia: Remove read_status from zx_channel_call args, and reflect zx_time_t type change (unsigned -> signed) 2018-08-24 20:01:29 -07:00
Dmitry Vyukov
2dc4378f02 prog: don't add fallback signal after seccomp
seccomp filter can produce arbitrary errno values for subsequent syscalls.
Don't trust anything afterwards.
2018-08-19 00:13:24 -07:00
Dmitry Vyukov
7067e78fd6 executor: fix gcc warnings in fuchsia generated code
gcc complains about function declarations not being prototypes,
signed/unsigned cast mismatch and casts between incompatible functions.
Fix them.
2018-08-19 01:53:59 +02:00
Dokyung Song
db1858f6b9 sys/fuchsia: semi-automatically generated FIDL launcher description 2018-08-17 14:31:53 -07:00
Dmitry Vyukov
9ccc1d4565 sys/linux: add uinput support 2018-08-15 01:50:08 +02:00
Dmitry Vyukov
0e6dcb8809 sys/linux: add uhid support 2018-08-15 00:10:16 +02:00
Dmitry Vyukov
1be453f07b sys/linux: fix invalid cdrom description 2018-08-10 18:44:31 +02:00
Dmitry Vyukov
3a2fe60529 executor: fix cgroups
1. Create per-proc cgroup in executor.
2. Setup cgroups after chdir into test dir
   (it assumes relative paths against test dir).
3. Add test.
2018-08-09 16:05:46 +02:00
Dmitry Vyukov
922e8e2734 executor: mount binfmt_mist
We forgot to mount binfmt_misc. Mount it. Add a test.
Increase per-call timeout, otherwise last execve timesout.
Fix csource waiting for call completion at the end of program.
2018-08-09 16:05:46 +02:00
Dmitry Vyukov
acf31536e9 executor: clean up immutable dirs
Turns out dirs can be immutable too.

Update #650
2018-08-09 16:05:46 +02:00
Dokyung Song
2eeda842c8 sys/fuchsia: add syscall description for binding channels to Launcher 2018-08-08 19:31:56 +02:00
Dmitry Vyukov
d46deef51c executor: clean up immutable files
Fixes #650
2018-08-08 15:06:29 +02:00
Dmitry Vyukov
3653592507 pkg/runtest: assorted improvements
Support checking "blocked"/"unfinished" flags for calls.
Support test constanints, e.g. "requires: threaded" or "requires: -sandbox=setuid".
Some improvements in tools/syz-runtest.

Update #603
2018-08-08 15:05:01 +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
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
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
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
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
8ef497b652 gometalinter: clean up vetshadow
This just cleans up existing warnings.
vetshadow is not enabled yet because it crashes.

Update #538
2018-07-31 20:38:33 +02:00
Dmitry Vyukov
f5d67fbd9c .gometalinter.json: enable gofmt
The part that we want from gofmt is simplify (-s).
Fix all code that needs fixing.

Update #538
2018-07-31 12:16:54 +02:00
Dokyung Song
6982d892b6 sys/targets: fix Fuchsia lib directory
to fix linking error when building syz-executor for Fuchsia.
2018-07-25 08:26:57 +02:00
Dmitry Vyukov
4969639c7c executor: fix strict aliasing violations
test_copyin does bad things. Fix that.

executor/test.h: In function ‘int test_copyin()’:
executor/common.h:299:16: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   *(type*)(addr) = (type)(val);                                     \
                ^
2018-07-24 13:29:26 +02:00
Dmitry Vyukov
9fe4bdc5f1 executor: overhaul
Make as much code as possible shared between all OSes.
In particular main is now common across all OSes.
Make more code shared between executor and csource
(in particular, loop function and threaded execution logic).
Also make loop and threaded logic shared across all OSes.
Make more posix/unix code shared across OSes
(e.g. signal handling, pthread creation, etc).
Plus other changes along similar lines.
Also support test OS in executor (based on portable posix)
and add 4 arches that cover all execution modes
(fork server/no fork server, shmem/no shmem).

This change paves way for testing of executor code
and allows to preserve consistency across OSes and executor/csource.
2018-07-24 12:04:27 +02:00
Hangbin Liu
570df9b277 sys/linux/socket_netlink_route: add specific policies for IFLA_LINKINFO
Add interface specified policies for IFLA_LINKINFO. I only added the
interfaces we create in initial setup. Remain other types of interfaces
in the TODO list.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-07-17 10:08:31 +02:00
Dmitry Vyukov
1376136672 sys/akaros: add a bunch of global files for akaros 2018-07-16 20:30:09 +02:00
Dmitry Vyukov
40cb0c9aa6 sys/akaros: fix signatures of file syscalls
Most of them differ and accept path length and/or pid.
2018-07-16 17:39:58 +02:00
Dmitry Vyukov
df5ae5f537 sys/akaros: don't call provision(-1)
It causes kernel debug splat,
which has high chances of corrupting kernel crashes.
2018-07-16 17:02:02 +02:00
Dmitry Vyukov
7cfcfa6a73 sys/akaros: disable init_arsc syscall
It unconditionally crashes kernel now.
2018-07-16 16:57:35 +02:00
Dmitry Vyukov
fcdb43e97d sys/linux: regenerate files 2018-07-13 12:44:14 +02:00
Dmitry Vyukov
f642b4185a sys/linux: improve fuse descriptions 2018-07-12 12:36:38 +02:00
Dmitry Vyukov
95e7a88b97 sys/linux: implement fuse as normal syscalls
Remove syz_fuse* and implement them as normal syscalls.
We not have enough expressive power to form mount options.
2018-07-10 16:18:45 +02:00
Dmitry Vyukov
40ed7e838a sys/linux: use fmt in filesystem options
We currently generate poor formatted intergers,
generate proper integers using the new fmt type.
2018-07-09 21:42:43 +02:00