Commit Graph

963 Commits

Author SHA1 Message Date
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