aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
Commit message (Collapse)AuthorAgeFilesLines
...
* sys/linux, executor: basic support for multiple USB interfacesAndrey Konovalov2019-09-061-15/+26
|
* executor: fix sigsegv for default USB string responseAndrey Konovalov2019-09-051-1/+1
|
* all: convert Fuchsia to use "host fuzzing" modeMatthew Dempsky2019-08-271-0/+2
| | | | | | | | | Go support is not a priority for Fuchsia at the moment, so it's preferable to use host fuzzing mode for Fuchsia like currently done for Akaros. This commit basically looks for all the places where there was special logic for OS=="akaros" and extends the same logic for OS=="fuchsia".
* sys/linux, executor: minor USB fixes (#1361)Andrey Konovalov2019-08-231-3/+6
|
* executor: fix procid not declared properly for netbsd (#1358)Andrey Konovalov2019-08-221-1/+1
|
* pkg/csource: fix failing syz-runtest for NetBSDSiddharth M2019-08-212-2/+3
| | | | | | * pkg/csource: fix failing syz-runtest for NetBSD * update common.go
* sys/linux: add basic USB CDC Ethernet descriptions (#1328)Andrey Konovalov2019-08-091-1/+1
|
* executer/common_bsd.h: increase the number of tap/tun devices for NetBSDR3x2019-08-081-0/+6
|
* executor: add some USB realted TODOs (#1319)Andrey Konovalov2019-08-071-1/+0
| | | Also simplify timeout related code a bit.
* pkg/csource: skip cross-builds that are doomed to failDmitry Vyukov2019-07-231-0/+4
| | | | | | | | | | | OpenBSD instance failed with: --- FAIL: TestSysTests (12.50s) --- FAIL: TestSysTests/linux/386 (0.16s) csource_test.go:145: failed to generate C source for ../../sys/linux/test/binder: cpp failed: exec: "cant-build-linux-on-openbsd": executable file not found in $PATH ... Skip unsupported cross-builds in TestSysTests.
* executor: drop CAP_SYS_NICEDmitry Vyukov2019-07-221-1/+1
| | | | | | | | | | A process with CAP_SYS_NICE can bring kernel down by asking for too high SCHED_DEADLINE priority, as the result rcu and other system services that use kernel threads will stop functioning. Some parameters for SCHED_DEADLINE should be OK, but we don't have means to enforce values of indirect syscall arguments. Peter Zijlstra proposed sysctl_deadline_period_{min,max} which could be used to enfore safe limits without droppping CAP_SYS_NICE, but we don't have it yet. See the following bug for details: https://groups.google.com/forum/#!topic/syzkaller-bugs/G6Wl_PKPIWI
* executor: drop CAP_SYS_PTRACE with sandbox=noneDmitry Vyukov2019-07-221-12/+22
| | | | | | We only drop CAP_SYS_PTRACE for sandbox=namespace, but it can equally affect testing with sandbox=none. Drop it for sandbox=none, add a test.
* pkg/csource: test sys/*/test programsDmitry Vyukov2019-07-221-11/+52
| | | | | | Running sys/*/test programs requires real machines and kernels for each OS. We can't do that in unit tests, but at least try to deserialize these programs so that they don't get rotten.
* sys/fuchsia: update zx_clock_get syscall (#1292)Marco Vanotti2019-07-161-1/+2
| | | | | | | | | | | | * sys/fuchsia: update zx_clock_get. zx_clock_get was deprecated and replaced by zx_clock_get_new. In a recent CL[0], they replaced the zx_clock_get by zx_clock_get_new and moved all client. This commit updates syzkaller to use the new function. [0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/298575 * run make extract && make generate
* sys/linux, executor: improve USB descriptionsAndrey Konovalov2019-07-161-6/+49
| | | | | 1. Change HID descriptions to allow devices to have two interrupt endpoints. 2. Remove unneeded responses to OUT control requests from descriptions. 3. Add some debugging code to detect and report missing descriptions.
* executor: add network packet injection for NetBSDSiddharth M2019-07-141-10/+14
| | | | | | | | | | | | * Initial Commit * working build of network packet fuzzing * Add missed csource file * pkg/csource: fix build * executor/common_bsd.h: Add comment stating reason for ifconfig create
* executor: fix out-of-bounds in USB fuzzing codeAndrey Konovalov2019-07-111-4/+8
| | | | | We might not have any string descriptors provided at all, use a hardcoded string in this case.
* executor: update USB fuzzing code to use new kernel APIAndrey Konovalov2019-07-111-42/+68
| | | | | The kernel API has changed and now differentiates between IN and OUT control requests.
* executor: make errors during thread creation exit zeroAnton Lindqvist2019-07-041-2/+2
| | | | | | | | | | | | | On OpenBSD, the executor sometimes manages to set the memory resource limit 0 causing any following memory allocation to fail. Since threads are potentially created from such a thread which cannot allocate any memory, the executor will exit non-zero which in turn will cause false-positive panics to be reported. For more info see the discussion[1] in PR #1243. Instead, if hitting a fatal error during thread creation exit zero. [1] https://github.com/google/syzkaller/pull/1243
* sys/linux, executor: run make extract and generateAndrey Konovalov2019-07-011-19/+71
|
* sys/linux, executor: add syz_usb_ep_read syzkallAndrey Konovalov2019-07-011-2/+4
| | | | syz_usb_ep_read reads data from USB endpoints other than #0.
* sys/linux, executor: run make extract and generateAndrey Konovalov2019-06-241-30/+72
|
* sys/linux, executor: add basic USB HID fuzzing supportAndrey Konovalov2019-06-241-0/+1
| | | | | This commit adds the necessary descriptions and executor adjustments to enable targeted fuzzing of the enumeration process of USB HID devices.
* pkg/csource: generate timeouts for USB syzcallsAndrey Konovalov2019-05-312-1/+13
| | | | This patch only covers per call timeouts, per prog one is not adjusted yet.
* pkg/csource: add ability to annotate syscalls using comments in C reproducersAnton Lindqvist2019-05-241-1/+6
| | | | | | | | | | | | | | | | | | | | | Providing additional info, especially regarding syscall arguments, in reproducers can be helpful. An example is device numbers passed to mknod(2). This commit introduces an optional annotate function on a per target basis. Example for the OpenBSD target: $ cat prog.in mknod(0x0, 0x0, 0x4503) getpid() $ syz-prog2c -prog prog.in int main(void) { syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0, 0); syscall(SYS_mknod, 0, 0, 0x4503); /* major = 69, minor = 3 */ syscall(SYS_getpid); return 0; }
* executor: exit after first detected leak in C reprosDmitry Vyukov2019-05-211-6/+0
| | | | Otherwise C repros print infinite stream of the same leaks again and again.
* executor: implement support for leak checkingDmitry Vyukov2019-05-204-38/+165
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Makefile: enable 386 executor build in presubmitDmitry Vyukov2019-05-071-5/+0
| | | | This hacky way to install 386 packages seems to unbreak executor build.
* Makefile: enable arm executor build in presubmitDmitry Vyukov2019-05-071-6/+0
| | | | arm build seems to work now on Travis since we switched to xenial.
* executor: change syscall argument type to intptr_tmunjinoo2019-05-071-9/+9
| | | | | The type size of long depends on compiler. Therefore, changing to intptr_t makes it depends on architecture.
* executor: unbreak on OpenBSD at runtimeAnton Lindqvist2019-05-021-0/+4
| | | | | | | | Not using `elif GOOS_freebsd' since it could cause breakage on other *BSDs due to unused variables. Regression introduced in commit c7c3f772 (executor: improve setup for packet handling on *BSD).
* executor: improve setup for packet handling on *BSD (#1153)Michael Tüxen2019-05-011-1/+20
| | | | | | | | Improve the handling of packets by: * setting the local MAC address. * configuring the local IPv4 address with prefix /24. * adding an entry in the arp cache for the remote IPv4 address. * adding an entry in the IPv6 neighbour cache for the remote IPv6 address.
* executor: fix another compiler warningAndrey Konovalov2019-04-251-1/+1
|
* executor: fix compiler warningAndrey Konovalov2019-04-241-2/+2
|
* executor: use NONFAILING in common_usb.hAndrey Konovalov2019-04-231-105/+130
| | | | Also move some code to helper functions.
* executor: adjust waiting time for all usb syzcallsAndrey Konovalov2019-04-231-2/+0
| | | | | | Allow 2000 ms of waiting time for syz_usb_connect and and the same time for the whole program is this syzkall is present. Allow 200 ms of waiting time for syz_usb_disconnect. Remove sleep from syz_usb_control_io.
* all: fix some static analysis warningsDmitry Vyukov2019-04-231-18/+18
| | | | | | Fix warnings produced by golangci-lint. Update #977
* all: run make generateAndrey Konovalov2019-04-111-2/+463
|
* all: add basic USB fuzzing supportAndrey Konovalov2019-04-111-0/+1
| | | | | | | | | | | | 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.
* all: add optional close_fds feature to reproducersAndrey Konovalov2019-04-094-12/+47
| | | | | | | | Instead of always closing open fds (number 3 to 30) after each program, add an options called EnableCloseFds. It can be passed to syz-execprog, syz-prog2c and syz-stress via the -enable and -disable flags. Set the default value to true. Also minimize C repros over it, except for when repeat is enabled.
* csource: use /*FOO*/ instead of [[FOO]]Andrey Konovalov2019-04-092-10/+11
| | | | The latter differently confuses different versions of clang-format.
* executor: move syz_execute_func after os imports. (#1107)Marco Vanotti2019-04-031-14/+14
| | | | | | | | | | | | | | | | | This commit moves the definition of the `syz_execute_func` after the block of code that imports all the OS specific common headers. This is required because after commit dfd3394d42ddd333c68cf355273b312da8c65a51 `syz_execute_func` started using the `NONFAILING` macro, which is defined in those header files for each OS. I also ran `make generate`. TEST=I only tested that the executor works for Fuchsia with: ```shell $ make executor TARGETOS=fuchsia TARGETARCH=amd64 SOURCEDIR=~/fuchsia ```
* executor: don't fallthrough in switches in fuchsia (#1103)Marco Vanotti2019-04-031-0/+3
| | | | | | This commit modifies the common_fuchsia.h file changing the behavior of the `syz_future_time function`. Before, the function used to have a switch case that would fallthrough, making it always set the delta_ms to 10000. The fix is to add a `break;` statement after each switch case.
* executor: try to prevent machine outbreakDmitry Vyukov2019-04-021-1/+7
| | | | | | | | | The fuzzer gained control over host machines again with something like: syz_execute_func(&(0x7f00000000c0)="c4827d5a6e0d5e57c3c3b7d95a91914e424a2664f0ff065b460f343030062e67660f50e900004681e400000100440fe531feabc4aba39d6c450754ddea420fae9972b571112d02") Let's see if perturbing syz_execute_func a bit and wiping registers will stop the outbreak.
* all: fix warnings pointed to by golangci-lintDmitry Vyukov2019-03-281-1/+1
| | | | Update #977
* pkg/csource: allow to ignore warnings during buildDmitry Vyukov2019-03-211-3/+14
| | | | | | | | | | | | | | | Running bisection using an older repro failed with: <stdin>: In function ‘syz_mount_image.constprop’: <stdin>:298:3: error: argument 1 null where non-null expected [-Werror=nonnull] In file included from <stdin>:26:0: /usr/include/x86_64-linux-gnu/sys/stat.h:320:12: note: in a call to function ‘mkdir’ declared here extern int mkdir (const char *__path, __mode_t __mode) Let's be safe and ignore warnings during repro/bisect. Everything that runs during tests still has all warnings. Update #501
* executor: prevent non-null expected warningsDmitry Vyukov2019-03-212-23/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | The added test triggers warnings like these: <stdin>: In function ‘syz_mount_image.constprop’: <stdin>:298:3: error: argument 1 null where non-null expected [-Werror=nonnull] In file included from <stdin>:26:0: /usr/include/x86_64-linux-gnu/sys/stat.h:320:12: note: in a call to function ‘mkdir’ declared here extern int mkdir (const char *__path, __mode_t __mode) ^~~~~ cc1: all warnings being treated as errors <stdin>: In function ‘syz_open_procfs.constprop’: <stdin>:530:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ <stdin>:532:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ <stdin>:534:41: error: ‘%s’ directive argument is null [-Werror=format-truncation=] <stdin>:85:110: note: in definition of macro ‘NONFAILING’ Use volatile for all arguments of syz_ functions to prevent compiler from treating the arguments as constants in reproducers. Popped up during bisection that used a repro that previously worked. Update #501
* executor: update fdio import pathMarco Vanotti2019-03-201-1/+1
| | | | | | | | | | | The Fuchsia team is going to remove the `lib/fdio/util.h` library. They have already moved all the functions to new header files. I have seen that fuchsia uses `fdio_service_connect`, which has been moved to the `lib/fdio/directory.h` header file. This commit just changes the import path in the fuchsia executor, and in the corresponding generated go file (I made that change by running `make generate`).
* pkg/runtest: make tests pass on freebsdDmitry Vyukov2019-03-073-1/+5
| | | | | | The problem is stupid: <endian.h> should be included as <sys/endian.h> on freebsd. Pass actual host OS to executor build as HOSTGOOS and use it to figure out how we should include this header.
* pkg/csource: sort sys/types.h to the top on FreeBSDMark Johnston2019-03-073-4/+11
| | | | | sys/types.h is a special header that is required by many other system headers on FreeBSD.