Commit Graph

1187 Commits

Author SHA1 Message Date
Hangbin Liu
b1f951e1e4 sys/linux/socket_netlink_route_sched: fix tcm_info structure
Update #533

Don't know why I didn't add tcm__pad in tcm_info structure
at the begining. But let's fix it now.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2019-10-24 09:30:50 +02:00
Hangbin Liu
910e03ca15 sys/linux/socket_netlink_route_sched: add chain actions
Update #533

Chain actions also use filter policies, so we can add them easily.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2019-10-24 09:30:50 +02:00
Andrey Konovalov
a970258ea5 dashboard/config: better extract usb configs
When generating a USB config, disable USB symbols that are disabled in the
base config, as they might have been enabled when some of the dependecies
got enabled.
2019-10-23 10:13:19 +02:00
Andrey Konovalov
6901a56e00 executor/usb: enable endpoints on SET_INTERFACE
This commit changes syz_usb_control_io to enable the relevant endpoints
for the interface being set via a SET_INTERFACE request.
2019-10-21 15:56:03 +02:00
Andrey Konovalov
8c88c9c1c9 sys/linux/vusb.txt: add some TODOs 2019-10-16 18:28:52 +02:00
Dmitry Vyukov
d4ea592f78 sys/linux: add some new flags
Add a few new assorted things, some flags, etc.
2019-10-15 14:13:41 +02:00
Dmitry Vyukov
2b7a4c5e69 sys/linux: add exfat descriptions 2019-10-15 13:50:06 +02:00
Dmitry Vyukov
6078bcf4f9 sys/linux: add watch_queue descriptions 2019-10-15 13:50:06 +02:00
Andrey Konovalov
323ca50263 sys/linux/vusb.txt: describe UAC1 device class 2019-10-15 13:08:30 +02:00
Andrey Konovalov
05ad729222 dashboard/config: update USB config 2019-10-14 14:14:06 +02:00
Veronica Radu
1a3bad9041 prog: mutate length of output buffers
Update #480
2019-10-10 14:37:42 +02:00
Andrew Donnellan
d52eff2843 sys/targets: Disable PIE/ASLR when building tests
Due to issues with ASLR + ASan on ppc64le (see #1446), add the -no-pie
flag to the test target so tests will pass.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-10-10 10:21:51 +02:00
Eric Biggers
312c6a5a73 sys/linux/init_alg.go: add new algorithms
- Add essiv (new in v5.4)
- Add xxhash64 (new in v5.3)
2019-10-09 09:06:58 +02:00
Dmitry Vyukov
2ab6c4a457 sys/linux: improve i2c descriptions a bit 2019-10-08 16:06:26 +02:00
Andrey Konovalov
b7a87a83f8 dashboard, sys/linux: update USB configs 2019-10-01 14:00:17 +02:00
Veronica Radu
9d33246a91 sys/linux: add new syscall descriptions for devio and usbmon
Update #533
2019-10-01 13:55:20 +02:00
Eric Biggers
c7a4fb9986 sys/linux/dev_binder.txt: also support real-world binder device names
It was reported that binder isn't covered when using syzkaller on a real
Android device, since the binder device names are different.  Update the
descriptions to know about the real-world device names too.
2019-09-30 12:36:26 +02:00
Dmitry Vyukov
d8074e0bb9 sys/linux: add new pidfd syscalls 2019-09-27 13:35:42 +02:00
Andrey Konovalov
38634e3316 sys/linux: add more USB runtests 2019-09-24 16:42:10 +02:00
Andrey Konovalov
c9f1048063 sys/linux: add USB hiddev runtest 2019-09-24 10:45:51 +02:00
Paul Chaignon
a32a318486 sys/linux: update BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-09-19 15:31:20 +02:00
Eric Biggers
eb9400440d sys/linux: re-generate Linux descriptions from next-20190918 2019-09-19 09:38:51 +02:00
Eric Biggers
a4e87d4bb6 sys/linux: update fscrypt descriptions
- For v5.4: new ioctls FS_IOC_ADD_ENCRYPTION_KEY,
  FS_IOC_REMOVE_ENCRYPTION_KEY, FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS,
  FS_IOC_GET_ENCRYPTION_KEY_STATUS, and FS_IOC_GET_ENCRYPTION_POLICY_EX.

- For v5.4: FS_IOC_SET_ENCRYPTION_POLICY now accepts an
  fscrypt_policy_v2 argument in addition to the original fscrypt_policy
  which is now called fscrypt_policy_v1.

- For v5.4: the fscrypt definitions were moved to a new header
  <linux/fscrypt.h>, and some constants were given new FSCRYPT_* names
  instead of FS_*.  Handle this, and to keep things organized similarly
  move the syzkaller descriptions to a new file fscrypt.txt.

- For v5.0: remove the removed Speck modes and add Adiantum.

- For v5.0: add the DIRECT_KEY encryption policy flag.

Also fix the argument types for FS_IOC_GET_ENCRYPTION_POLICY and
FS_IOC_GET_ENCRYPTION_PWSALT, which had been mixed up.
2019-09-19 09:38:51 +02:00
Eric Biggers
6aa8d1eb8f sys/syz-extract: re-enable extraction for fsverity.txt
fsverity is now upstream, so re-enable extracting its consts.
2019-09-19 09:38:51 +02:00
Andrey Konovalov
14d4158490 sys/targets: add ASAN compiler flag to optional
*BSD GCC doesn't have ASAN.
2019-09-18 14:02:33 +02:00
Paul Chaignon
c2dcd7009f sys/linux: update BPF's anonymous structures
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-09-18 06:50:02 +02:00
Paul Chaignon
03e0d24559 sys/linux: basic support for bpf-to-bpf function calls
The BPF template currently only defines helper calls.  BPF function calls
(bpf-to-bpf calls) are however supported in Linux since v4.16.

This patch defines bpf-to-bpf calls in the template.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-09-17 20:38:59 +02:00
Andrey Konovalov
e9b387d18c sys/targets: build executor with ASAN for test target 2019-09-17 15:10:25 +02:00
Paul Chaignon
c9364a4648 sys/linux: support for loopkup-free map value accesses
A new BPF instruction that allows lookup-free map value accesses was added
in Linux v5.2, with commit d8eca5b ("bpf: implement lookup-free direct
value access for maps").  It enables direct access to map values without
having to call a BPF helper.  It is currently used to implement global
variable support.

This commit adds support for that new instruction.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-09-17 14:41:41 +02:00
Michael Tuexen
cb93629971 sys/freebsd/sys.txt: update sendfile description
The signature of sendfile() on FreeBSD is different from the one
used on Linux.
2019-09-16 10:39:16 +02:00
Michael Tüxen
55c50e708b
sys/freebsd/vnet.txt: replace IPPROTO_SEP by IPPROTO_DCCP (#1401)
r350749 updated the constant from IPPROTO_SEP to IPPROTO_DCCP
to be consistent with the IANA registry.
2019-09-16 09:51:17 +02:00
Andrey Konovalov
a381ceb297 sys/linux/usb: fix CDC mac address encoding 2019-09-06 20:11:54 +02:00
Andrey Konovalov
35d270e58c sys/linux/usb: always provide device string ids
This forces the kernel to make a USB string request and select a lang ID
early during the enumaration stage.
2019-09-06 20:11:54 +02:00
Andrey Konovalov
4280382fb9 sys/linux/vusb.txt: properly describe interfaces for USB CDC NCM
Also rename cdc_ethernet to cdc_ecm.
2019-09-06 17:19:55 +02:00
Andrey Konovalov
a38da1b89a sys/linux, executor: basic support for multiple USB interfaces 2019-09-06 17:19:55 +02:00
Andrey Konovalov
bf6bcce4f2 sys/linux/vusb.txt: fix typo in descriptions 2019-09-05 16:28:13 +02:00
Andrey Konovalov
d994512dff sys/linux, dashboard: update USB config 2019-09-04 13:09:49 +02:00
Veronica Radu
5de425bc59 prog: implemented argument and call priorities 2019-09-04 10:46:46 +02:00
Andrey Konovalov
12381952e3 sys/linux/vusb.txt: fix unused EPSNUM param 2019-09-04 07:10:15 +02:00
Andrey Konovalov
78ded1969a
sys/linux, executor: minor USB fixes (#1361) 2019-08-23 14:50:37 +02:00
Andrey Konovalov
ca6f3cfa78
sys/linux: fix bNumEndpoints in a USB interface (#1360)
bNumEndpoints is defined as len[endpoints]. This initially assumed that
endpoints is an array, which is not the case for descriptions for
particular USB classes. Improve it by defining a new template for interfaces
and passing in a value range for bNumEndpoints for these cases.
2019-08-22 19:53:52 +02:00
Matthew Dempsky
cfc9868f25 sys/targets: fix Fuchsia builds
https://fuchsia-review.googlesource.com/c/fuchsia/+/310006 added new
dependencies to the Fuchsia DDK, which in turn introduced new include
directories that syzkaller needs to specify when building executor.
2019-08-19 15:02:45 -07:00
Marco Vanotti
55bf892687 sys/targets: Change CCompiler path for fuchsia.
Recently fuchsia got rid of the buildtools/ folder, and moved some of
the stuff into the prebuilt directory.

See https://fuchsia-review.googlesource.com/c/fuchsia/+/305379 for more
info.
2019-08-17 06:58:15 -07:00
Andrey Konovalov
0d298d6b2e
sys/linux: add basic USB CDC NCM descriptions (#1337)
CDC NCM support is incomplete, as it requires support for describing multiples
interfaces per configuration.
2019-08-14 21:05:27 +02:00
Andrey Konovalov
27bd5400c8
sys/linux: fix USB string descriptors (#1336)
They should either contain a lang id or a string.

Do some other minor fixes as well.
2019-08-14 18:25:24 +02:00
Marco Vanotti
770d4e1bc7 sys/fuchsia: update socket syscalls 2019-08-14 09:34:25 +02:00
Anton Lindqvist
8620c2c258 sys/openbsd: add ktrace description 2019-08-12 11:16:16 +02:00
Anton Lindqvist
e44fc68a53 sys/openbsd: add acct description 2019-08-12 11:16:16 +02:00
Anton Lindqvist
62d3ec4876 sys/openbsd: add speaker descriptions 2019-08-12 11:16:16 +02:00
Andrey Konovalov
acb5163814
sys/linux: add basic USB CDC Ethernet descriptions (#1328) 2019-08-09 19:46:27 +02:00
Dmitry Vyukov
1ecb069f0e sys/targets: fix build on darwin
Currently build on darwin crashes when we try to access host.CCompiler/CPP
(there is no darwin target). Check that we have the host target before using it,
otherwise use default gcc/cpp.
2019-08-09 18:05:51 +02:00
Veronica Radu
aff9e255cd prog: add special mutation for binary flags 2019-08-09 15:02:02 +02:00
Andrey Konovalov
d545e945ce sys/linux: add syz_open_dev$char_usb descriptions
syz_open_dev$char_usb opens char devices with major = USB_MAJOR.
Sanitize its values to make sure it doesn't open other char/block devices.
2019-08-08 15:34:27 +02:00
Andrey Konovalov
cdde748628
sys/linux: add basic USB PRINTER descriptions (#1316)
Also put USB HID descriptions together.
2019-08-06 18:26:57 +02:00
Andrey Konovalov
bac5ccb8fb
sys/linux: import HID report descriptor descriptions (#1311)
Remove long items and better specify tags.
2019-08-02 19:17:30 +02:00
Andrey Konovalov
3faab80738
dashboard, sys/linux: extract more HID USB configs (#1310)
Some USB drivers don't depend on core USB symbols, but rather depend on a
generic symbol for some input subsystem (e.g. HID). Account for that when
extracting USB configs.
2019-08-02 18:26:44 +02:00
Hangbin Liu
f28bf2a5db sys/linux/socket.txt: update timestamp options
Update socket timeval, timestamp options and flags.

v2: separate SO_{TIMESTAMP, TIMESTAMPNS}_{OLD, NEW} as they only need
enable/disable option value.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2019-07-30 09:28:49 +02:00
Dmitry Vyukov
cf49ed5769 prog: don't minimize ProcType to 0
Default value for ProcType is 0 (same for all PID's).
Usually 0 either does not make sense at all or make different PIDs collide
(since we use ProcType to separate value ranges for different PIDs).
So don't change ProcType to 0 unless the type is explicitly marked as opt
(in that case we will also generate 0 anyway).
2019-07-26 10:29:36 +02:00
VeronicaRadu
091bb0070f sys/linux: add usbmon add vfio descriptions 2019-07-26 09:07:19 +02:00
Andrey Konovalov
32329ceb4b sys/linux: fix USB runtest 2019-07-24 10:38:36 +02:00
Andrey Konovalov
55e0c07757
sys/linux: extract USB HID ids (#1294)
* sys/linux: extract USB HID ids

As it turns out the HID kernel subsystem registers only one USB driver that
checks that the interface of the connected device has HID class and then looks
up its own list of vendor/device ids to find a matching driver. This means
that we currently don't generate proper vendor/device ids for USB HID devices.

This patch updates the syz-usbgen tool to also extract USB HID vendor/device
ids from a running kernel and makes the generated descriptions for HID devices
to be patched using the extracted ids.

This patch also contains some minor improvements to USB descriptions
(better HID descriptions and more replies for some USB classes/drivers).

* sys/linux: run make generate
2019-07-22 19:25:54 +02:00
Dmitry Vyukov
6a786da97c sys/linux: use AT_FDCWD only for directories
Currently we use AT_FDCWD as a special value for all file descriptors,
but it does not make sense for almost all of them (sockets, bpf, etc).
Use it as a special value only for fd_dir.
2019-07-22 13:05:39 +02:00
Dmitry Vyukov
f3ad684464 executor: drop CAP_SYS_NICE
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
2019-07-22 11:59:00 +02:00
Dmitry Vyukov
be348f6db3 sys/linux: improve sched_attr description
Today we have means to properly describe parent size.
2019-07-22 11:51:58 +02:00
Dmitry Vyukov
5181b54d45 executor: drop CAP_SYS_PTRACE with sandbox=none
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.
2019-07-22 11:51:53 +02:00
Dmitry Vyukov
e530ec1bef pkg/csource: test sys/*/test programs
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.
2019-07-22 10:20:51 +02:00
Anton Lindqvist
919efc620a sys/openbsd: prevent swap partition device nodes from being created
Writing to the swap partition during fuzzing can lead to all kinds of
corruptions[1].

[1] https://syzkaller.appspot.com/bug?id=a2eca15e6e0be4be3ed1b0b2bab3332edc317b1c
2019-07-22 07:36:41 +02:00
Marco Vanotti
0d10349cf0
sys/fuchsia: update zx_clock_get syscall (#1292)
* 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
2019-07-16 17:09:43 -07:00
Dmitry Vyukov
96b8132aaf sys/syz-extract: fix too long line 2019-07-16 16:34:29 +02:00
Marco Vanotti
d6d32e566b run make extract and make generate for fuchsia 2019-07-16 16:34:29 +02:00
Marco Vanotti
d862d22d79 sys/fuchsia: remove RESIZEABLE flags from vmo ops.
This change removes the ZX_VMO_NON_RESIZABLE flag for vmo create and the
ZX_VMO_CHILD_NON_RESIZEABLE flag from vmo create child.

The flags were removed upstream in cl:
https://fuchsia-review.googlesource.com/c/fuchsia/+/293991
2019-07-16 16:34:29 +02:00
Marco Vanotti
6aad7497a8 sys/syz-extract: Add "DefineGlibcUse" flag.
Instead of defining the __GLIBC_USE macro on every OS, we are just
defining it based on a parameter. That parameter is set to false for all
OSs except for fuchsia.
2019-07-16 16:34:29 +02:00
Marco Vanotti
75b7c614dd sys/fuchsia: rename vmo_clone to vmo_create_child.
This commit modifies the vmo_clone definition, renaming it to
vmo_create_child. This change happened in fuchsia a few weeks ago[0].

[0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/272268/
2019-07-16 16:34:29 +02:00
Marco Vanotti
1472562444 sys/syz-extract: define __GLIBC_USE if not defined.
When I try to run `make extract` for fuchsia, the clang compiler
complains that __GLIBC_USE is undefined.

This CL just defines it to be an always false function-like macro if it
was not defined.
2019-07-16 16:34:29 +02:00
Marco Vanotti
de59bed3f8 sys/fuchsia: update paths for fdio and driver libs.
This commit updates the targets for fuchsia, modifying the clang flags
so that it uses the correct path to link against libfdio and libdriver.
2019-07-16 16:34:29 +02:00
Marco Vanotti
48bc210db4 sys/fuchsia: remove power fidl definitions.
This commit removes the fuchsia-power fidl definitions. The interface
doesn't have a service implementing it in fuchsia, and it is causing
issues in make extract.
2019-07-16 16:34:29 +02:00
Andrey Konovalov
e2b11c0ada dashboard: fix usb config extraction script
Fix extracting more configs that are actually enabled.
Regenerate upsteam-usb.config and sys/linux/init_vusb_ids.go.
2019-07-16 15:02:36 +02:00
Andrey Konovalov
6bc0be8b21
sys/linux, executor: improve USB descriptions
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.
2019-07-16 13:07:56 +02:00
Eric Biggers
f27c4411ef sys/linux: update fs-verity descriptions
The fs-verity API was redesigned, and we're planning to re-add the
fs-verity patches to linux-next soon.  Get the syzkaller descriptions up
to date with the new API [1]

[1] https://lkml.kernel.org/linux-fsdevel/20190701153237.1777-4-ebiggers@kernel.org
2019-07-16 12:10:18 +02:00
Paul Chaignon
36835e4e11 sys/linux: update BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-07-16 11:38:43 +02:00
Eric Biggers
84d08cdf2d sys/linux: update for v5.3 again
Update descriptions to be compatible with latest linux-next
(next-20190715), which in theory will match v5.3-rc1 when the merge
window closes.

- KEYCTL_GRANT_PERMISSION was reverted.  So remove its description.

- CRYPTO_ALG_TYPE_DIGEST was removed.  So remove its description.

- IB_QP_CREATE_SIGNATURE_EN was renamed to IB_QP_CREATE_INTEGRITY_EN.

Also remove the sys/linux/rdma_*.const files which were incorrectly
checked into git.  The real copies of those files are in
sys/linux/dev_infiniband_rdma_*.const.

For now I did *not* check for other new APIs that need to be described.
2019-07-16 10:08:43 +02:00
Eric Biggers
139ac68a73 sys/linux: update key descriptions
- Add KEYCTL_MOVE (new in v5.3)
- Add KEYCTL_CAPABILITIES (new in v5.3)
- Add KEYCTL_GRANT_PERMISSION (new in v5.3)
- Remove KEY_PERM_UNDEF (was only ever in an internal kernel header,
  not in UAPI; removed in v5.3)
2019-07-15 13:44:02 +03:00
Siddharth M
2bbe2f0558 executor: add network packet injection for NetBSD
* 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
2019-07-14 17:59:29 +03:00
Anton Lindqvist
ff7bf04c7c sys/openbsd: add diskmap descriptions 2019-07-10 22:37:39 +02:00
Denis Efremov
a0626693a0 sys/linux: fix floppy description
* sys/linux: fix floppy description

Fix typo in the FDGETPRM ioctl.

* sys/linux: extract && generate for floppy

Signed-off-by: Denis Efremov <efremov@linux.com>
2019-07-05 09:16:10 +02:00
Andrey Konovalov
cccc4302d7 sys/linux, executor: run make extract and generate 2019-07-01 17:26:35 +02:00
Andrey Konovalov
13c3a99962 sys/linux, executor: add syz_usb_ep_read syzkall
syz_usb_ep_read reads data from USB endpoints other than #0.
2019-07-01 17:26:35 +02:00
Siddharth M
907bf74686 sys/netbsd: Adding more syscalls
* sys/netbsd: Adding more syscalls

* Added lwp create structures

* Added a few lwp flags

* completed _lwp* syscalls

* add clone syscall

* fix errors, recheck arguments
2019-07-01 12:37:45 +02:00
Anton Lindqvist
699d6448c8 sys/openbsd: add missing WSDISPLAYIO_SBURNER ioctl command 2019-06-30 20:34:23 +02:00
Hangbin Liu
c2c0d4d6ae sys/linux: update mpls_lable and rta types
Kernel get mpls lable like
```
unsigned entry = be32_to_cpu(hdr->label_stack_entry);
result.label = (entry & MPLS_LS_LABEL_MASK) >> MPLS_LS_LABEL_SHIFT;
```
So we just need to store the label in big endian order.

For mpls rta types, kernel accpet only one lable for RTA_DST and
multi labels for RTA_NEWDST.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2019-06-26 16:34:37 +02:00
R3x
c0d1d69763 sys/netbsd: Add new syscalls exit and ptrace 2019-06-26 11:18:16 +02:00
Andrey Konovalov
82c13b6b49 sys/linux, executor: run make extract and generate 2019-06-24 17:24:44 +02:00
Andrey Konovalov
fa26c3cf35 sys/linux, executor: add basic USB HID fuzzing support
This commit adds the necessary descriptions and executor adjustments to
enable targeted fuzzing of the enumeration process of USB HID devices.
2019-06-24 17:24:44 +02:00
Paul Chaignon
3efccdd201 sys/linux: update BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-06-23 13:17:12 +02:00
Michael Tuexen
b39edb92c6 sys/freebsd: fix sockaddr structures
FreeBSD uses in sockaddr_{in,in6,un} structures a length field.
2019-06-23 13:16:30 +02:00
Anton Lindqvist
efb619c0e4 sys/openbsd: correct setrlimit resource detection
The sanitizer fails to sanitize programs like the following:

  setrlimit(0x10000000000002, &(0x7f0000000080))

... due to presence of the most significant bit. Therefore mask of all
bits that cannot form a valid rlimit resource.

This is one of the root causes of the high amount of reported "lost
connection to test machine".
2019-06-18 16:28:55 +02:00
Anton Lindqvist
442206d76b sys/openbsd: sanitize mlockall syscalls
Locking down future mappings will most likely cause syz-executor to run
out of memory.

This is one of the root causes of the high amount of reported "lost
connection to test machine".
2019-06-14 18:34:50 +02:00
Anton Lindqvist
998ccc760b sys/openbsd: rename test case 2019-06-13 18:51:26 +02:00
Anton Lindqvist
dad7ee745f sys/openbsd: sanitize setrlimit(RLIMIT_STACK) syscalls
Do not allow the stack to grow beyond the initial soft limit chosen by
syz-executor. Otherwise, syz-executor will most likely not be able to
perform any more heap allocations since they majoriy of memory is
reserved for the stack.

This is one of the root causes of the high amount of reported "lost
connection to test machine".
2019-06-13 18:51:26 +02:00
Andrey Konovalov
5a3f55c869 sys/linux: run make extract and generate
Forgot to do it after the last changes in hiddev descriptions.
Fuse is also updated.
2019-06-12 15:26:04 +02:00
Anton Lindqvist
794a1ad73a sys/openbsd: sanitize setrlimit(RLIMIT_DATA) syscalls (#1231)
OpenBSD performs a strict validation of the RLIMIT_DATA soft limit
during memory allocation. Lowering the same limit could cause
syz-executor to run out of memory quickly. Therefore make sure to not go
lower than the default soft limit for the staff group.

This is one of the root causes of the high amount of reported "lost
connection to test machine".
2019-06-11 16:50:14 -07:00
Anton Lindqvist
0159583c3b sys/openbsd: prevent using vio0 as a virtual multicast interface
One of the root causes to reported "lost connection to test machine" is
when the egress network interface is being used as a multicast
interface:

  setsockopt$inet6_MRT6_ADD_MIF(r0, 0x29, 0x66, &(0x7f0000000180)={0x2}, 0xc)

Prevent such syscalls from being generated by limiting the range of
allowed interface indices.
2019-06-08 10:13:59 +02:00
Andrey Konovalov
58c4b1aeab sys/linux: use template based structure for USB descriptions
To allow future extensions of USB descriptions to fuzz particular USB
classes this patch changes the structure of USB descriptions to use
templates.

This will invalidate all existing USB corpus.
2019-06-07 15:37:00 +02:00
Andrey Konovalov
b004e95a3a sys/linux: add hidraw and hiddev descriptions 2019-06-07 11:52:50 +02:00
Andrey Konovalov
698773cb4f sys/linux: don't inherit fd_usb from fd
This is a special fd, we don't want various ioctls be called on it.
2019-06-06 16:24:27 +02:00
Anton Lindqvist
73a7d55bdf sys/openbsd: add klog descriptions 2019-06-05 19:18:58 -07:00
Anton Lindqvist
6354390a82 sys/openbsd: add missing wsmouse ioctl descriptions 2019-06-05 19:18:58 -07:00
Bins94
816587a771 sys/linux: update descriptions of sendmsg/sendmmsg
Add sendmsg$inet, sendmmsg$inet for ip_cmsg_send.
Add sendmsg$inet6, sendmmsg$inet6 for ip6_datagram_send_ctl
2019-06-03 18:43:52 +02:00
Paul Chaignon
53c81ea538 sys/linux: add missing BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-05-31 17:31:58 +02:00
Andrey Konovalov
142ce68175 pkg/runtest: add simple USB runtest 2019-05-31 13:35:25 +02:00
Andrey Konovalov
a8482b78fb sys/linux/vusb.txt: more descriptions to be done 2019-05-31 13:24:54 +02:00
Paul Chaignon
d9aaf3c288 sys/linux: add missing BPF constants
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-05-29 16:17:05 +02:00
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
Anton Lindqvist
4ba360c5fb sys/openbsd: add common ioctl() commands 2019-04-01 12:39:02 +02:00
Anton Lindqvist
98c1bf1cfb sys/openbsd: add bpf descriptions 2019-03-29 08:51:39 +01:00
houjingyi
934bb8cade modify 2019-03-29 07:47:14 +01:00
Dmitry Vyukov
8a528bedaa sys/linux: move copyright to the top of the file 2019-03-27 14:34:18 +01:00
Noa Osherovich
d1419fc79f Sys/linux: Add rdma.txt
Initial description of the kernel's RDMA subsystem.
This patch covers most of the older write() interface as well as the
some ioctl functions.
Also disable rdma_cm's ib_qp_type flags as it conflicts with rdma's
definition, and rdma builds first.

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
2019-03-27 14:31:07 +01:00
Dmitry Vyukov
4e668495fb sys/syz-extract: fix too long line 2019-03-27 09:44:01 +01:00
Marco Vanotti
70d776a21a sys/sys-extract: update import path for fuchsia.
Apparently, sysroot/include doesn't exist in the build-zircon path
anymore. I changed the path in sys-extract to make it point to the
exported sdk include path.

I also ran make extract and make generate to add new fidl definitions.

TEST=ran make extract and make generate.
2019-03-27 09:08:05 +01:00
Dmitry Vyukov
52a20ba400 dashboard/app: properly handle build failures
Separate kernel and syzkaller build failures.
Fix logic to understand when a build is fixed:
look if kernel/syzkaller commit changes to understand
if it's a new good build or re-upload of an old build.

Fixes #1014
2019-03-25 17:00:25 +01:00
Shankara Pailoor
acbc5b7d05 sys/linux: move openat to dev_rtc.txt
move openat$rtc to rtc_dev and change return type to fd_rtc
2019-03-24 09:28:43 +01:00
Marco Vanotti
14799fb2ef docs, pkg/vcs, sys/fuchsia: update fuchsia urls
Recently the fuchsia team decided to merge all their subrepos into one
big git repo. This meant that the "zircon" repo doesn't exist anymore.
Instead almost everything is under the fuchsia repo.

This change updates all the reference I could find in the code that
point to the zircon and docs repo to make them point to the new fuchsia
repo.
2019-03-20 07:50:58 +01:00
Dmitry Vyukov
28c04d39e0 sys/linux: disable SYSLOG_ACTION_CLEAR
For context see:
https://groups.google.com/d/msg/syzkaller/8nUJCnMfark/y8HOM_vrCQAJ
2019-03-19 14:33:45 +01:00
Mark Johnston
0dbba7ad6c sys/targets: use kernel.full instead of kernel.debug
The latter contains only debug symbols and is meant to be used with the
kernel executable.  That is, the kernel executable contains a
.gnu_debuglink pointer to kernel.debug.  kernel.full contains
everything, including a copy of the kernel's text section, which we want
when enumerating __sanitizer_cov_trace_pc() calls for a coverage report.
2019-03-19 10:26:46 +01:00
Dmitry Vyukov
61f9c92f3a sys/linux: restrict SYSLOG_ACTION_CONSOLE_LEVEL
Fuzzer must not mess with console, turn it on/off, change log level, etc.
Otherwise it turns off kernel output on console.
2019-03-18 13:35:11 +01:00
Anton Lindqvist
4656becafb sys/openbsd: add chflags descriptions 2019-03-18 08:52:35 +01:00
Alexander Popov
0d081107be sys/linux: Add rfkill description for Linux 2019-03-18 08:51:27 +01:00
Dmitry Vyukov
d72db19b2a sys/syz-extract: support more identifier quoting options
That's insanity compilers shuffle them in all possible combinations.
2019-03-14 15:30:58 +01:00
Dmitry Vyukov
1e8208402d sys/linux: regenerate and fix const files
1. Move fsverity descriptions to a separate file which
is not regenerated automatically. It was dropped from linux-next.
2. Fix tlk_device.txt name in syz-extract.
3. Update some socket consts e.g. s/SO_TIMESTAMPING/SO_TIMESTAMPING_OLD/.
4. Regenerate const files on current upstream head.
2019-03-14 13:40:11 +01:00
Dmitry Vyukov
4b69c3cbac pkg/runtest: make tests pass on freebsd
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.
2019-03-07 20:37:43 +01:00
Mark Johnston
4fc2fa55ac sys/freebsd: avoid mangling syscall names
syz-extract was removing certain prefixes from syscall names, but this
caused some problems:
- freebsd* prefixes are for compatibility syscalls when the syscall ABI
  has changed.  For instance, we have both fstat() and
  freebsd11_fstat(), and it is desirable to fuzz them both.
- Stripping prefixes may leave us with undefined SYS_ constants.  This
  resulted in some test failures in pkg/csource, which emitted code
  referencing SYS_semctl when it should have been SYS___semctl.

Fix the problem by updating syscall descriptions to match the names
given by the FreeBSD kernel.  Add some new descriptions for
compatibility syscalls, fix the mknodat() description (dev_t is now 64
bits wide on FreeBSD), and remove mknod$loop, which appears to be
Linux-specific.
2019-03-07 19:46:55 +01:00
Julia Hansbrough
7ff74a9832 sys/fuchsia/fidlgen: update FIDL path & extract new descriptions
Garnet-layer FIDL descriptions are in a new subdirectory.

This CL changes it to the proper directory, and performed a "make
extract" shortly after.

This should fix some of the errors on the Syzkaller hub.
2019-02-21 11:17:00 +01:00
houjingyi
c4218108d7 sys/linux: add netlink seg6 descriptions
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
2019-02-21 09:37:22 +01:00
Dmitry Vyukov
22f84b5e56 sys/linux/test: use pipe2 instead of pipe
pipe does not exist on arm64.
2019-02-13 15:58:42 +01:00
Dmitry Vyukov
2502eeaa79 sys/linux/test: disable tipc test
It still crashes kernel, disable for now.
2019-02-13 15:58:42 +01:00
Dmitry Vyukov
f5827293e2 hafnium: add basic support
Add [very] basic support for testing Hafnium:
https://hafnium.googlesource.com/hafnium

Update #996
2019-02-12 18:34:25 +01:00
Dmitry Vyukov
6258c9f721 sys/linux: regenerate consts
Regenereate consts on latest linux-next.
2019-02-12 18:34:25 +01:00
Dan Robertson
13f1d0047a sys/linux: add NDISC packet formats to vnet.txt
Add the basic NDISC (RFC 4861) packet formats to sys/linux/vnet.txt.
2019-02-11 18:10:35 +01:00
Dmitry Vyukov
fa6c7b7080 sys/linux: prohibit opening /proc/self/exe
Fuzzer manages to open it and do bad things with it.
Prevent it from doing so.
2019-02-08 16:30:44 +01:00
Dmitry Vyukov
8c1621bede sys/linux: prohibit EXT4_IOC_RESIZE_FS
When we run with sandbox=none, test program can do EXT4_IOC_RESIZE_FS which
shrinks rootfs basically to 0. This breaks the machine as all tests then fail with:

failed to create temp dir: mkdir syzkaller-testdir077269498: no space left on device

This is the most common source of "lost connection" crashes overall and
they are not actually kernel bugs.

Prohibit EXT4_IOC_RESIZE_FS for now.
Alternatively we can mount tmpfs with sandbox=none.

Update #971
2019-02-08 09:29:15 +01:00
Dmitry Vyukov
aa4feb0329 sys/linux: extend key descriptions 2019-02-07 09:39:35 +01:00
Dmitry Vyukov
cd7a3c250f sys/linux: move {i,fa}notify into own files 2019-02-07 09:39:35 +01:00
Marco Vanotti
d25487bc2e sys/fuchsia: fix fidlgen issues
* sys/fuchsia: fix fidlgen issues.

This change modifies fidlgen removing fuchsia.mediacodec and renaming
zircon-ethernet to fuchsia-hardware-ethernet.

fuchsia.mediacodec has most of its functionality merged into
fuchsia.media and it's not included in the default amd64 builds.

zircon-ethernet has been renamed to fuchsia-hardware-ethernet
recently:

https://fuchsia-review.googlesource.com/c/zircon/+/237178

* docs/fuchsia: Add troubleshooting sections

This commit adds a troubleshooting section in the fuchsia syzkaller docs
that mentions how to solve fidlgen issues when fidl interfaces are
removed or renamed.

* sys/fuchsia: remove stale autogenerated files.

* sys/fucsia run make extract && make generate.
2019-02-06 13:33:35 +01:00
Anton Lindqvist
c198d5ddeb sys/openbsd: add missing wscons descriptions (#976) 2019-02-01 22:01:09 -08:00
Andrey Konovalov
9f528bbcc8 sys/linux: rename dev descriptions files
Prefix file names of descriptions of /dev/* files with dev_.
And give some of them more appropriate names.
2019-02-01 14:40:17 +01:00
Dmitry Vyukov
25e10a0434 executor: remove ability to detect kernel bugs
This ability was never used but we maintain a bunch of code for it.
syzkaller also recently learned to spoof this error code
with some ptrace magic (probably intercepted control flow again
and exploited executor binary).
Drop all of it.
2019-01-31 11:35:53 +01:00
Dmitry Vyukov
724adc5445 sys/test/test: add tests for test exiting in the middle of execution 2019-01-31 11:35:53 +01:00
Dmitry Vyukov
31fc335d7c sys/linux/test: fix constraints in ipc test 2019-01-31 11:35:53 +01:00
Dmitry Vyukov
8e579f27d6 prog: fix escaping of C strings
C's \xHH hex constants in strings accept any number of hex digits
(not just 2 or 4). So later non-hex escaped chars glue to the \x construct.
Use \OOO instead as it accepts at most 3 octal digits.
2019-01-31 11:35:53 +01:00
Andrey Konovalov
aa432daf55 sys: use -march=armv6 instead of -march=armv6t2
The latter doesn't work on Raspberry Pi Zero.
2019-01-28 16:49:49 +01:00
Anton Lindqvist
c73f090a5c sys/openbsd: add wscons descriptions, limited to wsdisplay for now 2019-01-26 09:31:18 +01:00
Anton Lindqvist
fc1f188563 sys/openbsd: add openat$tty 2019-01-26 09:31:18 +01:00
Anton Lindqvist
3d7ad96eb0 sys/openbsd: add openat${null,zero} 2019-01-26 09:31:18 +01:00
Siddharth M
ebf7a37c5b pkg/build: add basic support for NetBSD
* Add pkg/build support for NetBSD

* Fix length of characters
2019-01-25 18:16:51 +01:00
Dmitry Vyukov
a3d9f7e34d sys/linux: fix up mptcp descriptions
1. Generate .const files for all arches.
2. Don't extract mptcp consts on android.
3. Remove mptcp includes from vnet.txt.
4. Enable CONFIG_MPTCP in syz-extract (mptcp is not like all other kernel headers).
2019-01-25 16:10:00 +01:00
8litz
6fde58c61b sys/linux: add Multipath TCP description
https://tools.ietf.org/html/rfc6824
2019-01-25 15:42:43 +01:00
Dmitry Vyukov
7be43858a2 sys/linux: add trusty hwrng service
Update #933
2019-01-24 16:49:40 +01:00
Dmitry Vyukov
f586e158c4 sys/linux: add trusty hwkey service
Update #933
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
5db97d84e9 sys/linux: describe trusty storage service interface
Update #933
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
91c9476c39 sys/linux: fix a TODO
We can actually express such size with:
define X25_SUBSCRIP_DEVICE_SIZE	200 - sizeof(long)
2019-01-24 16:49:39 +01:00
Dmitry Vyukov
b874f62f15 sys/linux: regenerate const files
(on linux-next)
2019-01-24 16:49:38 +01:00
Dmitry Vyukov
f87fe5d949 sys/syz-extract: don't use warning flags
CrossCFlags now contains some warning-related flags like -Wall.
Some of these break kernel build, don't add any warning-related flags.
2019-01-24 16:49:38 +01:00
Dmitry Vyukov
de746e8232 sys/linux: update TODO comments
Change TODO comments that refer to missing description
language features to NEED comments as that it's easier to grep for them.
Remove some outdated comments. Fix 2 easy fixable TODOs.
2019-01-24 16:49:38 +01:00
Siddharth M
f4e42cabb7 sys/targets: support netbsd cross compilation on linux
* Support cross compilation on linux

* typo fix

* fixed indentation

* Add a trailing '/' after SOURCEDIR
2019-01-24 11:27:36 +01:00
Anton Lindqvist
985f75cc50 sys/openbsd: remove mincore(2) description
It was recently removed from OpenBSD[1].

[1] https://marc.info/?l=openbsd-cvs&m=154723400730318&w=2
2019-01-22 09:21:03 +01:00
Dmitry Vyukov
353f32eacf sys/targets: fix shadowed flag variable
env CGO_ENABLED=1 GOMAXPROCS=1 GOGC=50 gometalinter.v2 ./...
sys/targets/targets.go:428:⚠️ declaration of "flag" shadows declaration at sys/targets/targets.go:423 (vetshadow)
2019-01-19 20:06:45 +01:00
Anton Lindqvist
141c212ca6 sys/openbsd: avoid /dev/fd node creation
Prevent nodes that maps to an already open kcov fd from being created since
they can corrupt the coverage buffer.

Partial revert of commit 04aed72692 with some
tweaks and testing.
2019-01-19 19:22:37 +01:00
Dmitry Vyukov
e935237c9c Makefile: enable -Wunused-const-variable
See discussion in PR #942.
Extend support for optional flags in sys/targets
as this flag is not supported by gcc 5.
Make flags consistent across Makefile and pkg/csource.
2019-01-19 19:20:39 +01:00
Joey Jiao
8aa587b0a1 sys/syz-extract: add -includedirs option
Kernel modules are in different directories in some cases,
so to include the headers in the module dir or other directories
the includedirs flag is added.
ex: -includedirs path1/include,path2/include
2019-01-19 12:30:10 +01:00
Andrey Konovalov
2cd76d2137 kcov: some fixes for extra coverage
Use PC tracing mode when detecting KCOV_REMOTE_ENABLE support in the kernel.

Also fix kcov_remote_handle_usb argument.
2019-01-17 16:06:59 +01:00
Anton Lindqvist
04aed72692 Revert "sys/openbsd: avoid /dev/fd node creation"
This reverts commit 77c702cf1a.

A proper fix has instead been committed to OpenBSD[1].

[1] 650b9bc3ab
2019-01-17 10:41:04 +01:00
Andrey Konovalov
c2faf9b2d5 all: detect extra coverage support
Based on whether the kernel supports KCOV_REMOTE_ENABLE ioctl.
2019-01-16 19:19:53 +01:00
msvoelker
c0d4a12ee7 sys/freebsd: add SCTP syscalls
* sys/freebsd: Add SCTP syscalls

* sys/freebsd: SCTP syscalls updated

* sys/freebsd: SCTP syscalls fixed
2019-01-16 18:12:07 +01:00
Dmitry Vyukov
e9b3467100 sys/linux: add trusty support
Add support for trusty tipc devices and several trusty app ports.

Update #933
2019-01-14 18:23:43 +01:00
Zubin Mithra
b38a805a0c sys/linux: Add syscalls to read from sockets for crypto operations
sockaddr_alg with salg_type as "skcipher", "aead", "hash" and "rng"
support for reading from these sockets. Add read descriptions to
socket_alg.txt.
2019-01-14 18:21:55 +01:00
Greg Steuck
77c702cf1a sys/openbsd: avoid /dev/fd node creation
Prevents corpus explosion with corrupted coverage data.

The two parallel runs of:
`doas ./syz-execprog -cover -coverfile /tmp/{fixed,unfixed} r.syz`
show markedly different coverage pictures:

unfixed:
```
2019/01/12 13:55:38 parsed 1 programs
2019/01/12 13:55:38 executed programs: 0
2019/01/12 13:55:38 call #0: signal 821, coverage 2438
2019/01/12 13:55:38 call #1: signal 243, coverage 1363
2019/01/12 13:55:38 call #2: signal 502, coverage 1993
2019/01/12 13:55:38 call #3: signal 15, coverage 44
2019/01/12 13:55:38 call #4: signal 335, coverage 8196
```

fixed:
```
2019/01/12 13:51:57 parsed 1 programs
2019/01/12 13:51:57 executed programs: 0
2019/01/12 13:51:57 call #0: signal 837, coverage 2491
2019/01/12 13:51:57 call #1: signal 241, coverage 1341
2019/01/12 13:51:57 call #2: signal 27, coverage 61
2019/01/12 13:51:57 call #3: signal 13, coverage 44
2019/01/12 13:51:57 call #4: signal 39, coverage 299
```

The contents of `r.syz` is
```
mknod(&(0x7f0000000180)='./file0\x00', 0x2006, 0x10000016e8)
r0 = open(&(0x7f0000000100)='./file0\x00', 0x0, 0x0)
mmap(&(0x7f0000000000/0x3000)=nil, 0x3000, 0x2, 0x10, r0, 0x0, 0x0)
writev(0xffffffffffffffff, &(0x7f0000002480)=[{&(0x7f0000001480)="<junk>", 0x573}], 0x1)
lstat(&(0x7f0000000240)='./file0\x00', &(0x7f0000000000))
```

So, it's the final lstat which was getting that extra coverage.  In
particular, the end of unfixed.4 has some 4734 values
0xffffffff00000000.
2019-01-14 09:48:45 +01:00
Shankara Pailoor
db9b657915 tools/syz-trace2syz/proggen/proggen_test.go: test ipv6 address conversion 2019-01-10 12:34:28 +01:00
Shankara Pailoor
0108829095 sys/linux: add rand_addr option to ipv6_addr union
rand_addr option is the first option for the ipv6_addr union
and is just an array of 16 bytes. This option makes it easy
for trace2syz to convert ipv6 address as strace decodes
the ipv6 address as a hex string.
2019-01-10 12:34:28 +01:00
Andrey Konovalov
204b8f5906 sys/linux: chmod -x *.txt
For some reason some syscall description txt files are +x. Do chmod -x.
2019-01-09 05:46:47 +01:00
Dmitry Vyukov
ee332608e9 sys/linux: prohibit SNAPSHOT_FREEZE
SNAPSHOT_FREEZE freezes all processes and leaves the machine dead.
2019-01-06 17:39:32 +01:00
Dmitry Vyukov
6838bb9a0f sys/linux: add /dev/ppp descriptions 2019-01-04 15:56:18 +01:00
Eric Biggers
f064b4365d sys/linux/init_alg.go: update algorithms
- Add arm64 implementations of various algorithms
  (these are usually named -arm64, -neon, or -ce)
- Add missing x86 SHA-NI algorithms (sha*-ni)
- Add adiantum    (new in v4.20)
- Add streebog256 (new in v4.20)
- Add streebog512 (new in v4.20)
- Add vmac64      (new in v4.19)
- Add xchacha12   (new in v4.20)
- Add xchacha20   (new in v4.20)
- Remove speck128 (was removed soon after being added to kernel)
- Remove speck64  (likewise)
- Move sm4 from hash list to cipher list
2019-01-02 11:24:46 +01:00
Eric Biggers
b86667864d sys/linux/init_alg.go: sort the algorithm names
Sort the lists of crypto algorithms lexicographically to make it easier
to see which algorithms are included and decide where to add new ones.
2019-01-02 11:24:46 +01:00
Michael Tuexen
97e0a43fa2 sys/tagets: use appropriate name for KernelObject on FreeBSD 2018-12-31 17:39:24 +01:00
Dmitry Vyukov
2b42fdc898 sys/linux: detail ifla_vf_policy/ifla_port_policy/ifla_xdp_policy 2018-12-30 17:36:38 +01:00
Dmitry Vyukov
f7d5ee2d34 sys/linux: add can routes 2018-12-30 16:24:31 +01:00
Dmitry Vyukov
5b565c8bdb sys/linux: add AF_RXRPC descriptions 2018-12-30 15:49:07 +01:00
Dmitry Vyukov
9942de5fb0 sys/linux: add /dev/mISDNtimer 2018-12-30 12:25:05 +01:00
Dmitry Vyukov
6e86ffb020 sys/linux: open more of /dev/ files
/dev/vfio/vfio
/dev/btrfs-control
/dev/ubi_ctrl
/dev/cachefiles
2018-12-30 12:19:52 +01:00
Dmitry Vyukov
204cb1446f sys/linux: add AF_ISDN descriptions 2018-12-29 20:40:32 +01:00
Dmitry Vyukov
f02201ce9a sys/linux: describe /dev/vhci interface 2018-12-29 19:22:35 +01:00
Dmitry Vyukov
79059de177 sys/linux: misc assorted improvements
Add new bpf consts/commands.
Refine bluetooth descriptions.
Remove removed crypto consts.
2018-12-29 19:22:35 +01:00
Dmitry Vyukov
a40793d7a5 sys/linux: refine few types in NETLINK_ROUTE 2018-12-29 07:45:20 +01:00
Dmitry Vyukov
2b084c9886 pkg/csource: use 0 for missing syscall args
We don't specify trailing unused args for some syscalls
(e.g. ioctl that does not use its arg).
Executor always filled tailing unsed args with 0's
but pkg/csource didn't. Some such syscalls actually
check that the unsed arg is 0 and as the result failed with C repro.

We could statically check and eliminate all such cases,
but it turns out the warning fires in 1500+ cases:
a3ace5a63f/gistfile1.txt

So instead fill such args with 0's in pkg/csource too.
2018-12-27 13:11:57 +01:00
Dmitry Vyukov
586a19e7ec executor: create more net devices on linux 2018-12-26 21:44:05 +01:00
Dmitry Vyukov
4f7962a7bb executor: restrict ipc resource usage
For context see:
https://groups.google.com/d/msg/syzkaller-bugs/ZaBzAJbn6i8/Py9FVlAqDQAJ
2018-12-26 10:29:43 +01:00
Dmitry Vyukov
8a41a0ad8e sys/linux: add network drop monitor support 2018-12-24 18:56:08 +01:00
Dmitry Vyukov
17c23ac162 sys/linux: add udmabuf descriptions 2018-12-24 18:56:08 +01:00
Dmitry Vyukov
a961943f02 sys/linux: add basic AF_CAIF descriptions 2018-12-24 18:56:07 +01:00
Dmitry Vyukov
57541e29d9 sys/linux: add basic X25 descriptions 2018-12-24 18:56:06 +01:00