aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_linux.h
Commit message (Collapse)AuthorAgeFilesLines
...
* executor: abort fuse connectionDmitry Vyukov2018-08-041-0/+60
| | | | | | | 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.
* executor: extend logging in netfilter codeDmitry Vyukov2018-08-021-32/+47
| | | | | We see some failures there, extend logging so that it's least possible to understand what exactly call has failed.
* pkg/csource: tidy generated codeDmitry Vyukov2018-07-271-7/+20
| | | | | | | | | | | 1. Remove unnecessary includes. 2. Remove thunk function in threaded mode. 3. Inline syscalls into main for the simplest case. 4. Define main in common.h rather than form with printfs. 5. Fix generation for repeat mode (we had 2 infinite loops: in main and in loop). 6. Remove unused functions (setup/reset_loop, setup/reset_test, sandbox_namespace, etc).
* executor: simplify event_timedwaitDmitry Vyukov2018-07-271-15/+9
| | | | | | We always have current_time_ms in event_timedwait so use it instead of manual clock_gettime calls which tend to be bulkier.
* executor: ignore unshare errors in setuid sandboxDmitry Vyukov2018-07-271-4/+8
| | | | We already do this in sandbox=none, but forgot about setuid.
* executor: overhaulDmitry Vyukov2018-07-241-845/+612
| | | | | | | | | | | | | | | | | 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.
* pkg/host: add "network devices" featureDmitry Vyukov2018-07-131-0/+8
| | | | | | Linux executor sets up some network devices for testing, detect when that's supported on the machine and don't do it if it's not supported.
* sys/linux: implement fuse as normal syscallsDmitry Vyukov2018-07-101-67/+0
| | | | | Remove syz_fuse* and implement them as normal syscalls. We not have enough expressive power to form mount options.
* executor: tweaks for better 9p testingDmitry Vyukov2018-07-081-3/+13
| | | | See the added comments.
* prog, pkg/compiler: support fmt typeDmitry Vyukov2018-07-081-9/+1
| | | | | fmt type allows to convert intergers and resources to string representation.
* executor: fix pid check after forkDmitry Vyukov2018-06-291-2/+2
|
* pkg/csource: support fuchsiaDmitry Vyukov2018-06-291-12/+17
| | | | Lots of assorted heavylifting to support csource on fuchsia.
* executor: don't crash during tun setup if ipv6 is not enabledDmitry Vyukov2018-06-261-4/+7
| | | | | Some options that tun initialization sets up are optional. Don't fail if they are missing in kernel.
* executor: rework fallback coverageDmitry Vyukov2018-06-221-2/+2
| | | | | | | | | | We have fallback coverage implmentation for freebsd. 1. It's broken after some recent changes. 2. We need it for fuchsia, windows, akaros, linux too. 3. It's painful to work with C code. Move fallback coverage to ipc package, fix it and provide for all OSes.
* executor: handle case when AF_INET is not enabledDmitry Vyukov2018-06-221-4/+28
| | | | No AF_INET is somewhat crazy, but why not.
* executor: always use errors=continue when mounting ext2/3/4Dmitry Vyukov2018-06-111-5/+21
| | | | | | | For ext2/3/4 we have to have errors=continue because the image can contain errors=panic flag and can legally crash kernel. Fixes #599
* pkg/csource: minimize netdevices and net resetDmitry Vyukov2018-05-171-19/+22
| | | | | | Add separate options to minimize netdevices setup and net namespace reset. Fixes #581
* executor: fix strncpy compile errorIoana Ciornei2018-05-131-1/+1
| | | | | | | | | gcc8 is stricter when dealing with strings and strncpy and demands that the size of the actual string to be copied to be explicitly smaller than the size of the destination, just to make sure the NULL terminator is taken into considerantion. This patch fixes the issue. Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
* executor: don't fail when ipv6 is not enabledDmitry Vyukov2018-04-201-1/+7
| | | | | | Check in checkpoint_iptables is not enough as reset_iptables will fail even if no tables enabled. Add similar check to reset_iptables.
* executor: increase max image size to 128MBDmitry Vyukov2018-04-191-3/+3
| | | | Images of some filesystems need to be that large (xfs, btrfs, f2fs).
* executor: don't fail if IPv6 is not enabledDmitry Vyukov2018-04-161-1/+7
|
* executor: add two slave interfaces for bridge,bond,teamHangbin Liu2018-04-131-7/+24
| | | | | | | | Bridge device is used for forwarding. Bond/team device is used for load balance and fail over. So it would make more sense to add two slave interfaces for these devices. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
* sys/linux: add veth devices to devnamesDmitry Vyukov2018-04-111-1/+4
| | | | Also comment new veth code for future me.
* executor: add salve interface for bond0/team0Hangbin Liu2018-04-111-2/+6
| | | | | | | | | | | | Add a veth pair with name bond/team_slave and set their master to bond0/team0. Remove veth from devtypes because the cmd `ip link add veth0 type veth` will actually failed with "RTNETLINK answers: File exists" and no veth interface created. When create veth device, kernel will create a pair of veth, so no need to create them one by one. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
* executor: create team deviceDmitry Vyukov2018-04-061-6/+8
|
* 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
|