Commit Graph

702 Commits

Author SHA1 Message Date
Kamil Rytarowski
ecb717ca89 executor: adapt switching to user nobody to be more portable on BSDs
NetBSD uses different uid/gid than FreeBSD/OpenBSD for the user
nobody. Instead of hardcoding the values, retrieve it from the
password entry database.

While there, switch to setuid(2) and setgid(2) calls as they are
good enough and portable. setresgid(2) and setresuid(2) aren't
available on NetBSD.
2019-01-14 09:53:58 +01:00
Kamil Rytarowski
95485883f6 executor: do not call setrlimit(2) for RLIMIT_AS for NetBSD
Setting the limit caused abnormal failure during early init on NetBSD.
2019-01-14 09:52:03 +01:00
Michael Tuexen
9eb9389ab9 executor: update KCOV support for FreeBSD
KCOV support has been added to FreeBSD in r342962. Use
the header file and update the code to latest changes
introduced in the review process.
2019-01-14 09:50:07 +01:00
Kamil Rytarowski
7835524884 executor: disable gen.go for NetBSD
kvm is Linux specific.
2019-01-10 12:50: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
Kamil Rytarowski
fe1c444d38 executor: adapt os_init() to NetBSD with PaX MPROTECT
Initialize syz data segment with protection allowed by PaX MPROTECT.

PROT_MPROTECT() registers future potential protection that is allowed
to be enabled in future.
2019-01-09 06:02:05 +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
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
35e3f847cf executor: fix linux includes
Builds in one distro, but another says:

In file included from <stdin>:39:0:
/usr/powerpc64le-linux-gnu/include/linux/if.h:143:8: error: redefinition of ‘struct ifmap’
/usr/powerpc64le-linux-gnu/include/net/if.h:111:8: note: originally defined here

Mess. Try to fix it.
Not sure what's the right solution and it it even exists.
2018-12-29 22:05:57 +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
bf3be553de executor: use netlink instead of ip command to setup net devices
ip command caused several problems:
1. It is installed in different locations or
not installed at all in different distros.
2. It does not support latest kernel devices,
e.g. setup of hsr currently fails because
our ip does not understand its custom prose.
3. ip command is slow, unbearably slow in emulator
(full setup takes tens of seconds). This change
reduces setup from ~2s to ~400ms.
4. ip is not present in gvisor, but it will support netlink.

Use netlink directly to solve all these problems.
2018-12-29 19:22:34 +01:00
Dmitry Vyukov
3d48fa5a53 executor: log failure in write_file
Almost all callers of write_file just log the failure.
Log the failure in write_file directly to remove
lots of "error handling" code.
2018-12-29 19:22:34 +01:00
Michael Tuexen
a2af97ddf7 executor: Fix FreeBSD such all platforms use same number of entries
FreeBSD sets the kcov buffer as number of bytes instead of number
of entries. This also fixes the mmap() call, which was failing
due to inconsistent sizes. The failing was hidden due to wrong
error handling.
2018-12-29 19:17:28 +01:00
Michael Tuexen
e8f58194c1 executor: fix error handling of mmap()
mmap() returns MAP_FAILED, which is (void *)(-1), in case
of an error. This is different from NULL.
2018-12-29 19:17:28 +01:00
Michael Tuexen
8d43fb9c5e executor: add clarifying comment for FreeBSD. 2018-12-29 19:17:28 +01:00
Michael Tuexen
e0cd1d2e84 executor: add a clarifying comment 2018-12-29 19:17:28 +01:00
Michael Tuexen
6aef08ce12 executor: use function argument instead of global variable. 2018-12-29 19:17:28 +01:00
Dmitry Vyukov
a40793d7a5 sys/linux: refine few types in NETLINK_ROUTE 2018-12-29 07:45:20 +01:00
Michael Tuexen
4898a4328e executor: improve kcov compatibility with upcoming support
Get ioctl() definitions and usage in sync with the upcoming support
reviewed in https://reviews.freebsd.org/D14599.
2018-12-28 13:34:33 +01:00
Anton Lindqvist
fc6ae81a34 executor: KIOENABLE accepts a mode argument on OpenBSD 2018-12-28 08:25:37 +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
Anton Lindqvist
43cf01dd41 executor: include sys/kcov.h on OpenBSD
Since we no longer cross-compile, there's no need to repeat the defines.
2018-12-27 11:06:03 +01:00
Dmitry Vyukov
82c9e6774f executor: fix max number of syscall args
De-hardcode max number (wrong) of syscall args.
2018-12-26 21:52:50 +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
7624ddd6d8 executor: move setrlimit from setup_control_pipes to bsd os_init
This broke fuchsia build. We need setrlimit only for bsd.
2018-12-14 12:13:14 +01:00
Greg Steuck
f3d9d5948c pkg/csource: support tun and setuid repros on {free,open}bsd
* expose procid on BSD for tun, always declare loop()
* deal with terrible bsd includes
* replicate loop() declaration
2018-12-13 09:44:24 +01:00
Dmitry Vyukov
02613a4124 sys/linux: add basic tipc test 2018-12-12 13:14:26 +01:00
Greg Steuck
d90f8af59c executor: reapply setuid sandbox for bsd
* Revert "Revert "executor: add setuid sandbox for openbsd""

The problem is the low file descriptor limit.

This reverts commit 4093e33b13.

* executor/executor make sure the file descriptor limit is sufficient
2018-12-11 07:39:44 +01:00
Greg Steuck
4093e33b13 Revert "executor: add setuid sandbox for openbsd"
This reverts commit 6565f24da9.
2018-12-10 20:09:24 +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
Greg Steuck
6565f24da9 executor: add setuid sandbox for openbsd
* executor/common_bsd: add setuid sandbox

Fixes #833

cc @mptre

* Reduced duplications, resolved TODO.
2018-12-10 11:20:16 +01:00