aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
Commit message (Collapse)AuthorAgeFilesLines
* sys/linux: test various binfmt's in execveDmitry Vyukov2018-04-021-0/+15
|
* executor: fix unchecked result warningDmitry Vyukov2018-04-011-1/+3
|
* sys/linux: add support for reading partition tablesDmitry Vyukov2018-04-011-3/+95
|
* executor: fix compilation warningsDmitry Vyukov2018-03-301-14/+8
| | | | | | | | SYS_memfd_create define produces warning in scource if system headers already contain the definition (we strip all ifdefs!). The same is true for CLONE_NEWCGROUP but we just never hit it yet. Also fix format string for 32 bits. Also fix potential uninit var in csource, and a missing new line.
* sys/linux: add support for mounting filesystem imagesDmitry Vyukov2018-03-301-2/+140
|
* executor: rework cgroups supportDmitry Vyukov2018-03-271-33/+24
| | | | | | | | | | 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.
* executor: fix reset of bridge netfilterDmitry Vyukov2018-03-251-0/+2
| | | | We left entries non-zero, so memcmp always failed.
* sys/linux: add cgroup descriptionsDmitry Vyukov2018-03-251-47/+260
|
* sys/linux: add netlink fou descriptionsDmitry Vyukov2018-03-211-0/+54
|
* executor: fix ifdef's for csourceDmitry Vyukov2018-03-071-1/+1
| | | | | | | There is test failure on travis: https://travis-ci.org/google/syzkaller/jobs/349948391 I can't reproduce it locally, and it only happened on 1.8, but not on 1.9? But this seems to be what could have provoked such failure.
* sys/linux: add syz_init_net_socket syscallDmitry Vyukov2018-03-051-1/+46
| | | | | | | | | | | 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.
* executor: simplify initialize_tunDmitry Vyukov2018-02-261-24/+27
| | | | Remove executor_pid, enable_tun and setup_tun.
* sys/linux: remove proc type from network descriptionsDmitry Vyukov2018-02-261-41/+23
| | | | | | | | | | 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.
* executor, pkg/csource: make fd numbers consistentDmitry Vyukov2018-02-261-3/+13
| | | | | | | | | | | Currently when executor creates fd's it gets: 0, 3, 4. When tun is enabled: 3, 4, 5. For C programs: 3, 4, 5. When run is enabled: 4, 5, 6. Theoretically it should not matter, but these fd numbers are probably sometimes are used as data. So make them consistent in all these cases (3, 4, 5).
* prog: add arbitrary mutation of complex structsDmitry Vyukov2018-02-251-2/+2
| | | | | | 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.
* executor: bring up bond and veth devicesDmitry Vyukov2018-02-221-2/+3
|
* executor: fix buildDmitry Vyukov2018-02-171-0/+1
| | | | Older versions of linux require an additional header.
* sys/linux: add bridge netfilter supportDmitry Vyukov2018-02-171-0/+97
|
* pkg/csource: fix debug callsDmitry Vyukov2018-02-091-5/+2
| | | | debug calls are only properly stripped if they are on a single line.
* sys/linux: improve netfilter descriptionsDmitry Vyukov2018-02-091-37/+193
| | | | | | | | | | | | | | | | 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.
* executor: fix 32-bit supportDmitry Vyukov2018-01-281-2/+1
| | | | | ipt_get_entries.entrytable must be pointer aligned, so in 32-bit build there is no padding before it.
* sys/linux: extend netfilter descriptionsDmitry Vyukov2018-01-271-0/+154
|
* executor: handle old and new selinux mount pointsDmitry Vyukov2018-01-231-2/+6
|
* executor: reshuffle namespace sandboxing sequence againDmitry Vyukov2018-01-221-11/+14
| | | | | | | | | | Now we create tun in the _outer_ net namespace, which is tied to init user namespace. Thus fuzzer does not have CAP_ADMIN in it. In the end it seems that there is no sandboxing sequence, which would give us everything we need. Reshuffle sequences so that we have corrent namespace hierarchy, but don't have IFF_NAPI_FRAGS.
* sys/linux: more selinux descriptionsDmitry Vyukov2018-01-181-1/+6
|
* executor: fix tun/device setup for sandbox=namespaceDmitry Vyukov2018-01-151-8/+33
| | | | | | | | For sandbox=namespace we first create network devices and then do CLONE_NEWNS, which brings us into a new namespace which actually does not have any of these devices. Tun mostly worked, because we hold fd to the tun device. However, even for tun we could not see the "syz0" device.
* executor: setup network devicesDmitry Vyukov2018-01-131-18/+55
| | | | | | We test in a new network namespace, which does not have any devices set up (even lo). Create/up as many devices as possible. Give them some addresses and use these addresses in descriptions.
* executor: introduce uint64/32/16/8 typesDmitry Vyukov2017-12-271-32/+32
| | | | | | | | | | | | | | | The "define uint64_t unsigned long long" were too good to work. With a different toolchain I am getting: cstdint:69:11: error: expected unqualified-id using ::uint64_t; ^ executor/common.h:34:18: note: expanded from macro 'uint64_t' Do it the proper way: introduce uint64/32/16/8 types and use them. pkg/csource then does s/uint64/uint64_t/ to not clutter code with additional typedefs.
* executor: fix another format bugDmitry Vyukov2017-12-271-1/+1
| | | | Detected only by clang.
* executor: check format stringsDmitry Vyukov2017-12-271-3/+3
| | | | | | | | | | | | | | | | | | | I see a crash which says: #0: too much cover 0 (errno 0) while the code is: uint64_t n = ...; if (n >= kCoverSize) fail("#%d: too much cover %u", th->id, n); It seems that the high part of n is set, but we don't see it. Add printf format attribute to fail and friends and fix all similar cases. Caught a bunch of similar cases and a missing argument in: exitf("opendir(%s) failed due to NOFILE, exiting");
* pkg/csource: mimic the way syscalls are scheduled in executorDmitry Vyukov2017-12-221-0/+64
| | | | | | | | Currently csource uses completely different, simpler way of scheduling syscalls onto threads (thread per call with random sleeps). Mimic the way calls are scheduled in executor. Fixes #312
* executor: remove dead codeDmitry Vyukov2017-12-221-2/+0
| | | | doexit already contains an infinite loop.
* pkg/csource: fix handling of proc typesDmitry Vyukov2017-12-221-0/+1
| | | | | | | | | | Generated program always uses pid=0 even when there are multiple processes. Make each process use own pid. Unfortunately required to do quite significant changes to prog, because the current format only supported fixed pid. Fixes #490
* sys: move test syscalls to a separate targetDmitry Vyukov2017-12-171-8/+0
| | | | | | We have them in linux solely for historical reasons. Fixes #462
* executor: fix buildDmitry Vyukov2017-12-061-4/+4
| | | | | | exitf function was not defined with some combinations of options in csource. Fix defines and switch exitf back to fail, fail already checks ENOMEM/EAGAIN, so there is no reason to use exitf in this particular case.
* executor: unshare PID namespace even for sandbox=noneDmitry Vyukov2017-12-051-5/+26
| | | | | | | | Unshare as much as we can for all sandboxing modes. This fixes "kernel panic: Attempted to kill init!" crashes under sandbox=none. And should just generally improve reproducibility, e.g. if we unshare SYSVSEM fuzzer won't collide with any existing semaphores.
* executor: treat fail-nth errors as non-fatalDmitry Vyukov2017-12-051-4/+7
| | | | | We see occasional ENOENT/EACCES errors returned. It seems that fuzzer somehow gets its hands to it.
* sys/linux: open files from /procDmitry Vyukov2017-11-271-1/+23
|
* executor: use /proc/thread-self/fail-nth instead of /proc/self/task/%d/fail-nthDmitry Vyukov2017-11-271-7/+6
| | | | Makes code slightly simpler.
* executor: proceed even if /dev/net/tun is not availableAndrey Konovalov2017-11-081-2/+12
| | | | | | | | | For some racy bugs syzkaller can generate a C reproducer with tun enabled, when it's not actuallly required to trigger the bug. Some kernel developers (that don't have CONFIG_TUN=y on their setups) complain about such C repros. When tun is not available, instead of exiting, print a message that tun initialization failed and proceed.
* executor: fix build breakages due to doexitDmitry Vyukov2017-10-191-6/+0
| | | | | Some standard libraries contain "using ::exit;", which breaks with the current redefinition of exit.
* executor, pkg/ipc: unify ipc protocol between linux and other OSesDmitry Vyukov2017-10-161-1/+0
| | | | | | | | | | | | | | | | | We currently use more complex and functional protocol on linux, and a simple ad-hoc protocol on other OSes. This leads to code duplication in both ipc and executor. Linux supports coverage, shared memory communication and fork server, which would also be useful for most other OSes. Unify communication protocol and parametrize it by (1) use of shmem or only pipes, (2) use of fork server. This reduces duplication in ipc and executor and will allow to support the useful features for other OSes easily. Finally, this fixes akaros support as it currently uses syz-stress running on host (linux) and executor running on akaros.
* executor: include missing headerDmitry Vyukov2017-10-101-0/+1
| | | | writev requires <sys/uio.h>. Include it.
* executor: set own PATH when starting subprocessesDmitry Vyukov2017-10-101-3/+8
| | | | | | Executor process does not have any env, including PATH. On some distributions, system/shell adds a minimal PATH, on some it does not. Set own standard PATH to make it work across distributions.
* executor: support fragmentation in syz_emit_ethernetDmitry Vyukov2017-10-021-19/+79
| | | | | | A recent linux commit "tun: enable napi_gro_frags() for TUN/TAP driver" added support for fragmentation when emitting packets via tun. Support this feature in syz_emit_ethernet.
* executor, sys/windows: initial windows supportDmitry Vyukov2017-09-251-0/+65
|
* all: more assorted fuchsia supportDmitry Vyukov2017-09-221-0/+877