Commit Graph

858 Commits

Author SHA1 Message Date
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
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
Marco Vanotti
d6d32e566b run make extract and make generate for fuchsia 2019-07-16 16:34:29 +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
Andrey Konovalov
baa5258a5e executor: fix out-of-bounds in USB fuzzing code
We might not have any string descriptors provided at all, use a hardcoded
string in this case.
2019-07-11 15:44:30 +02:00
Andrey Konovalov
186a30b993 executor: update USB fuzzing code to use new kernel API
The kernel API has changed and now differentiates between IN and OUT
control requests.
2019-07-11 15:03:48 +02: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
Anton Lindqvist
429efa16d6 executor: make errors during thread creation exit zero
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
2019-07-04 20:26:46 +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
R3x
d25bb7ad41 pkg/report: use cover protect on NetBSD also 2019-06-13 18:26:11 +02:00
Andrey Konovalov
3f4e812b87 executor: improve usb coverage attribution
Always call write_extra_output() only if the current program or call
can produce extra coverage (== is a syz_usb* syzcall).
2019-06-12 19:47: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
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
Anton Lindqvist
a547defcdc executor: add cover protection support to OpenBSD (#1215) 2019-06-05 19:13:28 -07:00
Andrew Turner
bfb4a51e30 executor: Protect the coverage buffer
Add functions to protect and unprotect the coverage buffer. The buffer is
protected from being written to while tracing. When the trace data is
sorted we need to make it read/write, but can return it to read only after
this has completed.

Leave the first page as read/write as we need to clear the length field.
2019-06-04 16:24:36 +02:00
Dmitry Vyukov
8b598c83d2 executor: special-case zx_deadline_after return value
zx_deadline_after also returns time, not status.
So don't use it as coverage.
2019-06-04 14:57:43 +02: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
c054a92dde pkg/csource: generate timeouts for USB syzcalls
This patch only covers per call timeouts, per prog one is not adjusted yet.
2019-05-31 13:35:25 +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
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
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
R3x
9809825e48 make changes to prevent failing build 2019-05-21 13:56:38 +02:00
Dmitry Vyukov
40957b8193 executor: exit after first detected leak in C repros
Otherwise C repros print infinite stream of the same leaks again and again.
2019-05-21 12:00:02 +02:00
Dmitry Vyukov
8285069f89 executor: implement support for leak checking
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.
2019-05-20 19:40:20 +02: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