aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/linux_common.go
Commit message (Collapse)AuthorAgeFilesLines
* executor: overhaulDmitry Vyukov2018-07-241-3143/+0
| | | | | | | | | | | | | | | | | 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-63/+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-2/+8
| | | | 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-19/+26
| | | | 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/+4
| | | | | 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/+16
| | | | | | | 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
* executor: make syscall table and number constantDmitry Vyukov2018-06-071-2/+0
| | | | | | | | | We see some crashes that suggest corruption of the syscall number: invalid command number 1296 (errno 11) invalid command number 107 (errno 110) Make the table and the number constant to prevent corruption.
* pkg/csource: minimize netdevices and net resetDmitry Vyukov2018-05-171-16/+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>
* gometalinter: enable package comment checkingDmitry Vyukov2018-05-031-0/+1
| | | | Update #538
* 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-4/+17
| | | | | | | | 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/+0
| | | | 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/+13
|
* executor: fix unchecked result warningDmitry Vyukov2018-04-011-1/+3
|
* sys/linux: add support for reading partition tablesDmitry Vyukov2018-04-011-3/+92
|
* 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/+130
|
* executor: rework cgroups supportDmitry Vyukov2018-03-271-32/+23
| | | | | | | | | | 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/+243
|
* sys/linux: add netlink fou descriptionsDmitry Vyukov2018-03-211-0/+54
|
* executor: fix ifdef's for csourceDmitry Vyukov2018-03-071-2/+3
| | | | | | | 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.
* executor: fix includesDmitry Vyukov2018-03-051-1/+6
| | | | | | We use errno, vaargs, printf in all of fail/error/exitf, but we include the corresponding headers only when SYZ_USE_TMP_DIR. Include them whenever fail/error/exitf are used.
* sys/linux: add syz_init_net_socket syscallDmitry Vyukov2018-03-051-4/+48
| | | | | | | | | | | 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-22/+24
| | | | 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/+11
| | | | | | | | | | | 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).
* 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/+96
|
* executor: compile with -O2Dmitry Vyukov2018-02-101-10/+11
| | | | | We don't frequently debug it and it does some intensive computations on coverage, so no reason to not compile with -O2.
* 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/+149
|
* executor: handle old and new selinux mount pointsDmitry Vyukov2018-01-231-2/+5
|
* sys/linux: add netfilter descriptionsDmitry Vyukov2018-01-221-7/+8
| | | | Lots of TODOs and only ipv4, but some start.
* sys/linux: more selinux descriptionsDmitry Vyukov2018-01-181-1/+6
|
* executor: fix tun/device setup for sandbox=namespaceDmitry Vyukov2018-01-151-8/+27
| | | | | | | | 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/+48
| | | | | | 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.