Commit Graph

875 Commits

Author SHA1 Message Date
Andrey Konovalov
c87d57e3e0 dashboard: update USB configs to the latest usb-linus
Also clean up config generation scripts a bit.
2019-05-29 15:56:43 +02:00
Dmitry Vyukov
2c7afa511c sys/targets: fix freebsd/386 executor build on some hosts
Add -B/usr/lib32 to 386 build flags.
The story behind -B/usr/lib32 is not completely clear, but it helps in some cases.
For context see discussion in https://github.com/google/syzkaller/pull/1202
2019-05-29 15:44:25 +02:00
Andrew Turner
5457ef3463 sys/freebsd: Add support for fuzzing FreeBSD/i386
Add support to fuzz 32 bit FreeBSD system calls.
2019-05-29 14:28:59 +02:00
Anton Lindqvist
85c573157d pkg/csource: add ability to annotate syscalls using comments in C reproducers
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;
  }
2019-05-24 22:33:56 +02:00
Pascal Perez
0625bb5c4c sys/fuchsia: Updating Fuchsia definitions
Simply

	make extract TARGETOS=fuchsia SOURCEDIR=<FUCHSIA_DIR>/fuchsia
2019-05-21 14:55:36 -07:00
Pascal Perez
77beeccbe0 sys: Updating Fuchsia extraction scripts
Consolidating FIDL library build mappings in one place, so that it can
be used from extraction, and script invoking fidlgen. This also makes
code clearer, and provides a more natural path for evolutions / dealing
with oddities.

Minor doc update post fx command changes.
2019-05-21 14:55:36 -07:00
Dmitry Vyukov
95dfd515a0 sys/linux: improve binder descriptions
Refine some consts to increase changes of correct programs.
Fix some types. Add comments and a test.
2019-05-17 11:56:54 +02:00
Dmitry Vyukov
7fb690f39a sys/linux: improve binder descriptions
Always pass 3 objects in a transaction.
This allows to specify correct offsets for objects.
Let's see if this improves coverage.
2019-05-16 19:19:25 +02:00
Dmitry Vyukov
b1165d81a4 sys/linux: use offsetof in ebtables
Resolve 2 TODOs in ebtables using the new offsetof type.
2019-05-16 18:26:31 +02:00
Dmitry Vyukov
76fc461b55 pkg/compiler: add offsetof type
Similar to C offsetof gives offset of a field
from the beginning of the parent struct.
We have several TODOs in descriptions asking for this.
2019-05-16 18:05:05 +02:00
Dmitry Vyukov
491919b14f pkg/compiler: work around 0-array-size errors due to missing consts
A const can be used as array size. Then if the const is not present
on all arches, compiler will produce an error about 0-sized-array.
There is no easy way to work around this for a user.
Use value of 1 for missing consts. It's just a bit safer.
2019-05-15 13:48:59 +02:00
Dmitry Vyukov
01d1494471 .golangci.yml: add codeanalysis build tag
Using a build tag to exclude files for golangci-lint
reduces memory consumption (it does not parse them).
The naive attempt with skip-dirs did not work.
So add codeanalysis build tag and use it in auto-generated files.

Update #977
2019-05-15 11:39:31 +02:00
Dmitry Vyukov
2e6300854a sys/linux: improve binder descriptions
Add few new ioctl's. Add some typedefs for clarity.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
c1caccc833 sys/linux: improve key and net_sch descriptions
Use the len paths to resolve pending TODOs.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
2376f0f937 pkg/compiler: allow to refer to syscall arguments in len paths
This allows to use len[syscall:arg] expressions.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
30e50d7959 sys/akaros: rename syscall argument
In preparation for making syscall a reserved name.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
cd3454ba97 sys/linux: improve btf descriptions
Now that we have the len path expressions we can fix the TODO
in btf descriptions to properly specify offsets of btf sections.

Also add proper descriptions for btf type section
and few other minor things around.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
93dcf0adc8 prog: implement complex len target support
This actually implements support for complex len targets
during program generation and mutation.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
16c881ad85 pkg/compiler: generate complex len targets
Change the generated format for len type to support multiple path elements.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
354b388e08 sys/test: remove a leftover file 2019-05-14 19:28:01 +02:00
Anton Lindqvist
ada3c44cd1 sys/openbsd: prevent changing mutability flags on files (#1174)
This is especially problematic for file descriptors referring to tty/pty
devices since it can cause the SSH connection to the VM to die.

The ambition here is reduce the number of "lost connection/no output" failures
at the cost of limiting the coverage of chflags(2).
2019-05-13 18:14:26 -07:00
Andrey Konovalov
7c305b440c dashboard: add scripts for generating USB kernel configs
This is done via a custom Kconfiglib based script, that allows to merge
in all USB configs from a provided one into the current. The script finds
and enabled all USB configs and their dependencies.
2019-05-13 17:10:34 +02:00
Dmitry Vyukov
000f08bb18 sys/linux: switch ppc64le to little-endian
make extract recently broke for powerpc on linux-next with:

include/uapi/linux/byteorder/big_endian.h:6:2: error: #error "Unsupported endianness, check your toolchain"
 #error "Unsupported endianness, check your toolchain"

Turns out we always built ppc64le headers as big-endian.
First, kernel was configured as BE.
Then, we used gcc to build an executable program for host
and on x86 gcc does not define __LITTLE_ENDIAN__ so kernel
thought that the toolchain is BE too.

Configure kernel as LE and define __LITTLE_ENDIAN__.

This actually changes values of some consts,
but fortunately just few of them.
2019-05-13 10:26:57 +02:00
Anton Lindqvist
5f302c04a2 sys/openbsd: add missing padding arguments
Due to missing padding arguments, stack garbage could end up being used as
actual arguments. More reading for the curious[1].

While here, add missing descriptions for pread and pwrite.

[1] https://flak.tedunangst.com/post/syzkaller-found-a-bug
2019-05-12 14:03:04 +02:00
Anton Lindqvist
c017728b48 sys/openbsd: avoid raw root disk node creation (#1171)
Writing to the raw root disk could lead to all kinds of corruptions[1].

[1] https://flak.tedunangst.com/post/syzkaller-found-a-bug
2019-05-11 13:10:47 -07:00
Dmitry Vyukov
46caad9460 sys/linux: add few new bpf consts 2019-05-10 15:39:27 +02:00
Dmitry Vyukov
16c44697b5 sys/linux: add definitions of fsopen, fspick, fsconfig, fsmount, move_mount syscalls 2019-05-10 15:21:16 +02:00
Dmitry Vyukov
cfeec85937 sys/linux: add new consts/flags/fields here and there
Add a bunch of new small interfaces in 5.2: new consts, flags, fields, etc.
2019-05-10 14:31:20 +02:00
Dmitry Vyukov
f5cecf2e32 sys/linux: add new fou attributes 2019-05-10 13:18:51 +02:00
Dmitry Vyukov
0a05e35530 sys/linux: add description of open_tree syscall 2019-05-10 13:13:46 +02:00
Dmitry Vyukov
4af714615a sys/linux: regenerate consts on the latest linux-next tree
Fuse version was bumped.
2019-05-10 13:06:50 +02:00
Dmitry Vyukov
c1718ecf4e sys/linux: fix alignment of cmsghdr_sock
All cmsg's must be intptr aligned within the array.
2019-05-10 13:05:04 +02:00
Kaipeng Zeng
c2aed7c7e3 sys/linux: update descriptions of sendmsg/sendmmsg
Fix the descriptions of cmsghdr.
Add sendmsg$sock and sendmmsg$sock for __sock_cmsg_send.
2019-05-10 13:00:44 +02:00
Anton Lindqvist
1852eb1814 sys/openbsd: add vmm descriptions (#1152)
Most probably limited to input validation for now. In the future, it
could be extended to provide a bootable kernel during vm create (/bsd)
and turn vmid into a proper resource.

The OpenBSD VMs on GCE does support vmm(4).
2019-05-01 19:30:36 -07:00
Michael Tuexen
7516d9fa93 sys/freebsd: add support for various network protocols
Add support for Ethernet, IPv4, ICMP, IPv6, ICMP6, TCP, and UDP.
This work is based on the corresponding Linux support.
2019-05-01 19:27:45 +02:00
Michael Tuexen
618456b4f4 sys/freebsd: include ioccom.h in pf.txt
This is needed for the IORW() macros.
2019-04-30 17:55:00 +02:00
Michael Tuexen
a46bda82a4 sys/syz-extract define GENOFFSET when processing FreeBSD sources
This avoids the inclusion of offset.inc files.
2019-04-30 17:55:00 +02:00
Kristof Provost
2398edeacc sys/freebsd: Add pf ioctl()s
Tweak the building of the FreeBSD vm image to ensure pf is loaded at
startup, so that we can test it.
2019-04-23 15:55:07 +02:00
Marco Vanotti
53199d6e8a Update syscalls (#1116)
* sys/fuchsia: update all syscalls.

This commit modifies all the existing syscalls definitions to match more
closely the documentation in the Fuchsia repo.

* run make extract && make generate
2019-04-22 11:08:29 -07:00
Dmitry Vyukov
c402d8f1aa sys/linux: add pidfd_send_signal 2019-04-12 18:26:28 +02:00
Dmitry Vyukov
c41e6ff180 sys/linux: more tty descriptions 2019-04-12 18:11:09 +02:00
Dmitry Vyukov
4f421599f9 sys/linux: add simple io_uring descriptions
We don't actually communicate with the uring yet,
but this already finds a bunch of bugs.
2019-04-12 16:19:23 +02:00
Andrey Konovalov
44841b9f9c all: run make generate 2019-04-11 16:24:45 +02:00
Andrey Konovalov
f4a3dc9128 all: add basic USB fuzzing support
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.
2019-04-11 16:24:45 +02:00
Andrey Konovalov
10e721ba92 sys: add USB descriptions
This commit adds syzkaller descriptions for USB fuzzing. The descriptions in
vusb.txt are written manually and cover different kinds of USB descriptors.
The descriptions in init_vusb_ids.go are generated automanitally by the
syz-usbgen tool and contain the vendor, device and some other IDs that
map to different USB drivers.
2019-04-11 16:24:45 +02:00
Anton Lindqvist
5701183bd3 sys/openbsd: add pci descriptions 2019-04-05 10:22:46 +02:00
Cody Holliday
e5d1b3ac44 sys/targets: fix arm target compiler prefix
sys/targets/targets.go: Change 'arm-linux-gnueabihf-' to 'arm-linux-gnueabi-' in the arm target since target ISA is armv6 and armhf is armv7+.
2019-04-04 14:57:50 +02:00
Marco Vanotti
4949990eea sys/fuchsia: Remove object_*_cookie syscalls. (#1099)
Those syscalls were removed from Zircon in a recent CL[0].

This commit runs make extract && make generate to update syscalls and
fidl interfaces.

[0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/249349
2019-04-03 15:30:56 -07:00
Dmitry Vyukov
162bd26be4 pkg/compiler: make buffer alias to ptr[array[int8]]
Ptr type has special handling of direction (pointers are always input).
But buffer type missed this special case all the time.
Make buffer less special by aliasing to the ptr[array[int8]] type.
As the result buffer type can't have optional trailing "opt" attribute
because we don't have such support for templates yet.
Change such cases to use ptr type directly.

Fixes #1097
2019-04-01 12:46:10 +02:00
Anton Lindqvist
3e1cf9ad8a executor: connect tun and bpf devices on OpenBSD 2019-04-01 12:39:02 +02:00