Commit Graph

1008 Commits

Author SHA1 Message Date
Dmitry Vyukov
4b69c3cbac pkg/runtest: make tests pass on freebsd
The problem is stupid: <endian.h> should be included as <sys/endian.h> on freebsd.
Pass actual host OS to executor build as HOSTGOOS and use it to figure out
how we should include this header.
2019-03-07 20:37:43 +01:00
Mark Johnston
4fc2fa55ac sys/freebsd: avoid mangling syscall names
syz-extract was removing certain prefixes from syscall names, but this
caused some problems:
- freebsd* prefixes are for compatibility syscalls when the syscall ABI
  has changed.  For instance, we have both fstat() and
  freebsd11_fstat(), and it is desirable to fuzz them both.
- Stripping prefixes may leave us with undefined SYS_ constants.  This
  resulted in some test failures in pkg/csource, which emitted code
  referencing SYS_semctl when it should have been SYS___semctl.

Fix the problem by updating syscall descriptions to match the names
given by the FreeBSD kernel.  Add some new descriptions for
compatibility syscalls, fix the mknodat() description (dev_t is now 64
bits wide on FreeBSD), and remove mknod$loop, which appears to be
Linux-specific.
2019-03-07 19:46:55 +01:00
Julia Hansbrough
7ff74a9832 sys/fuchsia/fidlgen: update FIDL path & extract new descriptions
Garnet-layer FIDL descriptions are in a new subdirectory.

This CL changes it to the proper directory, and performed a "make
extract" shortly after.

This should fix some of the errors on the Syzkaller hub.
2019-02-21 11:17:00 +01:00
houjingyi
c4218108d7 sys/linux: add netlink seg6 descriptions
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
2019-02-21 09:37:22 +01:00
Dmitry Vyukov
22f84b5e56 sys/linux/test: use pipe2 instead of pipe
pipe does not exist on arm64.
2019-02-13 15:58:42 +01:00
Dmitry Vyukov
2502eeaa79 sys/linux/test: disable tipc test
It still crashes kernel, disable for now.
2019-02-13 15:58:42 +01:00
Dmitry Vyukov
f5827293e2 hafnium: add basic support
Add [very] basic support for testing Hafnium:
https://hafnium.googlesource.com/hafnium

Update #996
2019-02-12 18:34:25 +01:00
Dmitry Vyukov
6258c9f721 sys/linux: regenerate consts
Regenereate consts on latest linux-next.
2019-02-12 18:34:25 +01:00
Dan Robertson
13f1d0047a sys/linux: add NDISC packet formats to vnet.txt
Add the basic NDISC (RFC 4861) packet formats to sys/linux/vnet.txt.
2019-02-11 18:10:35 +01:00
Dmitry Vyukov
fa6c7b7080 sys/linux: prohibit opening /proc/self/exe
Fuzzer manages to open it and do bad things with it.
Prevent it from doing so.
2019-02-08 16:30:44 +01:00
Dmitry Vyukov
8c1621bede sys/linux: prohibit EXT4_IOC_RESIZE_FS
When we run with sandbox=none, test program can do EXT4_IOC_RESIZE_FS which
shrinks rootfs basically to 0. This breaks the machine as all tests then fail with:

failed to create temp dir: mkdir syzkaller-testdir077269498: no space left on device

This is the most common source of "lost connection" crashes overall and
they are not actually kernel bugs.

Prohibit EXT4_IOC_RESIZE_FS for now.
Alternatively we can mount tmpfs with sandbox=none.

Update #971
2019-02-08 09:29:15 +01:00
Dmitry Vyukov
aa4feb0329 sys/linux: extend key descriptions 2019-02-07 09:39:35 +01:00
Dmitry Vyukov
cd7a3c250f sys/linux: move {i,fa}notify into own files 2019-02-07 09:39:35 +01:00
Marco Vanotti
d25487bc2e sys/fuchsia: fix fidlgen issues
* sys/fuchsia: fix fidlgen issues.

This change modifies fidlgen removing fuchsia.mediacodec and renaming
zircon-ethernet to fuchsia-hardware-ethernet.

fuchsia.mediacodec has most of its functionality merged into
fuchsia.media and it's not included in the default amd64 builds.

zircon-ethernet has been renamed to fuchsia-hardware-ethernet
recently:

https://fuchsia-review.googlesource.com/c/zircon/+/237178

* docs/fuchsia: Add troubleshooting sections

This commit adds a troubleshooting section in the fuchsia syzkaller docs
that mentions how to solve fidlgen issues when fidl interfaces are
removed or renamed.

* sys/fuchsia: remove stale autogenerated files.

* sys/fucsia run make extract && make generate.
2019-02-06 13:33:35 +01:00
Anton Lindqvist
c198d5ddeb sys/openbsd: add missing wscons descriptions (#976) 2019-02-01 22:01:09 -08:00
Andrey Konovalov
9f528bbcc8 sys/linux: rename dev descriptions files
Prefix file names of descriptions of /dev/* files with dev_.
And give some of them more appropriate names.
2019-02-01 14:40:17 +01:00
Dmitry Vyukov
25e10a0434 executor: remove ability to detect kernel bugs
This ability was never used but we maintain a bunch of code for it.
syzkaller also recently learned to spoof this error code
with some ptrace magic (probably intercepted control flow again
and exploited executor binary).
Drop all of it.
2019-01-31 11:35:53 +01:00
Dmitry Vyukov
724adc5445 sys/test/test: add tests for test exiting in the middle of execution 2019-01-31 11:35:53 +01:00
Dmitry Vyukov
31fc335d7c sys/linux/test: fix constraints in ipc test 2019-01-31 11:35:53 +01:00
Dmitry Vyukov
8e579f27d6 prog: fix escaping of C strings
C's \xHH hex constants in strings accept any number of hex digits
(not just 2 or 4). So later non-hex escaped chars glue to the \x construct.
Use \OOO instead as it accepts at most 3 octal digits.
2019-01-31 11:35:53 +01:00
Andrey Konovalov
aa432daf55 sys: use -march=armv6 instead of -march=armv6t2
The latter doesn't work on Raspberry Pi Zero.
2019-01-28 16:49:49 +01:00
Anton Lindqvist
c73f090a5c sys/openbsd: add wscons descriptions, limited to wsdisplay for now 2019-01-26 09:31:18 +01:00
Anton Lindqvist
fc1f188563 sys/openbsd: add openat$tty 2019-01-26 09:31:18 +01:00
Anton Lindqvist
3d7ad96eb0 sys/openbsd: add openat${null,zero} 2019-01-26 09:31:18 +01:00
Siddharth M
ebf7a37c5b pkg/build: add basic support for NetBSD
* Add pkg/build support for NetBSD

* Fix length of characters
2019-01-25 18:16:51 +01:00
Dmitry Vyukov
a3d9f7e34d sys/linux: fix up mptcp descriptions
1. Generate .const files for all arches.
2. Don't extract mptcp consts on android.
3. Remove mptcp includes from vnet.txt.
4. Enable CONFIG_MPTCP in syz-extract (mptcp is not like all other kernel headers).
2019-01-25 16:10:00 +01:00
8litz
6fde58c61b sys/linux: add Multipath TCP description
https://tools.ietf.org/html/rfc6824
2019-01-25 15:42:43 +01:00
Dmitry Vyukov
7be43858a2 sys/linux: add trusty hwrng service
Update #933
2019-01-24 16:49:40 +01:00
Dmitry Vyukov
f586e158c4 sys/linux: add trusty hwkey service
Update #933
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
5db97d84e9 sys/linux: describe trusty storage service interface
Update #933
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
91c9476c39 sys/linux: fix a TODO
We can actually express such size with:
define X25_SUBSCRIP_DEVICE_SIZE	200 - sizeof(long)
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
b874f62f15 sys/linux: regenerate const files
(on linux-next)
2019-01-24 16:49:38 +01:00
Dmitry Vyukov
f87fe5d949 sys/syz-extract: don't use warning flags
CrossCFlags now contains some warning-related flags like -Wall.
Some of these break kernel build, don't add any warning-related flags.
2019-01-24 16:49:38 +01:00
Dmitry Vyukov
de746e8232 sys/linux: update TODO comments
Change TODO comments that refer to missing description
language features to NEED comments as that it's easier to grep for them.
Remove some outdated comments. Fix 2 easy fixable TODOs.
2019-01-24 16:49:38 +01:00
Siddharth M
f4e42cabb7 sys/targets: support netbsd cross compilation on linux
* Support cross compilation on linux

* typo fix

* fixed indentation

* Add a trailing '/' after SOURCEDIR
2019-01-24 11:27:36 +01:00
Anton Lindqvist
985f75cc50 sys/openbsd: remove mincore(2) description
It was recently removed from OpenBSD[1].

[1] https://marc.info/?l=openbsd-cvs&m=154723400730318&w=2
2019-01-22 09:21:03 +01:00
Dmitry Vyukov
353f32eacf sys/targets: fix shadowed flag variable
env CGO_ENABLED=1 GOMAXPROCS=1 GOGC=50 gometalinter.v2 ./...
sys/targets/targets.go:428:⚠️ declaration of "flag" shadows declaration at sys/targets/targets.go:423 (vetshadow)
2019-01-19 20:06:45 +01:00
Anton Lindqvist
141c212ca6 sys/openbsd: avoid /dev/fd node creation
Prevent nodes that maps to an already open kcov fd from being created since
they can corrupt the coverage buffer.

Partial revert of commit 04aed72692 with some
tweaks and testing.
2019-01-19 19:22:37 +01:00
Dmitry Vyukov
e935237c9c Makefile: enable -Wunused-const-variable
See discussion in PR #942.
Extend support for optional flags in sys/targets
as this flag is not supported by gcc 5.
Make flags consistent across Makefile and pkg/csource.
2019-01-19 19:20:39 +01:00
Joey Jiao
8aa587b0a1 sys/syz-extract: add -includedirs option
Kernel modules are in different directories in some cases,
so to include the headers in the module dir or other directories
the includedirs flag is added.
ex: -includedirs path1/include,path2/include
2019-01-19 12:30:10 +01:00
Andrey Konovalov
2cd76d2137 kcov: some fixes for extra coverage
Use PC tracing mode when detecting KCOV_REMOTE_ENABLE support in the kernel.

Also fix kcov_remote_handle_usb argument.
2019-01-17 16:06:59 +01:00
Anton Lindqvist
04aed72692 Revert "sys/openbsd: avoid /dev/fd node creation"
This reverts commit 77c702cf1a.

A proper fix has instead been committed to OpenBSD[1].

[1] 650b9bc3ab
2019-01-17 10:41:04 +01:00
Andrey Konovalov
c2faf9b2d5 all: detect extra coverage support
Based on whether the kernel supports KCOV_REMOTE_ENABLE ioctl.
2019-01-16 19:19:53 +01:00
msvoelker
c0d4a12ee7 sys/freebsd: add SCTP syscalls
* sys/freebsd: Add SCTP syscalls

* sys/freebsd: SCTP syscalls updated

* sys/freebsd: SCTP syscalls fixed
2019-01-16 18:12:07 +01:00
Dmitry Vyukov
e9b3467100 sys/linux: add trusty support
Add support for trusty tipc devices and several trusty app ports.

Update #933
2019-01-14 18:23:43 +01:00
Zubin Mithra
b38a805a0c sys/linux: Add syscalls to read from sockets for crypto operations
sockaddr_alg with salg_type as "skcipher", "aead", "hash" and "rng"
support for reading from these sockets. Add read descriptions to
socket_alg.txt.
2019-01-14 18:21:55 +01:00
Greg Steuck
77c702cf1a sys/openbsd: avoid /dev/fd node creation
Prevents corpus explosion with corrupted coverage data.

The two parallel runs of:
`doas ./syz-execprog -cover -coverfile /tmp/{fixed,unfixed} r.syz`
show markedly different coverage pictures:

unfixed:
```
2019/01/12 13:55:38 parsed 1 programs
2019/01/12 13:55:38 executed programs: 0
2019/01/12 13:55:38 call #0: signal 821, coverage 2438
2019/01/12 13:55:38 call #1: signal 243, coverage 1363
2019/01/12 13:55:38 call #2: signal 502, coverage 1993
2019/01/12 13:55:38 call #3: signal 15, coverage 44
2019/01/12 13:55:38 call #4: signal 335, coverage 8196
```

fixed:
```
2019/01/12 13:51:57 parsed 1 programs
2019/01/12 13:51:57 executed programs: 0
2019/01/12 13:51:57 call #0: signal 837, coverage 2491
2019/01/12 13:51:57 call #1: signal 241, coverage 1341
2019/01/12 13:51:57 call #2: signal 27, coverage 61
2019/01/12 13:51:57 call #3: signal 13, coverage 44
2019/01/12 13:51:57 call #4: signal 39, coverage 299
```

The contents of `r.syz` is
```
mknod(&(0x7f0000000180)='./file0\x00', 0x2006, 0x10000016e8)
r0 = open(&(0x7f0000000100)='./file0\x00', 0x0, 0x0)
mmap(&(0x7f0000000000/0x3000)=nil, 0x3000, 0x2, 0x10, r0, 0x0, 0x0)
writev(0xffffffffffffffff, &(0x7f0000002480)=[{&(0x7f0000001480)="<junk>", 0x573}], 0x1)
lstat(&(0x7f0000000240)='./file0\x00', &(0x7f0000000000))
```

So, it's the final lstat which was getting that extra coverage.  In
particular, the end of unfixed.4 has some 4734 values
0xffffffff00000000.
2019-01-14 09:48:45 +01:00
Shankara Pailoor
db9b657915 tools/syz-trace2syz/proggen/proggen_test.go: test ipv6 address conversion 2019-01-10 12:34:28 +01:00
Shankara Pailoor
0108829095 sys/linux: add rand_addr option to ipv6_addr union
rand_addr option is the first option for the ipv6_addr union
and is just an array of 16 bytes. This option makes it easy
for trace2syz to convert ipv6 address as strace decodes
the ipv6 address as a hex string.
2019-01-10 12:34:28 +01:00
Andrey Konovalov
204b8f5906 sys/linux: chmod -x *.txt
For some reason some syscall description txt files are +x. Do chmod -x.
2019-01-09 05:46:47 +01:00
Dmitry Vyukov
ee332608e9 sys/linux: prohibit SNAPSHOT_FREEZE
SNAPSHOT_FREEZE freezes all processes and leaves the machine dead.
2019-01-06 17:39:32 +01:00
Dmitry Vyukov
6838bb9a0f sys/linux: add /dev/ppp descriptions 2019-01-04 15:56:18 +01:00
Eric Biggers
f064b4365d sys/linux/init_alg.go: update algorithms
- Add arm64 implementations of various algorithms
  (these are usually named -arm64, -neon, or -ce)
- Add missing x86 SHA-NI algorithms (sha*-ni)
- Add adiantum    (new in v4.20)
- Add streebog256 (new in v4.20)
- Add streebog512 (new in v4.20)
- Add vmac64      (new in v4.19)
- Add xchacha12   (new in v4.20)
- Add xchacha20   (new in v4.20)
- Remove speck128 (was removed soon after being added to kernel)
- Remove speck64  (likewise)
- Move sm4 from hash list to cipher list
2019-01-02 11:24:46 +01:00
Eric Biggers
b86667864d sys/linux/init_alg.go: sort the algorithm names
Sort the lists of crypto algorithms lexicographically to make it easier
to see which algorithms are included and decide where to add new ones.
2019-01-02 11:24:46 +01:00
Michael Tuexen
97e0a43fa2 sys/tagets: use appropriate name for KernelObject on FreeBSD 2018-12-31 17:39:24 +01:00
Dmitry Vyukov
2b42fdc898 sys/linux: detail ifla_vf_policy/ifla_port_policy/ifla_xdp_policy 2018-12-30 17:36:38 +01:00
Dmitry Vyukov
f7d5ee2d34 sys/linux: add can routes 2018-12-30 16:24:31 +01:00
Dmitry Vyukov
5b565c8bdb sys/linux: add AF_RXRPC descriptions 2018-12-30 15:49:07 +01:00
Dmitry Vyukov
9942de5fb0 sys/linux: add /dev/mISDNtimer 2018-12-30 12:25:05 +01:00
Dmitry Vyukov
6e86ffb020 sys/linux: open more of /dev/ files
/dev/vfio/vfio
/dev/btrfs-control
/dev/ubi_ctrl
/dev/cachefiles
2018-12-30 12:19:52 +01:00
Dmitry Vyukov
204cb1446f sys/linux: add AF_ISDN descriptions 2018-12-29 20:40:32 +01:00
Dmitry Vyukov
f02201ce9a sys/linux: describe /dev/vhci interface 2018-12-29 19:22:35 +01:00
Dmitry Vyukov
79059de177 sys/linux: misc assorted improvements
Add new bpf consts/commands.
Refine bluetooth descriptions.
Remove removed crypto consts.
2018-12-29 19:22:35 +01:00
Dmitry Vyukov
a40793d7a5 sys/linux: refine few types in NETLINK_ROUTE 2018-12-29 07:45:20 +01:00
Dmitry Vyukov
2b084c9886 pkg/csource: use 0 for missing syscall args
We don't specify trailing unused args for some syscalls
(e.g. ioctl that does not use its arg).
Executor always filled tailing unsed args with 0's
but pkg/csource didn't. Some such syscalls actually
check that the unsed arg is 0 and as the result failed with C repro.

We could statically check and eliminate all such cases,
but it turns out the warning fires in 1500+ cases:
a3ace5a63f/gistfile1.txt

So instead fill such args with 0's in pkg/csource too.
2018-12-27 13:11:57 +01:00
Dmitry Vyukov
586a19e7ec executor: create more net devices on linux 2018-12-26 21:44:05 +01:00
Dmitry Vyukov
4f7962a7bb executor: restrict ipc resource usage
For context see:
https://groups.google.com/d/msg/syzkaller-bugs/ZaBzAJbn6i8/Py9FVlAqDQAJ
2018-12-26 10:29:43 +01:00
Dmitry Vyukov
8a41a0ad8e sys/linux: add network drop monitor support 2018-12-24 18:56:08 +01:00
Dmitry Vyukov
17c23ac162 sys/linux: add udmabuf descriptions 2018-12-24 18:56:08 +01:00
Dmitry Vyukov
a961943f02 sys/linux: add basic AF_CAIF descriptions 2018-12-24 18:56:07 +01:00
Dmitry Vyukov
57541e29d9 sys/linux: add basic X25 descriptions 2018-12-24 18:56:06 +01:00
Dmitry Vyukov
dd61e58d94 sys/linux: extend AX25/ROSE/NETROM descriptions 2018-12-24 18:56:06 +01:00
Dmitry Vyukov
9a4bb6b0b5 sys/linux: add CRYPTO_MSG_GETSTAT 2018-12-22 09:39:03 +01:00
Dmitry Vyukov
3e3b15df7e sys/linux: add RTM_NEWNSID/RTM_GETNSID 2018-12-22 09:39:02 +01:00
Victor Hsieh
f4815544c1 sys/linux: add fs-verity ioctls
This adds 2 ioctls and an argument type:
 - FS_IOC_ENABLE_VERITY
 - FS_IOC_MEASURE_VERITY
 - struct fsverity_digest

Note fs-verity on-disk structs are not yet added.
2018-12-18 10:34:52 +01:00
Dmitry Vyukov
def91db3fe prog, pkg/csource: more readable serialization for strings
Always serialize strings in readable format (non-hex).
Serialize binary data in readable format in more cases.

Fixes #792
2018-12-15 15:17:13 +01:00
Dmitry Vyukov
02613a4124 sys/linux: add basic tipc test 2018-12-12 13:14:26 +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
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
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
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
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
Michael Tuexen
60562a1d09 sys/freebsd: use a better description of msg_flags fields
As suggested by Dmitry us a better description of the msg_flags
field, which is only used to provide information from the
kernel to the application for recvmsg() calls. This means that
the value provided is basically ignored.
2018-12-08 11:33:41 +01:00
Michael Tuexen
6f379080a9 sys/freebsd: Improve socket related tests for FreeBSD. 2018-12-08 11:33:41 +01:00
Anton Lindqvist
f1c702a86e sys/targets: some syscalls on OpenBSD does need defines
Some syscalls on OpenBSD violates the ordinary SYS_ prefix convention. This is
an exhaustive enumeration of the deviations.

Regression introduced in commit 88746fdf ("pkg/csource: use defines from
sys/syscall.h on *bsd").
2018-12-07 09:45:14 +01:00
Anton Lindqvist
8bff832f48 sys/openbsd: correct semctl syscall number 2018-12-07 09:45:14 +01:00
Michael Tüxen
c64cb0567e sys/freebsd: remove linux specific include files for ICMP 2018-12-05 10:51:02 +00:00
Michael Tüxen
ac6c05788b sys/freebsd: improve TCP tests
* sys/freebsd: improve TCP tests

Add missing TCP socket options for FreeBSD.

* sys/freebsd: improve TCP tests

Add socket option description for TCP_FASTOPEN.
2018-12-05 06:57:20 +00:00
Michael Tuexen
f162ad97ac sys/freebsd: improve udp tests
Add support for the UDP_ENCAP. Add required includes and
remove the Linux specific ones.
2018-12-04 14:15:42 +00:00
Michael Tüxen
6ad0ae6171 sys: remove socketpair for AF_INET and AF_INET6
* OpebBSD: remove socketpair() for AF_INET and AF_INET6.

socketpair() is only supported on AF_UNIX.

* NetBSD: remove socketpair() for AF_INET and AF_INET6.

socketpair() is only supported for AF_UNIX.

* FreeBSD: remove socketpair() for AF_INET and AF_INET6.

socketpair() only supports AF_UNIX.

* Linux: remove socketpair for AF_INET and AF_INET6.

socketpair only supports AF_UNIX.

* Autogenerated files.

These are manually generated for all platforms you are not
running on. FreeBSD in this case.

* executor: rebase.

* sys/freebsd: rebase.

* sys/linux: use AF_UNIX based socketpair for nbd.

This was suggested by Dmitry.

Fixes #845
2018-12-04 08:58:22 +00:00
Michael Tüxen
03f94a4556 sys/freebsd: add UDP-Lite descriptions 2018-12-03 13:52:09 +00:00
Dmitry Vyukov
31677db602 sys/targets: use g++ as preprocessor on freebsd
As per:
https://github.com/google/syzkaller/pull/844#issuecomment-443509014
2018-12-03 10:02:43 +01:00
Greg Steuck
88746fdf89 pkg/csource: use defines from sys/syscall.h on *bsd
Fixes #841
2018-12-02 13:18:07 +00:00
Michael Tüxen
5a58167323 executor: add support for tap interfaces on FreeBSD 2018-12-01 10:22:39 +00:00
Shankara Pailoor
bc6b598a2d removing trace2syz constants and moving rand_addr as the first ipv4_addr option 2018-11-30 15:24:55 +00:00
Michael Tüxen
115a1379eb FreeBSD: Fix make extract
* FreeBSD: Fix make extract.

A header was missing...

* FreeBSD: Fix make extract

Changes in generated files.
2018-11-30 15:13:30 +00:00
Marco Vanotti
66071e276f sys/fuchsia: fix task syscalls.
This commit fixes two issues related to the task syscalls.

The zx_task_resume syscall has been recently removed from zircon[0]. It
has been deprecated for some time already. This commit removes the
syscall.

The `ZX_EXCEPTION_PORT_UNBIND_QUIETLY` option for the syscall
`zx_task_bind_exception_port` has been removed recently as well[1]. This
commit removes that option from tasks.txt.

To test this change, I followed the procedure for building syzkaller for
fuchsia:

```shell
$ make extract TARGETOS=fuchsia SOURCEDIR=${FUCHSIADIR}
$ make generate
$ make TARGETOS=fuchsia TARGETARCH=amd64 SOURCEDIR=${FUCHSIADIR}
```

I excluded the changes from make extract. This commit only has the
generated files from make generate.

[0]: https://fuchsia-review.googlesource.com/c/zircon/+/228712
[1]: https://fuchsia-review.googlesource.com/c/zircon/+/228658
2018-11-29 21:27:15 +00:00
Shankara Pailoor
3d3ec9072b reordering unions for trace2syz 2018-11-25 08:18:59 +01:00
Shankara Pailoor
ecc7c87091 removing trace2syz constants 2018-11-24 08:08:32 +01:00
Marco Vanotti
d260249e70 sys/fuchsia: update VMAR syscalls
* sys/fuchsia: update vmar syscalls.

In a previous zircon commit[0], the vmar related syscalls (like
`zx_vmar_map`, `zx_vmar_protect` and `zx_vmar_allocate`) changed the
order of their parameters, making putting the flags parameter as the
second parameter, and renaming it to "options".

This commit modifies vmars.txt so that it reflects the latest state of
the syscalls in zircon. I also modified the usage in
`executor/common_fuchsia.h`

I ran make extract, make generate and compiled syzkaller to test this
change.

[0]: https://fuchsia-review.googlesource.com/c/zircon/+/168060

* sys/fuchsia run make generate

This commit is just the result of running make generate after its
parent. This regenerates the definitions for the modified VMAR syscalls.
2018-11-21 05:56:43 +01:00
Marco Vanotti
5d9a39247f sys/fuchsia: update fidl mappings.
This commit is just a run of make extract + make generate with an up to
date fuchsia tree. This commit only updates the fidl definitions, there
are some other syscalls that had changed and need to be manually updated
(that will come in a future commit).
2018-11-21 05:40:21 +01:00
Marco Vanotti
37a6ea34f1 pkg/compiler: add error handler in CollectUnused
* pkg/compiler: Add error handler in `CollectUnused`.

This commit adds an error handler for the `CollectUnused` function. The
error handler just panics on any error, but is useful for debugging.

The error handler is used any time `comp` finds an error, and if it's
missing, it will panic due to a `nil` pointer dereference. At least now
we get a better understanding of the errors.

The only user of `CollectUnused` is `sys/fuchsia/fidlgen`, which is
failing now and will be fixed in a future commit.

The output message looks like this:
```
panic: could not collect unused nodes. fidl_net-stack.txt:110:15:
unknown type zx_chan_zircon_ethernet_Device_client
```

* pkg/compiler Better error handling in CollectUnused

This commit changes the default error handler for compiler to
`ast.LoggingHandler`, meaning that if `nil` is passed as an error
handler, `LoggingHandler` will be used instead.

`CollectUnused` now returns an error if any of the subfunctions produce errors.

`fidlgen` is the only caller of `CollectUnused`, and now checks for errors
as well.

* pkg/compiler Add tests for CollectUnused

This commit adds basic tests for the CollectUnused function. There's one
test that checks that it returns the right nodes, and another one that
makes sure that it returns errors when needed.

To make the test clearer, I had to add the error handler as an explicit
parameter in `CollectUnunsed`, instead of using the default one. This
avoid printing garbage in the logs. The `TestCollectUnusedError` function
uses a nopErrorHandler to avoid printing anything.

* pkg/compiler fix presubmit warnings
2018-11-21 02:37:06 +01:00
Marco Vanotti
cb04e409f8 sys/fuchsia: add zircon-ethernet to fidlgen libs
This commits adds "zircon-ethernet" to the list of fidl libraries that
fidlgen would look at. This is required because recently, a change in
fuchsia[0] added a new method to the netstack interface, that allows for
adding an EthernetInterface. One of the parameters is a
zircon.ethernet.Device, so we need to import that type for fidlgen to be
able to understand fidl_net-stack.txt.

I tested this by running:

```shell
$ make extract TARGETOS=fuchsia SOURCEDIR=${FUCHSIADIR}
$ make generate
```

[0]: https://fuchsia-review.googlesource.com/c/zircon/+/220580
2018-11-21 02:33:21 +01:00
Dmitry Vyukov
99721ceaab sys/linux: update test for changed arch_prctl descriptions 2018-11-19 20:26:19 -08:00
Anton Lindqvist
3659cea21d sys: conditionally add padding argument in MakePosixMmap()
Some targets (NetBSD and OpenBSD) have a mmap() padding argument between the
file descriptor and offset. Make sure to omit such argument in MakePosixMmap().
Otherwise, reproduce programs will crash at runtime since the expected mapping
at 0x20000000 is not established.
2018-11-17 15:50:18 -08:00
Dmitry Vyukov
e17edc6cc4 sys/linux: refine tcp_zerocopy_receive
Use the new vma64 now that we have it.
2018-11-17 15:46:38 -08:00
Dmitry Vyukov
15d00718f7 sys/linux: refine description for PR_SET_MM 2018-11-17 15:46:37 -08:00
Dmitry Vyukov
993f4bbae0 sys/linux: modernize arch_prctl descriptions 2018-11-17 15:46:37 -08:00
Dmitry Vyukov
1d44216fcf sys/linux: modernize prctl descriptions
Use one syscall per command, refine arguments, etc.
2018-11-17 15:46:37 -08:00
Dmitry Vyukov
69f24bcad6 sys/linux: move prctl to a separate file 2018-11-17 15:46:36 -08:00
Dmitry Vyukov
93ec27acb5 sys/linux: refine tcp repair descriptions 2018-11-17 15:46:36 -08:00
Greg Steuck
538a105600 executor: OpenBSD network package injection
Squash of:

* Doc typo

* Ported some tun related functions.

* Copy vnet.txt from linux to openbsd.

* Simplified syz_emit_ethernet and stubbed out vnet.txt.

* Undo clang-format header sorting: headers are order sensitive.

* Uniquify tap devices by pid.

* clang-format off for includes

* Happier clang-format.

* Partially revert "Uniquify tap devices by pid."

Just rely on procid magic instead of getting it from a flag.
2018-11-17 15:42:37 -08:00
Dmitry Vyukov
d1a8851085 sys/targest: introduce target.BuildOS
We can't cross-compile native binaries from just any OS to any other.
For most OSes we can do only native compilation.
Some can only be compiled from linux.
To date we avoided this problem completely (mostly assumed linux build OS).
Make this notion of what can build what explicit.
2018-11-17 11:42:22 -08:00
Dmitry Vyukov
7d395878aa sys/targets: fix build 2018-11-17 10:35:11 -08:00
Anton Lindqvist
1508cc9c44 pkg/csource: add support for creating reproducers on OpenBSD 2018-11-17 10:32:19 -08:00
Shankara Pailoor
4fc13fd6ae 1) making bpf_insn varlen, 2) changing bpf_generic to match the struct definition in linux to make trace2syz generation simpler 2018-11-12 12:41:37 -08:00
Dmitry Vyukov
f3c4e61859 sys/linux: add vimc/vivid/vim2m/vicodec/swradio/radio/vbi/cec devices
Create planar and non-planar vivid devices.
Create each for each test process.
Add swradio/radio/vbi/cec media devices.
2018-11-10 10:38:39 -08:00
Dmitry Vyukov
34c048c0d8 sys/linux: add /dev/dlm* devices 2018-11-10 10:38:38 -08:00
Dmitry Vyukov
4d2f7ff6a5 sys/linux: regenerate on latest kernel 2018-11-10 10:38:37 -08:00
Dmitry Vyukov
89a1588519 sys: disable trusty for now
It crashes pkg/csource tests because
it does not have syz_mmap syscall but tries to use it.
2018-11-08 20:14:05 -08:00
Dmitry Vyukov
0d872150de sys: initial trusty support
Trusty is a set of software components supporting
a Trusted Execution Environment (TEE) on mobile devices.

https://source.android.com/security/trusty

Add syscall descriptions and some boilerplate.
2018-11-07 17:52:06 -08:00
Dmitry Vyukov
4ccf7bb438 sys/linux: limit init_module size argument
Kernel tries to vmalloc whatever we pass as size and it's not accounted against memcg.
As the result it can lead to massive OOM kills of everything running on the machine.
Strictly saying, the same applies to finit_module with a sparse file too,
but there is no simple way to handle that.
2018-10-30 17:42:18 +01:00
shankarapailoor
06a012d997 sys/linux: adding constants for trace2syz to sockets 2018-10-30 17:18:39 +01:00
shankarapailoor
72add0ff6f sys/linux: add perf, kvm, btrfs consts for trace2syz 2018-10-30 14:04:49 +01:00
Shankara Pailoor
8dbb755a2e sys/linux: add additional constants for trace2syz to bpf
Fixes #783
2018-10-30 11:31:42 +01:00
Dmitry Vyukov
12b38f22c1 sys/linux: fix up descriptions
1. Extract consts on the latest linux tree.
2. Don't manually define O_TMPFILE/O_ACCMODE/_LINUX_CAPABILITY_VERSION_N,
   they are defined in kernel headers.
3. Don't use CLOCK_SGI_CYCLE as clock id, it's not implemented.
2018-10-30 11:15:50 +01:00
shankarapailoor
362ef76397 sys/linux: add additional constants for trace2syz 2018-10-30 10:58:45 +01:00
Greg Steuck
2f1090dacd sys/openbsd: added minherit, extended/simplified mmap
* sys/openbsd: added minherit, extended/simplified mmap.

Added a script from anton_at_openbsd.org for regenerating syscalls.

Generated by ksh ./sys/openbsd/extract-openbsd.sh

* Undo whitespace change not passing on CI

* No need for magic script.
2018-10-29 18:59:16 +01:00
Dmitry Vyukov
fe65cc88ce sys/linux: fix SIOCGIFCONF const 2018-10-29 15:06:53 +01:00
Dmitry Vyukov
b36409b288 sys/linux: fix IP6T_SO_GET_INFO const
Fix copy-paste error.
2018-10-29 14:57:43 +01:00
Dmitry Vyukov
9ca2afa12c sys/linux: open /dev/media* files
Also remove the second syscall for opening of /dev/fd*.
2018-10-28 20:35:35 +01:00
Dmitry Vyukov
f00934a9ac sys/linux: add "ofb" crypto-something 2018-10-28 19:49:54 +01:00
Dmitry Vyukov
6ce28678e4 sys/linux: slightly refine perf descriptions
CPU argument can be -1.
It makes sense to mmap perf fd.
2018-10-28 19:22:46 +01:00
Dmitry Vyukov
6e045ca26d sys/syz-extract: support missing arch headers
The latest Linux kernel misses some arch-specific headers on some archs:
	asm/a.out.h
	asm/prctl.h
	asm/mce.h
Support that.
2018-10-28 19:10:11 +01:00
Denis Efremov
e6806d0f73 sys/linux: floppy interface description
For floppy fuzzing you need to enable:

1) CONFIG_BLK_DEV_FD in your kernel configuration
2) "cmdline": " -fda FLOPPY.img " in syzkaller configuration

Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Alexander Popov <alex.popov@linux.com>
2018-10-28 19:04:12 +01:00
Dmitry Vyukov
ecb386fe6f sys: check that target consts are defined
Currently when we get target consts with target.ConstMap["name"]
during target initialization, we just get 0 for missing consts.
This is error-prone as we can mis-type a const, or a const may
be undefined only on some archs (as we have common unix code
shared between several OSes).
Check that all the consts are actually defined.
The check detects several violations, to fix them:
1. move mremap to linux as it's only defined on linux
2. move S_IFMT to openbsd, as it's only defined and used on openbsd
3. define missing MAP_ANONYMOUS for freebsd and netbsd
4. fix extract for netbsd
2018-10-19 19:11:22 +01:00
Dmitry Vyukov
6ce17935cb sys/linux: prohibit FAN_OPEN_PERM and FAN_ACCESS_PERM
FAN_OPEN_PERM and FAN_ACCESS_PERM require the program to reply to open requests.
If that does not happen, the program will hang in an unkillable state forever.
See the following bug for details:
https://groups.google.com/d/msg/syzkaller-bugs/pD-vbqJu6U0/kGH30p3lBgAJ
2018-10-15 18:53:00 +02:00
Julia Hansbrough
5b11ac2c91 Update fidlgen to keep current with upstream.
The Syzkaller IR upstream has been updated, so we can properly update
consts/fidl descriptions now.
2018-10-10 12:00:14 +02:00
Zach Riggle
f37861df63 targets: Use OS=linux when GOOS=android
This avoids the issue of "android" not having any registered configurations
or syscalls / ioctls / etc, when built with GOOS=android.

This occurs when building in Google3, since --config=android_arm64 selects
the Android toolchain.
2018-10-10 11:54:53 +02:00
Julia Hansbrough
0f3e026191 Include generate_fidl as part of the extract step.
Anytime we're running `make extract/generate` with Fuchsia as a target, we
probably want to update FIDL descriptions too, so we don't fall behind
what upstream is up to.

This includes generate_fidl as part of the `make extract` workflow.

Also, corrects fidlgenPath to properly find the path for ARM targets (we
only have host_x64 right now).
2018-10-02 20:47:12 +02:00
Julia Hansbrough
d7101e2c60 Fix executor build for Fuchsia on ARM, too.
Whups, pissed this in pull request #746.

As before, location of sysroot includes changed, so Fuchsia
cross-compile flags need an update.
2018-10-01 09:57:57 +02:00
Julia Hansbrough
8bb1f0fce1 Fix executor build for Fuchsia.
Location of some sysroot includes changed; ergo, Fuchsia cross-compile
flags need an update.
2018-09-28 11:15:49 +02:00
Dmitry Vyukov
58fca249ef sys/linux: add encrypted key instantiation payloads 2018-09-26 15:37:33 +02:00
Dmitry Vyukov
881bc4f956 sys/linux: add IMA mount options 2018-09-26 13:50:35 +02:00
Dmitry Vyukov
134f5f14f4 sys/linux: add ima/evm/capability xattrs 2018-09-25 19:56:45 +02:00
Dmitry Vyukov
30f618d19d sys/linux: add security mount options 2018-09-25 18:47:08 +02:00
Dmitry Vyukov
90fc4b7a89 sys/linux: add erofs descriptions 2018-09-25 17:20:32 +02:00
Dmitry Vyukov
28d9ac763d sys/linux: add lsm attrs and xattrs
Add descriptions for /proc/self/attr/* and known lsm file xattrs.
2018-09-23 20:30:20 +02:00
Tobias Klauser
9ba5d84192 sys/linux: fix RTA_EXPIRES in rtm_ipv6_policy 2018-09-20 16:07:15 +02:00
Dmitry Vyukov
02d481205b Makefile: format openbsd syscall descriptions 2018-09-20 11:21:51 +02:00
Tobias Klauser
7f7e03fda2 sys/linux: add MFD_HUGETLB 2018-09-19 13:43:38 +02:00
Tobias Klauser
fe944bbcd7 sys/linux: add MCL_ONFAULT 2018-09-19 13:21:09 +02:00
Dmitry Vyukov
2c2e5f7129 sys/targets: use native compiler for test OS
We used to use gcc for test OS, but this is linux-specific.
Other OSes may use c++ or clang as main compiler, so use whatever
is the default for the host OS.

Update #712
2018-09-17 10:53:29 +02:00
Dokyung Song
a343a4003c sys/fuchsia: add description for fuchsia.net, .net-stack, .ldsvc services 2018-09-14 12:03:48 +02:00
Dmitry Vyukov
61ed43a86a sys/linux: prohibit EXT4_IOC_SHUTDOWN
EXT4_IOC_SHUTDOWN EXT4_IOC_SHUTDOWN on root fs effectively brings the machine down in weird ways.
2018-09-13 12:02:45 +02:00
Dokyung Song
71907dafdb sys/fuchsia: generate descriptions for garnet services 2018-09-12 11:08:31 +02:00
Dmitry Vyukov
3c88136c8a sys/linux: add btf descriptions
Add some new bpf descriptions, most notably btf.
Not perfect, but something.
2018-09-11 18:44:54 +02:00
Dmitry Vyukov
ff2962ae80 syz-ci: de-hardcode kernel object file names
We used to have this list in syz-ci and syz-managers.
Now we have kernel object in sys/targets, so use it instead.

Update #712
2018-09-11 15:43:55 +02:00
Dmitry Vyukov
20c13d3ce5 sys/fuchsia: regerenate files
Regerenate files after the previous commit.
2018-09-11 13:02:56 +02:00
Dokyung Song
11c256cdcd sys/fuchsia: prune unused structs in syscall description generated by fidlgen
After generating syscall description for fidl files using fidlgen, prune
all unused structs using the exact same mechanism used by the compiler's
check for unused structs. This allows the FIDL compiler to support
modular compilation; it does not need to have global knowledge of
whether each struct is used or not.
2018-09-11 13:01:53 +02:00
Dokyung Song
e30d3b5240 sys/fuchsia: add Go script that generates fidl descriptions 2018-09-06 21:18:15 +02:00
Dmitry Vyukov
596466b38c pkg/runtest: fixes for fuchsia
Add simple fuchsia program, the one that is run during image testing.
Fix csource errno printing for fuchsia.
Fix creation of executable files (chmod is not implemented on fuchsia).
Check that we get signal/coverage from all syscalls.
2018-09-06 10:56:09 +02:00
Dmitry Vyukov
8d971420ee sys/linux: extend xattr descriptions
Update #533
2018-09-02 06:47:18 +02:00
Anton Lindqvist
d0e00721b8 sys/targets: allow the name of kernel to be specified per target
Assuming the kernel is named vmlinux does not work for OpenBSD.
2018-09-01 21:46:58 -07:00
Anton Lindqvist
97bc7ad1b8 sys/openbsd: make SanitizeCall() idempotent
On OpenBSD, the vnode type for a device node of type S_IFMT is interpreted as
VBAD. Such vnodes often causes assertion failures inside kernel producing noisy
crashes. The goal of the OpenBSD specific SanitizeCall() is to prevent such
device nodes from being created. The S_IFMT constant is a mask covering all
possible device types, thus covering both character and block devices. Therefore
when the fuzzer generates a mknod{,at}() syscall with the S_IFMT type we cannot
known if the intent was to create a block or character device. Therefore
simplify the code to create a character device under such circumstances.

The observed failure is caused by the interaction between the OpenBSD specific
SanitizeCall() and the Unix one. The Unix sanitizer will not modify the mode
argument if it contains the S_IFMT mask. But on the second invocation when the
mode no longer contains S_IFMT it would modify it, causing a different program
to be produced. Therefore only delegate to the Unix sanitizer if the syscall is
not equal to mknod{,at}().

Regression introduces in commit b771b17e ("Add mandatory OpenBSD bits (#689)").
2018-08-31 09:06:47 -07:00
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
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