aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host/host_linux.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/host: split files into syscalls/featuresDmitry Vyukov2019-11-161-574/+0
| | | | | pkg/host does 2 things: detects supported syscalls and supported features. There is enough code for each for a separate file.
* executor, pkg/host: update usb raw-gadget interfaceAndrey Konovalov2019-11-151-1/+1
| | | | The patches are being upstreamed and the interface has changed.
* executor, pkg/host, dashboard/config: rename usb-fuzzer to usb raw-gadgetAndrey Konovalov2019-11-041-1/+1
| | | | The interface is being upstreamed and the name has changed.
* executor: move fixed pci devlink handle into network namespaceJiri Pirko2019-11-031-0/+8
| | | | | | | | In case there is a fixed pci devlink handle "pci/pci/0000:00:10.0" on the system (initial network namespace), it is moved to a working network namespace. Signed-off-by: Jiri Pirko <jiri@mellanox.com>
* Change KCSAN info file to debugfsMarco Elver2019-10-081-1/+1
|
* executor, host, csource: Add support to enable KCSANMarco Elver2019-10-041-0/+8
| | | | | | | | | By default, the current KCSAN .config does not enable KCSAN during boot, since we encounter races during boot which would prevent syzkaller from ever executing. This adds support to detect if KCSAN is available, and enables it on the fuzzer host.
* pkg/host: fix linux netdevices detectionDmitry Vyukov2019-08-091-10/+2
| | | | We don't use ip command for netdevices and tun setup.
* sys/linux, executor: add syz_usb_ep_read syzkallAndrey Konovalov2019-07-011-1/+1
| | | | syz_usb_ep_read reads data from USB endpoints other than #0.
* pkg/host: improve openat checkmspecter2019-06-111-6/+20
| | | | | | | | | | | | | | | | * Add support for non-obvious open commands * Adding Michael Specter to CONTRIBUTORS * update * /pkg/host/host_linux.go: leverage .txt for OpenAt Allows users to specify OpenAt flags. Currently, Syzkaller will automatically attempt to open device nodes at startup, and ignore descriptions that do not exist. Unfortunately, Syzkaller only opens with read-only permissions, and some device drivers will return -EINVAL or likewise if the correct flags are not specified.
* pkg/host: enable evdev, hidraw and hiddev when USB fuzzing is onAndrey Konovalov2019-06-061-0/+12
|
* executor: implement support for leak checkingDmitry Vyukov2019-05-201-120/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Leak checking support was half done and did not really work. This is heavy-lifting to make it work. 1. Move leak/fault setup into executor. pkg/host was a wrong place for them because we need then in C repros too. The pkg/host periodic callback functionality did not work too, we need it in executor so that we can reuse it in C repros too. Remove setup/callback functions in pkg/host entirely. 2. Do leak setup/checking in C repros. The way leak checking is invoked is slightly different from fuzzer, but much better then no support at all. At least the checking code is shared. 3. Add Leak option to pkg/csource and -leak flag to syz-prog2c. 4. Don't enalbe leak checking in fuzzer while we are triaging initial corpus. It's toooo slow. 5. Fix pkg/repro to do something more sane for leak bugs. Few other minor fixes here and there.
* pkg/host: Add stat to kallsyms rename mapAndrew Donnellan2019-05-081-0/+1
| | | | | | | | | | On powerpc, the "stat" syscall is implemented by "sys_newstat" entry point. This causes a test failure as we can't find "sys_stat" in kallsyms. Add "stat" -> "newstat" to the kallsyms rename map to work around this. Closes: #1083 ("pkg/host: TestSupportedSyscalls fails on ppc64le") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
* all: add basic USB fuzzing supportAndrey Konovalov2019-04-111-0/+10
| | | | | | | | | | | | This commits implements 4 syzcalls: syz_usb_connect, syz_usb_io_control, syz_usb_ep_write and syz_usb_disconnect. Those syzcalls are used to emit USB packets through a custom GadgetFS-like interface (currently exposed at /sys/kernel/debug/usb-fuzzer), which requires special kernel patches. USB fuzzing support is quite basic, as it mostly covers only the USB device enumeration process. Even though the syz_usb_ep_write syzcall does allow to communicate with USB endpoints after the device has been enumerated, no coverage is collected from that code yet.
* pkg/host: enable kallsyms parsing on armCody Holliday2019-04-051-1/+1
| | | | pkg/host/host_linux.go: Add "arm" to kallsyms support test. pkg/host/host_test.go: TestKallsymsParse(): Add entry to test arm kallsyms parsing support.
* host: add kallsyms parsing testsAndrey Konovalov2019-04-041-18/+24
| | | | Start with a few simple tests that can be extended when needed.
* pkg/host: don't fail if CONFIG_FAIL_FUTEX is not enabledDmitry Vyukov2019-02-111-5/+8
| | | | | | See #991 and added comments. Fixes #991
* kcov: some fixes for extra coverageAndrey Konovalov2019-01-171-1/+1
| | | | | | Use PC tracing mode when detecting KCOV_REMOTE_ENABLE support in the kernel. Also fix kcov_remote_handle_usb argument.
* all: detect extra coverage supportAndrey Konovalov2019-01-161-6/+43
| | | | Based on whether the kernel supports KCOV_REMOTE_ENABLE ioctl.
* pkg/host: Support extracting kallsyms on ppc64leAndrew Donnellan2019-01-151-0/+2
| | | | | | | Add a regex for syscall symbol extraction on ppc64le. ppc64le doesn't have any special arch prefix. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
* fuzzer: fix syscall detectionAndrey Konovalov2019-01-081-2/+2
| | | | | As pointed out my Mark Rutland, kallsyms entries have format of __ia32_sys_${NAME} rather than __ia32_${NAME}. Fix the regexps.
* fuzzer: speed up syscall support detectionAndrey Konovalov2019-01-081-12/+31
| | | | | | | Right now syz-fuzzer does a search through /proc/kallsyms for each syscall to check whether it's supported. Do one search instead and save the results to a map. This speeds up syscall detection ~60 times when testing arm64 kernel on x86. Also add another search pattern for arm64 and add some logging.
* pkg/host: improve KMEMLEAK detectionDmitry Vyukov2018-10-101-7/+9
| | | | | | | | EBUSY is returned when KMEMLEAK is in fact turned off, not when scanning is already turned off. That can't be recovered. So instead check that we can write to the file in the check function and give useful diagnostics.
* pkg/host: improve KMEMLEAK supportDmitry Vyukov2018-09-281-27/+11
| | | | | | | | | | | Rewind kmemleak fd before reading it second time, otherwise we will read truncated reports. Auto-learn what leak reports we've already seen and ignore them in future. This is required because there are some false positives and some fire too frequently. So now we will hit each leak only once per manager run, but we still will try to reproduce them.
* RFC: android: Add support for untrusted_app sandboxing (#697)Zach Riggle2018-09-171-0/+8
| | | | | | | | | | | | | | | | | | | | | executor: add support for android_untrusted_app sandbox This adds a new sandbox type, 'android_untrusted_app', which restricts syz-executor to the privileges which are available to third-party applications, e.g. those installed from the Google Play store. In particular, this uses the UID space reserved for applications (instead of the 'setuid' sandbox, which uses the traditional 'nobody' user / 65534) as well as a set of groups which the Android-specific kernels are aware of, and finally ensures that the SELinux context is set appropriately. Dependencies on libselinux are avoided by manually implementing the few functions that are needed to change the context of the current process, and arbitrary files. The underlying mechanisms are relatively simple. Fixes google/syzkaller#643 Test: make presubmit Bug: http://b/112900774
* sys/linux: add syz_execute_funcDmitry Vyukov2018-08-301-0/+2
| | | | | | The function executes random code. Update #310
* sys/linux: add ext4 ioctls and overlayfsDmitry Vyukov2018-08-291-0/+4
| | | | Update #533
* gometalinter: strengthen gocyclo limitDmitry Vyukov2018-08-021-0/+4
| | | | | | Strengthen gocycle limit 35->24! Yay! No more jumbo functions! Fixes #538
* gometalinter: clean up some errcheck warningsDmitry Vyukov2018-08-021-4/+13
| | | | | | | Check some errors where relevant. Unfortunately enabling errcheck does not look feasible, too many warnings. Update #538
* pkg/host: add "network devices" featureDmitry Vyukov2018-07-131-0/+9
| | | | | | 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-17/+33
| | | | | Remove syz_fuse* and implement them as normal syscalls. We not have enough expressive power to form mount options.
* pkg/host: check that we can open files rather than that they existDmitry Vyukov2018-07-101-15/+19
| | | | | | | See issue #640 where /dev/net/tun is present, but open fails with ENODEV. Check that we can actually open all these files. Fixes #640
* pkg/host: more precise detection for syz_mount_image supportDmitry Vyukov2018-06-181-5/+22
|
* pkg/host: support trial supported syscall detectionDmitry Vyukov2018-06-181-13/+57
| | | | | Detect supported syscall by directly executing them if kallsyms is not present. This is required for gvisor testing.
* pkg/host: better detection of supported socketsDmitry Vyukov2018-06-181-2/+20
| | | | | Check socketpair. Check non-constant socket types.
* all: fix gometalinter warningsDmitry Vyukov2018-06-121-8/+15
|
* pkg/host: rework host feature detection/setupDmitry Vyukov2018-06-121-7/+228
| | | | | | | | | | Currently host feature detection/setup code is spread across platform-independent fuzzer code, pkg/host, pkg/ipc and executor. Move this all into pkg/host and show readable info about features on manager start. Fixes #46
* pkg/host: fix syz_mount_image detectionDmitry Vyukov2018-04-291-1/+1
| | | | Only init admin can mount filesystems with images.
* pkg/host: enable more fault injectionDmitry Vyukov2018-04-271-2/+11
|
* pkg/host: fix kallsyms names againDmitry Vyukov2018-04-191-1/+3
| | | | Some x86 syscalls now seem to be __x64_ and __ia32_ instead of sys_ or ksys_.
* pkg/host: fix kallsyms checkDmitry Vyukov2018-04-181-1/+2
| | | | | | Recent kernel changes to not call syscalls directly from kernel code renamed syscall symbols from sys_foo to ksys_foo. Support both formats.
* pkg/host: refactor codeDmitry Vyukov2018-04-081-26/+22
| | | | Fix warnings pointed out by gometalinter.
* pkg/host: explain why syscalls are disabledDmitry Vyukov2018-04-061-48/+79
|
* sys/linux: add support for reading partition tablesDmitry Vyukov2018-04-011-0/+2
|
* sys/linux: add support for mounting filesystem imagesDmitry Vyukov2018-03-301-0/+2
|
* sys/linux: add cgroup descriptionsDmitry Vyukov2018-03-251-1/+1
|
* sys/linux: add netlink fou descriptionsDmitry Vyukov2018-03-211-0/+7
|
* all: fix gometalinter warningsDmitry Vyukov2018-03-081-1/+1
| | | | Fix typos, non-canonical code, remove dead code, etc.
* sys/linux: add syz_init_net_socket syscallDmitry Vyukov2018-03-051-24/+23
| | | | | | | | | | | 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.
* sys: move test syscalls to a separate targetDmitry Vyukov2017-12-171-2/+0
| | | | | | We have them in linux solely for historical reasons. Fixes #462
* sys/linux: open files from /procDmitry Vyukov2017-11-271-0/+2
|