Commit Graph

1247 Commits

Author SHA1 Message Date
Tobias Klauser
1cbaafd119 executor: add support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Alexander Egorenkov
b202c7a8a2 pkg/csource: fix casting of parameters for trampolines
Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-26 12:01:33 +02:00
Alexander Egorenkov
aea82c003a sys/linux: first 64bit big-endian architecture s390x
* mmap syscall is special on Linux s390x because
  the parameters for this syscall are passed as a struct
  on user stack instead of registers.
* Introduce the SyscallTrampolines table into targets.Target
  to address the above problem.
* There is a bug in Linux kernel s390x which causes QEMU TCG
  to hang when KASAN is enabled. The bug has been fixed
  in the forthcoming Linux 5.8 version. Until then do not enable
  KASAN when using QEMU TCG, QEMU KVM shall have no problems with
  KASAN.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-25 23:08:45 +02:00
Dmitry Vyukov
f9147b0836 executor: don't use static_assert
Use existing way of doing size checks, otherwise akaros build is broken:
https://github.com/google/syzkaller/pull/1868/checks?check_run_id=808613616
2020-06-25 21:29:13 +02:00
Alexander Egorenkov
ac40b8cc84 executor: fix write_output_64
The output pointer was not updated after writing.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-25 21:14:42 +02:00
Alexander Egorenkov
e5d10a4327 ipc: fix endianness issues
Use native byte-order for IPC and program serialization.
This way we will be able to support both little- and big-endian
architectures.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-23 16:18:44 +02:00
Alexander Egorenkov
c655ec77ca executor: fix endianness problem in internet checksum
csum_inet_update does not handle odd number of bytes
on big-endian architectures correctly. When calculating
the checksum of odd number of bytes, the last byte must be
interpreted as LSB on little-endian architectures and
as MSB on big-endian ones in a 16-bit half-word.

Futhermore, the checksum tests assume that the underlying architecture
is always little-endian. When a little-endian machine stores
a calculated checksum into memory, then the checksum's bytes
are automatically swapped. But this is NOT true on a big-endian
architecture.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-19 20:49:11 +02:00
Alexander Egorenkov
9466f7f96e executor: enable KVM generator only on AMD64 arch
Executor KVM generator works only on amd64 linux machines.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-17 17:43:56 +02:00
Marco Elver
8e3ab94116 executor: Improve used terminology
Improve used terminology by using better verbs to express the effect of
the whitelist/blacklist.

This also changes executor to exclusively show respectful log messages,
and as per recent conversion, converts the last such case.
2020-06-15 09:56:18 +02:00
m00nbsd
dbce178a0e
sys/netbsd: support multiple vHCI buses (#1822) 2020-06-13 12:10:16 +02:00
Dmitry Vyukov
588020678f all: use more respective language
Some terms are normalised on the technical level
but may be oppressive on a societal level.
Replace them with more technically neutral terms.
See the following doc for a longer version:
https://tools.ietf.org/id/draft-knodel-terminology-00.html
2020-06-11 23:19:34 +02:00
m00nbsd
0f23e882fa
sys/netbsd: add support for fault injection (#1817) 2020-06-11 23:16:52 +02:00
Marco Vanotti
c3e9afb345 executor/fuchsia: Don't map memory as executable.
Fuchsia has strict controls over who can map memory as executable.
Refactoring syz-executor to be able to do that involves a non trivial
amount of work: it needs to run as a fuchsia component and replace stdin
for some other mechanism to communicate with syz-fuzzer (probably a fidl
service and a thin client that proxies stdin/stdout to syz-fuzzer via
ssh).

Mapping memory as executable doesn't seem to be used or needed in
syz-executor at all. After talking with Dmitry, he mentioned that it was
used in a deprecated feature: `syz_execute_func` which would execute
random code. It also allows more scenarios during fuzzing.

For now, I'm removing that option to allow syzkaller continue fuzzing.

This change also refactors all of the error messages adding a string
representation of the `zx_status_t` in error logs.
2020-06-05 16:46:48 -03:00
Dmitry Vyukov
e3d77cf2a3 .golangci.yml: enable godot checker
A good one. Lots of fixed comments are contributed by episodic contributors.
So it's good to catch these earlier.
2020-06-05 12:23:19 +02:00
Andrey Konovalov
6c68daf098 executor: fix printing null master in netlink_device_change
The issues is only present with verbose debugging enabled.

executor/common_linux.h: In function ‘void netlink_device_change(nlmsg*, int, const char*, bool, const char*, const void*, int, const char*)’:
executor/common_linux.h:380:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  380 |  debug("netlink: device %s up master %s: %s\n", name, master, strerror(err));
2020-05-29 09:50:00 +02:00
m00nbsd
96c92ad3ab executor: fix a cast in common_usb_netbsd.h 2020-05-24 00:00:55 +02:00
m00nbsd
1f30020f85 executor: fix a USB define on NetBSD 2020-05-21 12:01:24 +02:00
m00nbsd
df09374f0c executor: use the SYZ_USB define for NetBSD 2020-05-21 09:10:30 +02:00
m00nbsd
49c689a527 executor: fix the types used in common_usb_netbsd.h 2020-05-21 09:10:30 +02:00
m00nbsd
1255f02a3b executor: add support for extra coverage on NetBSD 2020-05-20 10:23:38 +02:00
m00nbsd
67fa1f59b8 executor: add support for USB fuzzing on NetBSD 2020-05-19 23:07:55 +02:00
Dmitry Vyukov
910f427fd9 executor: exclude syz_kvm_setup_cpu on arm
KVM was removed for ARM.
Improved CI finally allows to catch this.
2020-05-18 11:34:42 +02:00
Andrey Konovalov
8a9f1e7dbd executor, sys/linux: syz_usb_ep_read/write accept endpoint address
This patch changes syz_usb_ep_read/write pseudo-syscalls to accept endpoint
address as specified in its endpoint descriptor, instead of endpoint index.
2020-05-15 16:30:32 +02:00
Andrey Konovalov
55efafca37 executor: stall unknown usb requests
Also don't fail(), leave that to USB_DEBUG and analyze_control_request().
2020-05-15 16:30:32 +02:00
Michael Tuexen
a885920d00 executor: don't build gen.go on FreeBSD 2020-05-13 21:50:15 +02:00
Michael Tuexen
d9fecf2516 executor: don't build gen.go on OpenBSD or NetBSD
Use (NOT openbsd) AND (NOT netbsd) instead of (NOT openbsd) OR (NOT netbsd).
2020-05-13 21:50:15 +02:00
Michael Tüxen
b3fe7470a4
executor: fix typo (#1737) 2020-05-13 17:50:20 +02:00
Michael Tuexen
c7875f08e1 executor: fix #ifdef condition for remove_dir() 2020-05-13 15:56:14 +02:00
Dmitry Vyukov
ec42220e77 Makefile: generate descriptions on-the-fly
Checking in the generated descriptions files makes few things simpler,
but causes pain for pull requests: (1) PRs that touch descriptions
_always_ conflict, (2) PRs are large and harder to review,
(3) people sometimes forget to add auto-generated files.

The proposed way does not require us to hardcode lots of dependencies
in the Makefile (which is nice) and seem to work.
Let's see how it works.

The main contributor-visible consequence is that the auto-generated
files do not need to be checked-in now.

Credit for figuring the Makefile magic goes to @melver.

Fixes #1291
2020-04-30 17:18:29 +02:00
Andy Nguyen
c42af8f753 sys: add mldv2 packet structs
Use special values for hop limit to increase likelihood of triggering certain paths.
2020-04-29 18:55:57 +02:00
Andy Nguyen
bd365072bf sys: add more specific ipv6 options
Additionally fix a type for ipv6_hopopts_ext_header
2020-04-29 16:46:34 +02:00
Dmitry Vyukov
0ce7569ee7 pkg/compiler: deduplicate Types in descriptions
Add prog.Ref Type that serves as a proxy for real types
and allows to deduplicate Types in generated descriptions.
The Ref type is effectively an index in an array of types.
Just before serialization pkg/compiler replaces real types
with the Ref types and prepares corresponding array of real types.
When a Target is registered in prog package, we do the opposite
operation and replace Ref's with the corresponding real types.

This brings improvements across the board:
compiler memory consumption is reduced by 15%,
test building time by 25%, descriptions size by 33%.

Before:
$ du -h sys/linux/gen
54M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m54.200s
real	0m53.883s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m27.911s
real	0m27.767s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
20.59 100% 3200016
20.97 100% 3445976
20.25 100% 3209684

After:
$ du -h sys/linux/gen
36M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m42.290s
real	0m43.230s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m24.337s
real	0m24.727s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
19.11 100% 2764952
19.66 100% 2787624
19.35 100% 2749376

Update #1580
2020-04-26 05:58:31 +02:00
Greg Steuck
99b258ddc3 sys/openbsd: extend vnet
* started with freebsd/vnet.txt
  * pruned unsupported items
  * gmake extract
  * gmake generate_sys
  * gmake fomat
2020-04-26 04:43:15 +02:00
Ayushi Sharma
2e44d63e40
sys/netbsd: add lchmod(2) (#1687) 2020-04-21 13:22:03 +02:00
Greg Steuck
347a5dc3c7 executor: remove unidentified file
It was committed as the following and doesn't make sense.

commit e06d2ea701
Author: R3x <siddharth.muralee@gmail.com>
Date:   Sat Jul 6 14:01:06 2019 +0000

    sys/netbsd: Added posix_spawn and fork syscalls
2020-04-20 07:25:10 +02:00
Dmitry Vyukov
6dfd45e1d0 sys/syz-sysgen: better formatting for syscall descriptions
We don't really need clang-format for auto-generated code.
We can do better ourselves!
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
91db3ed8ce prog: add ignore_return and breaks_returns call attribtues
We had these hard-coded for fuchsia and linux accordingly.
Replace with call attributes.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
1155a0d1d6 sys/linux: sync call timeouts with executor
Timeouts in executor and sys/linux get out of sync. Sync them.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
cc8708904d sys/linux: add timeout call attributes
Move additional call/prog timeouts to descriptions.

Due to this logic duplication executor used 50ms
for syz_mount_image, while pkg/csource used 100ms.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
90d17ab898 prog: introduce call attributes
Add common infrastructure for syscall attributes.
Add few attributes we want, but they are not implemented for now
(don't affect behavior, this will follow).
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
365fba2440 executor: surround the data mapping with PROT_NONE pages
Surround the main data mapping with PROT_NONE pages to make virtual address layout more consistent
across different configurations (static/non-static build) and C repros.
One observed case before: executor had a mapping above the data mapping (output region),
while C repros did not have that mapping above, as the result in one case VMA had next link,
while in the other it didn't and it caused a bug to not reproduce with the C repro.

The bug that reproduces only with the mapping above:
https://lkml.org/lkml/2020/4/17/819
2020-04-18 14:43:29 +02:00
Dmitry Vyukov
6fe0f49646 executor: remove more code if ENABLE_NAPI_FRAGS is not set
In some configurations tun_frags_enabled ends up being unused
with a compiler warning and failed build.
Remove mode code if ENABLE_NAPI_FRAGS is not enabled.
2020-04-18 14:37:48 +02:00
ais2397@gmail.com
c743fcb3e0 sys/netbsd: add minherit(2) 2020-04-16 07:02:15 +02:00
Dmitry Vyukov
3f3c557402 sys/linux: add some more ipv4/6 addresses
Add few private ipv4/6 addresses that may affect kernel behavior.
2020-04-14 09:11:27 +02:00
Dmitry Vyukov
ffe85af864 sys/linux: regenerate consts
On the current linux-next:
f19bb13a0eaf0034a603e3b54a7c3a50faf6821e (next-20200414)

EXT4_EOFBLOCKS_FL was removed by 4337ecd1fe997d2b2135b4434caaccdb47c10c06

ARM does not support KVM anymore, removed by 541ad0150ca4 ("arm: Remove 32bit KVM host support").

Fixes #1676
2020-04-14 07:37:58 +02:00
ais2397@gmail.com
a517e13956 sys/netbsd: fix struct stat 2020-04-13 21:20:21 +02:00
Paul Chaignon
17a986e54c sys/linux: add link_create and link_update commands
Signed-off-by: Paul Chaignon <paul@cilium.io>
2020-04-12 17:03:47 +02:00
Paul Chaignon
95536f1d7b bpf: update BPF constants
Signed-off-by: Paul Chaignon <paul@cilium.io>
2020-04-12 17:03:47 +02:00
Andrey Konovalov
db9bcd4b9f executor/usb: don't fail when ath9k is not enabled 2020-04-07 18:21:37 +02:00
Dmitry Vyukov
2f886fb32c executor: regenerate files 2020-04-06 09:02:47 +02:00
Ayushi Sharma
d9ed075d1a
sys/netbsd: adding chflags(2) syscalls (#1661) 2020-04-04 00:07:51 +02:00
Andrey Konovalov
09ff5abc02 csource, executor: add usb emulation feature
The feature gets enabled when /dev/raw-gadget is present and accessible.
With this feature enabled, executor will do chmod 0666 /dev/raw-gadget on
startup, which makes it possible to do USB fuzzing in setuid and namespace
sandboxes. There should be no backwards compatibility issues with syz
reproducers that don't explicitly enable this feature, as they currently only
work in none sandbox.
2020-04-03 12:42:06 +02:00
Dmitry Vyukov
1c52742ffc executor: re-run make generate 2020-03-31 15:32:08 +02:00
Ayushi Sharma
46105100bf
sys/netbsd: adding lwp syscalls (#1654) 2020-03-31 14:14:00 +02:00
Andrey Konovalov
f1ebdfba7d executor: add some comments to USB helper functions 2020-03-28 11:53:20 +01:00
Andrey Konovalov
47232600c3 executor: split out Linux specific USB code 2020-03-28 11:53:20 +01:00
Mark Johnston
7d95711b32 sys/freebsd: add Capsicum system calls 2020-03-27 05:51:58 +01:00
Mark Johnston
be07a9be5e sys/freebsd: add __realpathat system call 2020-03-27 05:51:58 +01:00
Mark Johnston
87abd520f8 sys/freebsd: add bindat(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
c37c8bf05b sys/freebsd: add POSIX shared memory system calls 2020-03-27 05:51:58 +01:00
Mark Johnston
ed2c77ae59 sys/freebsd: add connectat(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
f2e4c4ea82 sys/freebsd: add posix_fadvise(2) and posix_fallocate(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
0645e7c7e9 sys/freebsd: add missing open(2) flags 2020-03-27 05:51:58 +01:00
Mark Johnston
20d6478ce7 sys/freebsd: use symbolic names for faccessat(2) flags 2020-03-27 05:51:58 +01:00
Mark Johnston
7a683c4c28 sys/freebsd: add chflags(2) and related syscalls 2020-03-27 05:51:58 +01:00
Mark Johnston
892d1075a4 sys/freebsd: add lchmod(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
7c5dc2298f sys/freebsd: add copy_file_range(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
31f17aa979 sys/freebsd: add minherit(2) 2020-03-27 05:51:58 +01:00
Mark Johnston
edada2ecad sys/freebsd: add FreeBSD-specific madvise(2) flags 2020-03-27 05:51:58 +01:00
Dmitry Vyukov
ef871b2e4f sys/linux: don't use syz_open_dev when openat is enough 2020-03-24 08:43:00 +01:00
Dmitry Vyukov
8cf47975a6 pkg/compiler: truncate const values to their physical size
We do similar truncation for values in the prog package (truncateToBitSize).
Truncating them in the generated descriptions makes it possible
to directly compare values (otherwise -1 and truncated -1 don't match).
2020-03-24 08:43:00 +01:00
Dmitry Vyukov
97bc55cead pkg/compiler: check that flags values fit into base type
flags[foo, int8]
foo = 0x12345678

is always an error, detect these cases.
Found some bugs in mptcp, packet sockets, kvm.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
2e9037c55f pkg/compiler: check that const values fit into base type
const[0x12345678, int8] is always an error, detect these cases.
Found some bugs in mptcp, socket proto and fuchsia fidl descriptions.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
1ea952c9ff pkg/compiler: calculate more precise sizes for arguments
If we have:

ioctl(fd fd, cmd int32)
ioctl$FOO(fd fd, cmd const[FOO])

Currently we assume that cmd size in ioctl$FOO is sizeof(void*).
However, we know that in ioctl it's specified as int32,
so we can infer that the actual syscall size is 4.

This massively reduces sizes of socket/setsockopt/getsockopt/ioctl
and some other syscalls, which is good because we now use physical
size in mutation/hints and some other places.

This will also enable not morphing ioctl's into other ioctl's.

Update #477
Update #502
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
924f760604 pkg/compiler: ensure consistency of syscall argument types
Ensure that we don't have conflicting sizes for the same argument
of the same syscall, e.g.:

foo$1(a int16)
foo$2(a int32)

This is useful for several reasons:
 - we will be able avoid morphing syscalls into other syscalls
 - we will be able to figure out more precise sizes for args
   (lots of them are implicitly intptr, which is the largest
   type on most important arches)
 - found few bugs in linux descriptions

Update #477
Update #502
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
5de34a784c pkg/compiler: don't specify syscall consts for test OS
This is just tedious. Fabricate them on the fly.
2020-03-17 21:19:13 +01:00
Dmitry Vyukov
749688d22a executor: fix format warning 2020-03-13 19:49:29 +01:00
Dmitry Vyukov
bddb05c5eb executor: fix data race
ThreadSanitizer says:

WARNING: ThreadSanitizer: data race (pid=3)
  Atomic read of size 4 at 0x56360e562f08 by main thread:
    #0 __tsan_atomic32_load <null> (libtsan.so.0+0x64249)
    #1 event_isset executor/common_linux.h:51 (syz-executor.0+0x2cf1f)
    #2 handle_completion executor/executor.cc:886 (syz-executor.0+0x2cf1f)
    #3 execute_one executor/executor.cc:732 (syz-executor.0+0x2da3b)
    #4 loop executor/common.h:581 (syz-executor.0+0x2f1aa)
    #5 do_sandbox_none executor/common_linux.h:2694 (syz-executor.0+0x189d6)
    #6 main executor/executor.cc:407 (syz-executor.0+0x189d6)

  Previous write of size 4 at 0x56360e562f08 by thread T1:
    #0 event_reset executor/common_linux.h:32 (syz-executor.0+0x1f5af)
    #1 worker_thread executor/executor.cc:1048 (syz-executor.0+0x1f5af)
    #2 <null> <null> (libtsan.so.0+0x2b0b6)

  Location is global 'threads' of size 2560 at 0x56360e562f00 (syz-executor.0+0x00000008bf08)

  Thread T1 (tid=6, running) created by main thread at:
    #0 pthread_create <null> (libtsan.so.0+0x2d55b)
    #1 thread_start executor/common.h:256 (syz-executor.0+0x2d707)
    #2 thread_create executor/executor.cc:1037 (syz-executor.0+0x2d707)
    #3 schedule_call executor/executor.cc:811 (syz-executor.0+0x2d707)
    #4 execute_one executor/executor.cc:719 (syz-executor.0+0x2d707)
    #5 loop executor/common.h:581 (syz-executor.0+0x2f1aa)
    #6 do_sandbox_none executor/common_linux.h:2694 (syz-executor.0+0x189d6)
    #7 main executor/executor.cc:407 (syz-executor.0+0x189d6)
2020-03-13 13:16:53 +01:00
Dmitry Vyukov
008f58d77e executor: add more debugging output for running=-1
The running=-1 check fires periodically for the past 2 years.
I can't reproduce nor understand how this happens.
Add more debugging output, maybe it will shed some light.

Update #502
2020-03-13 13:16:53 +01:00
Andrey Konovalov
d89275f2aa executor, sys/linux: add ath9k usb descriptions
Among other things this changes timeout for USB programs from 2 to 3 seconds.

ath9k fuzzing also requires ath9k firmware to be present, so system images
need to be regenerated with the updated script.
2020-03-13 07:44:43 +01:00
Dmitry Vyukov
e7caca8e1e executor: minor cleanup of android sandbox
Fix code formatting, clang-tidy warnings, minor style nits.
2020-03-11 12:09:17 +01:00
Dmitry Vyukov
3d010fa6c3 executor: fix clang-tidy warnings 2020-03-11 11:59:39 +01:00
mspectorgoogle
e103bc9e1b
executor: add seccomp support for Android
This adds support for the seccomp filters that are part of Android into
the sandbox.  A process running as untrusted_app in Android has a
restricted set of syscalls that it is allow to run.  This is
accomplished by setting seccomp filters in the zygote process prior to
forking into the application process.  The seccomp filter list comes
directly from the Android source, it cannot be dynamically loaded from
an Android phone because libseccomp_policy.so does not exist as a
library on the system partition.
2020-03-11 11:21:36 +01:00
Dmitry Vyukov
fd2a5f28eb executor: prevent "NMI handler took too long" messages
nmi_check_duration() prints "INFO: NMI handler took too long" on slow debug kernels.
It happens a lot in qemu, and the messages are frequently corrupted
(intermixed with other kernel output as they are printed from NMI)
and are not matched against the suppression in pkg/report.
This write prevents these messages from being printed.
2020-03-06 13:38:53 +01:00
Anton Lindqvist
b655d91b8c sys/openbsd: prevent killing the ssh VM connection
This is one of the root causes of the 'no output from test machine'
panic. Issuing a DIOCKILLSTATES ioctl on a /dev/pf file descriptor will
cause state associated with ongoing connections to be purged;
effectively killing the ssh connection to the VM.

Including net/pfvar.h is necessary in order to make use of the
DIOCKILLSTATES define.
2020-03-05 09:14:28 +01:00
Andrei Vagin
40bcfdd59e executor: don't exit if NETLINK_GENERIC isnt' supported
NETLINK_GENERIC isn't supported in gVisor.

Fixes: c5ed587f4a ("wireguard: setup some initial devices in a triangle")
Signed-off-by: Andrei Vagin <avagin@google.com>
2020-02-27 09:31:19 +01:00
Dmitry Vyukov
5e0e1d1450 executor: uncomment accidentially commented code
unshare(CLONE_NEWPID) was commented out in 4428511d10 accidentially.
Uncomment it.
Spotted by @xairy:
4428511d10 (r37456572)
2020-02-24 16:05:43 +01:00
Dmitry Vyukov
2ffa6679c4 sys/linux: add NETLINK_SOCK_DIAG descriptions
Incomplete, but something.
2020-02-21 19:09:56 +01:00
Dmitry Vyukov
4428511d10 sys/linux: add NETLINK_RDMA descriptions 2020-02-21 17:38:10 +01:00
Dmitry Vyukov
ed54dfe305 sys/linux: add NETLINK_AUDIT descriptions 2020-02-21 11:32:08 +01:00
Dmitry Vyukov
bd2a74a31f sys/linux: add smc_pnetid genetlink descriptions 2020-02-20 18:42:57 +01:00
Dmitry Vyukov
012fbc3229 sys/linux: add descriptions of wireguard packets 2020-02-18 10:31:04 +01:00
Dmitry Vyukov
d52d4872e3 sys/linux: don't extract from futex.txt and watch_queue.txt
These are not present in linux-next.
2020-02-18 10:31:03 +01:00
Dmitry Vyukov
39cd0f85a1 executor: disable IFF_NAPI_FRAGS
Update #1594
2020-02-18 10:31:02 +01:00
Dmitry Vyukov
b97f1e694a sys/linux: add broadcast mac address
Code in net/ethernet/eth.c does this:

__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
{
...
	if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
					      dev->dev_addr))) {
		if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) {
			if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))
				skb->pkt_type = PACKET_BROADCAST;
			else
				skb->pkt_type = PACKET_MULTICAST;
		} else {
			skb->pkt_type = PACKET_OTHERHOST;
		}
	}

Multicast and broadcast are distinct and dev->broadcast seems to be ffffffffffff
by default, so add another multicast mac address that will serve as PACKET_MULTICAST.
2020-02-18 10:31:02 +01:00
Dmitry Vyukov
ed8812ac86 executor: refactor extra cover handling
One observation is that checking for extra cover is very fast
(effectively a memory load), so we can simplify code by removing
th->extra_cover and just check for it always. Additionally, we may
grab some coverage that we would miss otherwise.

Don't sleep for 500 ms at the end if colliding,
we are not going to use the extra coverage in that case anyway.

Check for extra coverage at the end every 100ms to avoid
being killed on timeout before we write any.

Make the 500ms sleep at the end parametrizable.
Enable it for syz_usb syscalls, so we get the same behavior for usb.

But this also allows to get extra coverage for other subsystems.
Some subsystems don't have a good way to detect if we will get any
extra coverage or not. Sleeping for 500ms for all programs slows down
fuzzing too much. So we check for extra coverage at the end for all
programs (cheap anyway), but sleep only for usb program.
This allows to collect extra coverage for vhost and maybe wireguard in future.

Update #806
2020-02-17 13:12:18 +01:00
André Almeida
d0d8e8bc77
sys/linux: add new FUTEX_WAIT_MULTIPLE operation
Create individual file for futex syscall and add description for the new
operation FUTEX_WAIT_MULTIPLE.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
2020-02-17 06:27:23 +01:00
Paul Chaignon
cf9142006b sys/linux: add map batch operations
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
2020-02-16 10:22:29 +01:00
Paul Chaignon
88f115c969 sys/linux: update BPF constants and structures
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
2020-02-16 10:22:29 +01:00
Jason A. Donenfeld
c5ed587f4a
wireguard: setup some initial devices in a triangle
* wireguard: setup some initial devices in a triangle

The fuzzer will wind up undoing some of this, which is fine, but at
least it now has the chance of hitting some other paths it wasn't
before.

Closes: #1599

* wireguard: make code ugly after `make generate` pass

* wireguard: get rid of unused structs that are still interesting

* wireguard: compile in C++ mode with gcc 7

Complex designated initializers are only supported in C++ mode from gcc
8, and for whatever reason syzkaller wants to be compiled in C++ mode.

* wireguard: add braces around debug statements for checker

* wireguard: regenerate go source
2020-02-13 15:28:57 +01:00