Commit Graph

761 Commits

Author SHA1 Message Date
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
Dmitry Vyukov
59da9e4393 sys/linux: use negative consts where useful 2018-07-09 20:54:47 +02:00
Dmitry Vyukov
f25e577041 sys/linux: refine 9p descriptions
RVERSION needs to use 0xffff tag, otherwise parsing fails.
Use only tags 1 and 2. They are densely allocated,
so most of the time it's 1. And it needs to be correct in
multiple replies for mount to succeed. So limit tag space.
2018-07-08 22:52:24 +02:00
Dmitry Vyukov
4bf3b336eb sys/linux: modernize cgroup descriptions 2018-07-08 22:52:24 +02:00
Dmitry Vyukov
e63a51b4b3 sys/linux: modernize selinux descriptions 2018-07-08 22:52:24 +02:00
Dmitry Vyukov
eb5690a56d sys/linux: extend 9p descriptions
Add actual protocol messages.
2018-07-08 22:52:24 +02:00
Dmitry Vyukov
306ca0571c prog, pkg/compiler: support fmt type
fmt type allows to convert intergers and resources
to string representation.
2018-07-08 22:52:24 +02:00
Dmitry Vyukov
c9a7a4dccd executor: executor fix fuchsia build 2018-07-07 19:08:38 +02:00
Dmitry Vyukov
4b2ad42d41 sys/linux: refine vfat/msdos options 2018-07-07 16:25:40 +02:00
Julia Hansbrough
ab89aea98e sys/fuchsia: Update Fuchsia syscalls.
Updates cover
* zx_vmo_create
* zx_clock_get_monotonic
* hypervisor- and vCPU-related syscalls
* system_get_features
* some DDK syscalls
2018-07-07 13:56:36 +02:00
Dmitry Vyukov
6c0c0099a0 sys/linux: add 9p descriptions
Only mount for now.
2018-07-06 21:31:31 +02:00
Dmitry Vyukov
c8672723c6 sys/linux: update autogenerated files
"sys/linux: add mount$bpf" commit did not include these changes.
2018-07-06 20:19:58 +02:00
Dmitry Vyukov
3439016dc2 sys/akaros: add all syscalls 2018-07-06 20:19:03 +02:00
Dmitry Vyukov
9636bc933e sys/linux: add mount$bpf
Plus some minor assorted fixes.
2018-07-06 15:29:52 +02:00
Dmitry Vyukov
c219f89ca4 sys/targets: fix akaros path handling
make extract needs path to whole kernel, not just toolchains,
so assume that toolchains are in toolchains subdir in kernel.
2018-07-05 13:10:43 +02:00
Dmitry Vyukov
d225783201 sys/targets: fix akaros compiler
Remote install dir from compiler path (install dir was my invention).
Remove additional flags, the compiler now seems to know own sysroot.
2018-07-05 10:44:34 +02:00
Chi Pham
317fc8ea3e sys/linux: add rtc description 2018-07-02 17:55:41 +02:00
Dmitry Vyukov
664ef9a3e1 pkg/compiler: check for unused declarations
Error on unused structs/unions/resources/flags.
Finds tons of bugs.
2018-06-30 19:34:41 +02:00
Dmitry Vyukov
9054fae016 sys/fuchsia: remove ZX_POL_NEW_EVPAIR
It was removed from zircon.
2018-06-30 17:30:05 +02:00
Dmitry Vyukov
5012ddc8eb prog: detect when flags are a bitmask 2018-06-30 13:27:24 +02:00
Dmitry Vyukov
5739f7bef2 sys/fuchsia: add few new syscalls 2018-06-29 20:55:42 +02:00
Dmitry Vyukov
1a3c2436df sys/targets: fix fuchsia/arm64 flags 2018-06-29 10:47:04 +02:00
Dmitry Vyukov
c390949829 sys/targets: fix env expansion for fuchsia 2018-06-29 09:24:07 +02:00
Dmitry Vyukov
e0755ee02f sys/fuchsia: add pipe syscall 2018-06-29 09:23:49 +02:00
Dmitry Vyukov
c3e23de010 sys/targets: actually check -static support 2018-06-28 09:23:26 +02:00
Dmitry Vyukov
eecefab32c Makefile: fix fuchsia build 2018-06-26 18:59:07 +02:00
Dmitry Vyukov
b5f361149e sys/fuchsia: remove zx_job_set_relative_importance
It seems to be removed from zircon.
2018-06-26 18:48:45 +02:00
Dmitry Vyukov
2064fc5c91 sys/linux: add 2 custom uids
Give fuzzer 2 custom uids to mess with.
Ideally these should be proc, we can't do this for resources.
2018-06-23 11:36:55 +02:00
Dmitry Vyukov
f199f3a27d sys/linux: fix /dev/urandom descriptions
Don't use pseudo syscall without a reason.
Remove duplicate syscall.
2018-06-23 11:25:20 +02:00
Dmitry Vyukov
c31f96a8c6 executor: rework fallback coverage
We have fallback coverage implmentation for freebsd.
1. It's broken after some recent changes.
2. We need it for fuchsia, windows, akaros, linux too.
3. It's painful to work with C code.

Move fallback coverage to ipc package,
fix it and provide for all OSes.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
732e4256fb sys/linux: regenerate consts
@evdenis
2018-06-19 12:41:12 +02:00
Denis Efremov
14e96aad73 sys/linux: additional scsi_ioctls of sg device
Add previously skipped SCSI_IOCTL_* ioctls in
the sg rule.

Signed-off-by: Denis Efremov <efremov@linux.com>
2018-06-19 12:35:31 +02:00
Dmitry Vyukov
dde158e0af sys/linux: refine xdp description
Split sockaddr_xdp for bind.
Bind accepts another sock_xdp in addr.
Without the split getsockaddr "can" create sock_xdp's
because it returns generic sockaddr which contains
all addresses, including sockaddr_xdp, which in turn
contains sock_xdp.
2018-06-18 19:45:49 +02:00
Dmitry Vyukov
920b18be87 sys: mark output resources as opt
Mark output resources as opt in preparation for more
precise constructor calculation.
2018-06-18 19:45:47 +02:00
Dmitry Vyukov
b431b2cc4c sys/linux: add rseq syscall 2018-06-12 18:06:44 +02:00
Ondrej Mosnacek
112eec798f sys/linux: add missing generic crypto algs 2018-06-11 14:22:05 +03:00
Dmitry Vyukov
deb0e69e10 executor: always use errors=continue when mounting ext2/3/4
For ext2/3/4 we have to have errors=continue because the image
can contain errors=panic flag and can legally crash kernel.

Fixes #599
2018-06-11 12:12:01 +03:00
Dmitry Vyukov
866118af36 sys/linux: add udplite sockets 2018-06-08 20:51:57 +02:00
Dmitry Vyukov
721401058c sys/linux: add TCP_ZEROCOPY_RECEIVE and TCP_INQ 2018-06-08 20:40:46 +02:00
Dmitry Vyukov
09ca59bff7 sys/linux: add ip6t_srh1 description 2018-06-08 20:29:37 +02:00
Dmitry Vyukov
145029013c sys/linux: add more fs ioctls 2018-06-08 20:21:23 +02:00
Dmitry Vyukov
9dbd63342f sys/linux: minor fixes for aio 2018-06-08 19:26:15 +02:00
Dmitry Vyukov
c5ca9ff98c sys/linux: move aio descriptions into separate file 2018-06-08 18:55:53 +02:00
Hangbin Liu
f7b27b7a19 sys/linux: add remaining qdisc/tclass/tfilter/actions for netlink route sched
Update #533

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-06-08 08:11:20 +03:00
Dmitry Vyukov
645e75f803 executor: make syscall table and number constant
We see some crashes that suggest corruption of the syscall number:

invalid command number 1296 (errno 11)
invalid command number 107 (errno 110)

Make the table and the number constant to prevent corruption.
2018-06-07 15:32:30 +02:00
Dmitry Vyukov
8b06421c04 sys/linux: regenerate consts on tip 2018-06-07 13:13:50 +02:00
Dmitry Vyukov
85e7c1404f sys/linux: add AF_XDP support 2018-06-07 13:13:49 +02:00
Dmitry Vyukov
667b9a6950 sys/linux: fix up midi descriptions 2018-06-07 11:10:49 +02:00
srikanth007m
72b15886d9 Sound Mixer Descriptors for MIDI
Enabling MIDI supported IOCTL descriptors for Syzkaller
2018-06-07 11:56:11 +03:00
srikanth007m
e1c9dcfb07 MIDI Sound mixer Const file 2018-06-07 11:56:04 +03:00
Dmitry Vyukov
a251f32666 sys/fuchsia: disable zx_task_kill
Disable zx_task_kill until we figure out how to prevent executor from killing fuzzer.

Update #594
2018-06-06 20:52:30 +02:00
Dmitry Vyukov
41f9540d7a sys/fuchsia: remove ZX_VMO_OP_LOOKUP
It's removed from latest zircon sources.
2018-06-06 10:02:03 +02: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
Denis Efremov
863a24bb5d sys/linux: id field fix in v4l2_event_subscription
The id field in the v4l2_event_subscription structure
currently described as: id len[type, int32].

But all the documentation states is:
"id - ID of the event source. If there is no ID associated
with the event source, then set this to 0. Whether or not
an event needs an ID depends on the event type."

So, the documentation clearly states that:
1. id - is the source of an event
2. type - is the type of an event
3. for some types of events there is no source and id can be 0

According to this 'id int32' is more accurate description of
the field.
2018-06-05 13:33:12 +03:00
Denis Efremov
a316ff9273 sys/linux: add new mount options for xfs && btrfs in kernel v4.17
1. lazytime && nolazytime for xfs
2. nossd_spread for btrfs
2018-06-05 08:47:06 +03:00
Ondrej Mosnacek
a50d873b17 sys/linux: add MORUS and AEGIS AEAD algorithms 2018-06-04 14:57:38 +03:00
Denis Efremov
ead447eb6f sys/linux: fix cdrom rules description && clarification on how to run
1. Comment with clarification on how to run qemu added.
2. Fixed description of int type.

Signed-off-by: Denis Efremov <efremov@linux.com>
2018-06-04 14:36:27 +03:00
Dmitry Vyukov
63f18a76c3 sys/linux: improve /dev/snd/controlC descriptions 2018-06-04 12:07:28 +02:00
Denis Efremov
2f93b54f26 sys/linux: video4linux v4l2_jpegcompression APP_len fix
Signed-off-by: Denis Efremov <efremov@linux.com>
2018-05-29 16:32:01 +02:00
Denis Efremov
e276de775a sys/linux: cdrom generic description
Signed-off-by: Denis Efremov <efremov@linux.com>
2018-05-29 14:06:40 +02:00
Dmitry Vyukov
849705db5c sys/linux: few minor tweaks for bpf 2018-05-18 19:29:27 +02:00
Dmitry Vyukov
d302e81641 sys/linux: add MAP_FIXED_NOREPLACE const 2018-05-18 11:14:56 +02:00
Dmitry Vyukov
be1a56115b sys/linux: use optional in tun descriptions 2018-05-17 12:16:18 +02:00
Dmitry Vyukov
256b70f9cf sys/linux: fix duplicate field in struct 2018-05-17 11:45:51 +02:00
Dmitry Vyukov
9fb3ae4dfd pkg/osutil: introduce TempFile helper
Introduce TempFile helper and use it in several packages.
2018-05-14 11:17:23 +02:00
Dmitry Vyukov
63ef537b14 sys/syz-extract: improve compier error messages
Print each constant on separate line.
When compiler prints error messages it prints whole line
containing an error. So currently it prints all constants (thousands).
With this change it prints just the problematic constant.
2018-05-11 15:48:33 +02:00
Dmitry Vyukov
c8229620ff sys/linux: regenerate video4linux consts on the right tree
Now generated on:
https://source.codeaurora.org/quic/la/kernel/msm-4.9 msm-4.9
2018-05-11 15:09:33 +02:00
Dmitry Vyukov
2d35915b13 sys/linux: add missing consts for video4linux.txt
For now other arches are regenerated on upstream tree.
It does not contain a bunch of consts, so we define them to 1 for now.
arm64 consts are left intact.
video4linux.txt is added to "android" files in syz-extract,
so that future make extract runs don't overwrite arm64 consts.

Also fix VIDIOC_G_FBUF argument direction, currently tests crash with:

panic: call ioctl$VIDIOC_G_FBUF: pointer arg 'buffer' has output direction [recovered]
	panic: call ioctl$VIDIOC_G_FBUF: pointer arg 'buffer' has output direction
2018-05-11 14:24:16 +02:00
srikanth007m
ace16942e5 sys/linux: add Video4Linux IOCTL Descriptors
* Adding Video4Linux IOCTL Descriptors

This will cover the ioctl() function used to program V4L2 devices

* Const file for video4linux_arm64.const
2018-05-11 14:11:10 +02:00
Hangbin Liu
b88872ba0e sys/linux: add AF_NETLINK/NETLINK_ROUTE SCHED support
Update #533

As TC(net sched) is a large group, I separate it from socket_netlink_route.txt.
Currently I only implement the framework with two qdisc/tclass/filters.
I will add the others later.

v2: Fix tcm_handle major and minor order. Add tcm_handle_offsets.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-05-08 17:15:21 +02:00
Dmitry Vyukov
99c1f48659 sys/syz-extract: split overly long function
Update #538
2018-05-07 16:50:19 +02:00
Dmitry Vyukov
f914e0a305 sys: dedup sanitization of common unix syscalls
Update #538
2018-05-07 14:42:55 +02:00
Dmitry Vyukov
cda1fcb742 sys: dedup mmap code across OSes
Update #538
2018-05-06 16:58:38 +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
31ea20ce83 sys: move generate files to separate packages
Move generated files to gen subdir. This allows to:
1. Rebuild init.go without rebuilding generated code.
2. Excluding generated files from gometalinter checking.
This makes faster and consume less memory.

Update #538
2018-05-05 15:40:10 +02:00
Dmitry Vyukov
9dfb5efa91 prog: simplify code
Now that we don't have ReturnArg and only ResultArg's refer
to other ResultArg's we can remove ArgUser/ArgUsed and
devirtualize lots of code.
2018-05-05 10:13:04 +02:00
Dmitry Vyukov
0f503c18d9 gometalinter: enable misspell
Update #538
2018-05-03 15:53:13 +02:00
Dmitry Vyukov
39302300d9 gometalinter: check unkeyed composite literals
Update #538
2018-05-03 14:01:48 +02:00
Dmitry Vyukov
4c24e4a467 gometalinter: enable package comment checking
Update #538
2018-05-03 13:53:01 +02:00
Dmitry Vyukov
bb79c6ab16 sys/linux: add few more filesystems with images 2018-04-29 18:59:43 +02:00
Dmitry Vyukov
67bec9bb44 sys/linux: describe block device ioctls
Describe block device ioctls.
Describe sg device ioctls.
Add few more devices.
2018-04-29 18:44:32 +02:00
Dmitry Vyukov
dba54bc2b8 sys/linux: refactor some flags to use char consts 2018-04-29 12:04:22 +02:00
Dmitry Vyukov
d5a5d04517 sys/linux: a bunch of assorted improvements 2018-04-27 19:52:20 +02:00
Dmitry Vyukov
190d92e056 sys/linux: extend namespace desciptions
Slightly extend namespace descriptions and move
them to a separate file.
2018-04-27 18:47:58 +02:00
Dmitry Vyukov
6bd8902381 syz-fuzzer: clean up after probing coverage
We left mmap memory and comparison tracing enabled.
2018-04-27 14:33:01 +02:00
Hangbin Liu
73417389ce sys/linux/socket_netlink_route: add routing rules
Also fix RTA_MULTIPATH data type. We only need struct rtnexthop,
no need to use array type.

v1 -> v2:
Use uid and sock_port instead of int32/16. Use flags for FRA_PROTOCOL
and FRA_IP_PROTO.

Add type fib_rule_hdr because even though the structure is same with rtmsg.
The table, action and flags values are not same.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-25 09:33:09 +02:00
Dmitry Vyukov
500489e312 sys/syz-extract: provide readable error on missing input file
Currently syz-extract crashes with nil deref panic if
it is executed manually and is gives an absent file name.
Output a readable error.
2018-04-19 19:43:27 +02:00
Dmitry Vyukov
3642839c10 sys/linux: add f2fs support 2018-04-19 14:15:31 +02:00
Denis Efremov
4f18337d89 sys/linux: add i2c generic description
Basic description of i2c from SIL2LinuxMP workshop.
2018-04-19 11:34:29 +02:00
Hangbin Liu
d1b2ef6921 sys/linux/socket_netlink_route: update RTM_GETSTATS PAYLOAD format
Update RTM_GETSTATS PAYLOAD format.

Also fix ipv4_getroute and ipmr_getroute PAYLOAD format.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-19 09:21:00 +02:00
Hangbin Liu
0a0c5db668 executor: add two slave interfaces for bridge,bond,team
Bridge device is used for forwarding. Bond/team device is used for
load balance and fail over. So it would make more sense to add two
slave interfaces for these devices.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-13 09:38:31 +02:00
Hangbin Liu
e694ebbaee sys/linux/rdma_cm: remove RDMA_PS_SDP
RDMA_PS_SDP has been removed since commit 1b90d3002e3ee ("RDMA/CMA: remove
RDMA_PS_SDP")

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-13 09:38:31 +02:00
Dmitry Vyukov
9cd56d71a8 sys/linux: add veth devices to devnames
Also comment new veth code for future me.
2018-04-11 11:36:25 +02:00
Dmitry Vyukov
8b8de42714 sys/linux: add few new crypto algorithms 2018-04-10 20:13:52 +02:00
Dmitry Vyukov
2d0ec24625 sys/linux: improve team descriptions
1. Create ifindex_team, because TEAM_ATTR_TEAM_IFINDEX must
   always point to a team device.

2. Remove output only attributes like team_attr_item_port, TEAM_ATTR_LIST_PORT,
   TEAM_ATTR_OPTION_CHANGED.

3. Restructure team_nl_option_policy: we always want TEAM_ATTR_OPTION_NAME/TYPE/DATA
   + optionally TEAM_ATTR_OPTION_ARRAY_INDEX and TEAM_ATTR_OPTION_PORT_IFINDEX.

4. Provide specialized team_nl_option_policy_per_port and team_nl_option_policy_array.

5. Make team_attr_option varlen.

6. Remove unnecessary indirection via team_attr_list_option/team_attr_list_port.

7. Fix data type for bpf_hash_func and lb_tx_hash_to_port_mapping.
2018-04-06 17:29:15 +02:00
Dmitry Vyukov
8e4c2e24cb executor: create team device 2018-04-06 17:28:33 +02:00
Hangbin Liu
4f1152d4db sys/linux: add netlink generic team descriptions
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-06 11:30:36 +02:00
Dmitry Vyukov
676bd07e7e sys/linux: test various binfmt's in execve 2018-04-02 20:10:48 +02:00
Dmitry Vyukov
3e679c51c0 pkg/compiler: support non-zero terminated filenames
Now file names become:

string[filename]

with a possibility of using other string features:

stringnoz[filename]
string[filename, CONST_SIZE]

and filename is left as type alias as it is commonly used:

type filename string[filename]
2018-04-02 20:10:07 +02:00
Dmitry Vyukov
374050e904 sys/syz-extract: fix linux/arm
At some point extract for linux/arm started to fail with:

extracting from key.txt
	failed to run compiler: exit status 1
/tmp/ccT6o7iZ.s: Assembler messages:
/tmp/ccT6o7iZ.s:4: Error: unknown pseudo-op: `.syntax'

This is caused by arch/arm/include/asm/unified.h:

__asm__(".syntax unified");

Ignore all __asm__ directives as we are cross compiling.
2018-04-02 20:09:30 +02:00
Dmitry Vyukov
99e3b0a7e8 sys/linux: add support for reading partition tables 2018-04-01 18:29:56 +02:00
Dmitry Vyukov
aa258367d3 sys/linux: fix misspelled const name
Fixes #552
2018-03-31 16:33:37 +02:00
Dmitry Vyukov
7c923cf8d4 sys/linux: add support for mounting filesystem images 2018-03-30 19:51:27 +02:00
Dmitry Vyukov
a5dbafc91d sys/linux: regenerate files
A previous commit included some non-regenerateed files.
Regenerate them now.
2018-03-29 11:58:32 +02:00
Dmitry Vyukov
bf5e585c5e executor: rework cgroups support
Turns out creating a cgroup per test is too expensive.
Moreover, it leads to hanged tasks as cgroup destruction
is asynchronous and overloads kernel work queues.

Create only a single cgroup per proc, but restrict
descriptions to mess with that single group,
instead test processes create own nested cgroups for messing.
2018-03-27 11:39:58 +02:00
Dmitry Vyukov
0ca7878bc3 sys/linux: add IPVS descriptions
Update #533
2018-03-26 18:27:11 +02:00
Dmitry Vyukov
2675f92065 sys/linux: add cgroup descriptions 2018-03-25 12:46:05 +02:00
Dmitry Vyukov
5b64ead83b sys/linux: add guehdr for udp packets 2018-03-21 15:27:47 +01:00
Dmitry Vyukov
7c62f71804 sys/linux: add netlink fou descriptions 2018-03-21 12:18:36 +01:00
Dmitry Vyukov
704259f644 sys/linux: fix nlattr alignment
It seems that alignment is never present in the nlattr.
2018-03-21 10:31:09 +01:00
Julia Hansbrough
f63eeee99f fuchsia: Update syzkaller to build with current Fuchsia API. (#543)
* fuchsia: Fix the `extractor` tool.

The include path in Zircon has changed; updated syz-extract/fuchsia.go
to include this, and re-ran extract to get updated *.const files.

* fuchsia: Update syzkaller to build with current Fuchsia API.

Fuchsia doesn't have a stable API right now, so alas, this will probably
continue to change until that's nailed down.

But, useful to get this up-to-date at least.

Relevant notes:
* zx_channel_call_finish and _retry aren't technically public; leave
them out until we have a less-cludgy way to expose them
* musl supports setjmp/longjmp but not _setjmp/_longjump
* remove some unsupported syscalls
* update the build invocation
2018-03-21 10:26:33 +01:00
Julia Hansbrough
040e73d644 fuchsia: Fix the extractor tool.
The include path in Zircon has changed; updated syz-extract/fuchsia.go
to include this, and re-ran extract to get updated *.const files.
2018-03-21 09:50:47 +01: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
c8a1847658 sys/linux: add descriptions for /dev/infiniband/rdma_cm
Also fix uffd and bluetooth consts while we are here.
2018-03-06 19:15:44 +01:00
Dmitry Vyukov
2814d6b845 sys/linux: fix perf_event_attr layout 2018-03-06 19:15:44 +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
e91c118db9 sys/linux: make ifreq template, fix some usages 2018-03-05 12:10:27 +01:00
Dmitry Vyukov
70a1ddb939 prog: harden program parsing against description changes more
Handle most of type changes, e.g. const is changed to struct,
or struct to pointers. In all these cases we create default args.
They may not give the coverage anymore, but still better than
losing them right away.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
bd5df8f49b prog: handle excessive args and fields during program parsing
Tolerate excessive args and fields during program parsing.
This is useful after description changes to not lose corpus.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
f027f1a3f7 sys/linux: use size attributes on structs
1. Add size attribte on sockaddr.
2. Remove sockaddr's that are larger than 16 bytes from sockaddr.
3. Add size attribute on sockaddr_storage which wasn't actually 128 bytes.
4. Add size attribute to ifreq.
5. Fix ifmap field types as uncovered by the size attributes.
6. Fix sockaddr_storage_tcp from struct to union which is should be.
7. Make sockaddr_un_file fixed size as it should be.
8. Fix some explicit paddings that were only correct for 64 bits.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
002cecf202 pkg/compiler: allow specifying static size for filename's
Sometimes filenames are embed into structs and need to take fixed space.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
5ef8dbdf5a pkg/compiler: support size attribute for unions 2018-03-05 12:10:27 +01:00
Dmitry Vyukov
a339951e5f pkg/compiler: add size attribute for structs
The size attribute allows to pad a struct up to the specified size.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
db01d57e91 sys/linux: a bunch of assorted improvements and fixes 2018-03-05 12:10:27 +01:00
Dmitry Vyukov
2c6f473e0f sys/linux: add remaining aux netfilter descriptions 2018-03-01 19:26:53 +01:00
Dmitry Vyukov
b370d4a70c sys/linux: few assorted additions 2018-02-26 20:37:42 +01:00
Dmitry Vyukov
6284466bc9 prog: properly squash bitfields 2018-02-26 18:21:51 +01:00
Dmitry Vyukov
b37b65b0e6 sys/linux: remove proc type from network descriptions
We now always create net namespace for testing,
so socket ports and other IDs do not overlap between
different test processes.
Proc types play badly with squashing packets to ANYBLOB.
To squash into a block we need concrete value, but it depends
on process id.
Removing proc also makes tun setup and address descriptions simpler.
2018-02-26 16:48:31 +01:00
Dmitry Vyukov
67f0e5ba11 sys/linux: make tcp_seq_num asymmetric
Currently it's 0x42424242 so it's not possible to understand
the value endianess in hints code.
Make it assymmetric so that endinaness is clear.
2018-02-26 15:58:19 +01:00
Dmitry Vyukov
9fe8aa42c5 prog: add arbitrary mutation of complex structs
Squash complex structs into flat byte array and mutate this array
with generic blob mutations. This allows to mutate what we currently
consider as paddings and add/remove paddings from structs, etc.
2018-02-25 18:22:02 +01:00
Dmitry Vyukov
2145057cb8 pkg/compiler: fix alignment corner case
Fix alignemnt calculation for packed structs with alignment and bitfields.
Amusingly this affected only a single real struct -- ipv6_fragment_ext_header.
2018-02-25 14:44:29 +01:00
Dmitry Vyukov
1f4ae3f413 pkg/compiler: don't assign call IDs statically
IDs change whenever a call is added or removed,
this leads to large diffs unnecessarly.
Assign IDs dynamically.
2018-02-25 14:31:40 +01:00
Dmitry Vyukov
44f66b4026 prog: return concrete arg types from Make functions
This removes a bunch of type assertions and makes code type safer.
2018-02-24 17:00:34 +01:00
Dmitry Vyukov
7a7c747c6f pkg/compiler: allow unions as syscall arguments
If all union options can be syscall arguments,
allow the union itself as syscall argument.
2018-02-23 13:50:02 +01:00
Dmitry Vyukov
e229ac7779 sys: fix descriptions for strickter return type checks
Mostly remove vma as return from some mm syscalls.
This is unnecessary and we never used these.
2018-02-23 13:42:41 +01:00
Dmitry Vyukov
3be86de046 sys/linux: prevent programs from doing arbitrary writes with ARCH_SET_FS 2018-02-23 11:55:37 +01:00
Dmitry Vyukov
8d8e249484 sys/linux: add AF_SMC sockets 2018-02-22 20:33:52 +01:00
Dmitry Vyukov
6153a72ee1 executor: bring up bond and veth devices 2018-02-22 20:16:37 +01:00
Dmitry Vyukov
907d649fc3 sys/linux: add few ip and tcp options 2018-02-22 20:14:36 +01:00
Dmitry Vyukov
c8e73b95c6 sys/linux: fix mmap call args
Also add a test for this.
2018-02-20 10:54:03 +01:00
Dmitry Vyukov
4b696a5daf sys/linux: minor fixes to bt descriptions 2018-02-19 21:48:20 +01:00
Dmitry Vyukov
a793204dd2 pkg/compiler: fix corner case in alignment calculation 2018-02-19 21:48:20 +01:00
Dmitry Vyukov
75a7c5e2d1 prog: rework address allocation
1. mmap all memory always, without explicit mmap calls in the program.
This makes lots of things much easier and removes lots of code.
Makes mmap not a special syscall and allows to fuzz without mmap enabled.

2. Change address assignment algorithm.
Current algorithm allocates unmapped addresses too frequently
and allows collisions between arguments of a single syscall.
The new algorithm analyzes actual allocations in the program
and places new arguments at unused locations.
2018-02-19 21:48:20 +01:00
Dmitry Vyukov
85d1218f41 prog: rework foreachArg
Make Foreach* callback accept the arg and a context struct
that can contain lots of aux info.
This (1) removes lots of unuser base/parent args,
(2) provides foundation for stopping recursion,
(3) allows to merge foreachSubargOffset.
2018-02-19 21:48:20 +01:00
Dmitry Vyukov
9df1a36a98 sys/linux: add bridge netfilter support 2018-02-17 19:02:12 +01:00
Dmitry Vyukov
32aa64c5ac sys/syz-extract: run make with -j 2018-02-17 19:02:12 +01:00
Dmitry Vyukov
dd4fcef5a2 pkg/compiler: allow len of var-len arrays
All netfilter subsystems use this unfortunately,
so demote this to a warning.
2018-02-17 19:02:12 +01:00
Dmitry Vyukov
d21a39fc48 sys/linux: fixes for network descriptions
1. Fix connlimit netfilter match version.
2. Fix xt_time_info layout.
3. Introduce mac_addr_mask type.
4. Limit vlan id's for better matches between them.
2018-02-17 19:02:12 +01:00
Dmitry Vyukov
478746a50e sys/linux: fix field names in netfilter 2018-02-10 13:22:05 +01:00
Dmitry Vyukov
033b610ec9 sys/linux: improve netfilter descriptions
Put the underflow entry at the end.
Entries must end on an unconditional, non-goto entry,
otherwise fallthrough from the last entry is invalid.

Add arp tables support.

Split unspec matches/targets to unspec and inet.

Reset ipv6 and arp tables in executor.

Fix number of counters in tables.

Plus a bunch of assorted fixes for matches/targets.
2018-02-09 20:14:33 +01:00
Julia Hansbrough
a1bc9d40ad syz/syz-extract: Update Fuchsia extractor with current Fuchsia paths.
A change in Zircon a while back moved around where sysroots are located
in Fuchsia; this update will allow for proper extraction.
2018-02-04 12:21:23 +01:00
Dmitry Vyukov
826b35d667 sys/linux: describe some new 4.16 features 2018-02-01 21:27:02 +01:00
Dmitry Vyukov
e86ddaca2e sys/syz-extract: save unsupported consts to the const files
We currently print unsupported consts to console during make extract.
But this is not very useful as there are too many output now.
This also does not allow to understand what's unsupported
in newly checked-in descriptions, or what's unsupported in all current
decriptions.

Save unsupported consts to the const files instead.
This solves all of the above problems.
2018-02-01 20:18:51 +01:00
Dmitry Vyukov
08146b1a84 sys/linux: extend netfilter descriptions 2018-01-27 17:08:43 +01:00
Dmitry Vyukov
e8b4970547 pkg/compiler: allow unions with only 1 field
Unions with only 1 field are not actually unions,
and can always be replaced with the option type.
However, they are still useful when there will be
more options in future but currently only 1 is described.
Alternatives are:
 - not using union (but then all existing programs will be
   broken when union is finally introduced)
 - adding a fake field (ugly and reduces fuzzer efficiency)

Allow unions with only 1 field.
2018-01-27 17:08:43 +01:00
Dmitry Vyukov
9a6ff11ff9 sys/linux: fix devname_mask alignment
Since we use int64, it has 8-byte alignment.
It's wrong, it must have 1-byte alignment.
Use int8 instead.
2018-01-24 11:41:13 +01:00
Dmitry Vyukov
ef6d3c0e03 sys/linux: add IPPROTO_L2TP to vnet protos 2018-01-24 11:38:45 +01:00
Dmitry Vyukov
ca9c302d80 pkg/compiler, prog: fix template parent lens
It's possible that a struct can have 2+ parents,
which is the same template (differs only by arguments).
See the new test case.
Support such case.
2018-01-24 11:35:22 +01:00
Dmitry Vyukov
3d76cc40d9 pkg/compiler: fix len of parent template struct
Consider the following example:

type len_templ1[DATA1, DATA2] {
	data	DATA1
	inner	len_temp2[DATA2]
}

type len_temp2[DATA] {
	data	DATA
	len	len[len_templ1, int8]
}

Here len refers to a parent struct, but the struct is a template,
so it's actual name is something like "len_templ1[int8, int16]".
Currently this does not work as compiler barks at incorrect
len target.

Make this work.
2018-01-23 11:38:53 +01:00
Dmitry Vyukov
40a6602675 sys/linux: add netfilter descriptions
Lots of TODOs and only ipv4, but some start.
2018-01-22 12:19:33 +01:00
Dmitry Vyukov
fbbdcd9228 sys/linux: add AF_VSOCK/vhost descriptions 2018-01-19 20:41:18 +01:00
Dmitry Vyukov
02dc66caa8 sys/linux: add AF_RDS descriptions 2018-01-19 18:06:43 +01:00
Dmitry Vyukov
161c1d640a sys/linux: resolve TODO re KCOV consts 2018-01-18 20:11:20 +01:00
Dmitry Vyukov
ff722179da sys/linux: make xattr prefix non-zero-terminated 2018-01-18 20:00:38 +01:00
Dmitry Vyukov
b7f99b54ae sys/linux: more selinux descriptions 2018-01-18 19:58:49 +01:00
Dmitry Vyukov
a84f016776 sys/linux: don't touch mknod$loop during sanitization
mknod$loop contains proc type as dev number.
Current sanitization code truncates 64-bit -1 to 32-bits
which later causes validation failure.
Don't do that, it's unnecessary for proc type.
2018-01-16 13:43:44 +01:00
Dmitry Vyukov
e17f4a5dfb sys/linux: generate GRE v0 packets even with incorrect payload 2018-01-15 20:26:04 +01:00
Dmitry Vyukov
47501d0f3b sys/linux: more NETLINK_ROUTE descriptions 2018-01-15 20:22:27 +01:00
Dmitry Vyukov
b75f5cb3cb sys/linux: add AF_PPPOX descriptions 2018-01-15 18:39:05 +01:00
Dmitry Vyukov
66d492a6c7 sys/linux: add vnet descriptions for GRE, MPLS, CAN 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
33bb46947a sys/linux: more AF_NETLINK/NETLINK_ROUTE descriptions 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
36e37bdf6c sys/linux: add broadcast/multicast mac addresses 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
c9e7aeaef6 sys/linux: add AF_CAN descriptions 2018-01-13 12:52:09 +01:00
Dmitry Vyukov
e9aebc0683 sys/linux: add AF_NETLINK/NETLINK_ROUTE support 2018-01-13 12:52:09 +01:00