Commit Graph

1466 Commits

Author SHA1 Message Date
Dmitry Vyukov
2d37b9667e sys/openbsd: fix linter warnings
sys/openbsd/init.go:58:36: Top level comment should end in a period
	// kCoverFd in executor/executor.cc
	                                  ^
sys/openbsd/init.go:60:38: Top level comment should end in a period
	// kOutPipeFd in executor/executor.cc
	                                    ^
2020-09-15 19:34:30 +02:00
Dmitry Vyukov
dfb4c36914 tools/create_btrfs_image.sh: fix up and re-run
The previous commit did not get all intended changes.

Follow up to 2066
2020-09-14 11:08:16 +02:00
Dmitry Vyukov
fcf44ed305 tools/create_btrfs_image.sh: fix script
1. Use set -eu
2. Use consistent name of the generated files
3. Add "requires: manual"
4. Fix some option combinations that lead to errors

Follow up to 2066
2020-09-14 10:56:04 +02:00
Jiaheng Hu
bf0df4cba7 sys/linux: mount btrfs tests
Add several unit tests that mount different versions of btrfs images, and
the .sh file that generates these tests.
2020-09-14 10:56:04 +02:00
Dmitry Vyukov
2d3cdd63ad tools/create_f2fs_image.sh: name tests after the syscall
Make things consistent.

Follow up to #2032
2020-09-13 19:28:47 +02:00
Dmitry Vyukov
55b6cd4333 pkg/runtest: test parsing of all tests
Currently we only test parsing in tools/syz-runtest
and for test OS in pkg/runtest tests.
This means errors in tests for other OSes won't be
noticed until somebody runs tests manually.
Test parsing of all tests in pkg/runtest tests.
Fix up 2 broken tests.
2020-09-13 19:28:47 +02:00
Dmitry Vyukov
c52d06e410 sys/linux/test: mark f2fs tests as manual
Introduce "manual" requirement for tests (only run if explicitly selected)
and mark f2fs tests as manual. There are too many of them.

Follow up to #2032
2020-09-13 19:28:47 +02:00
Jiaheng Hu
84b0c3d8f6 sys/linux: add mount f2fs test
Add several unit tests that mount different versions of  f2fs image, and
the .sh file that generates these tests.
2020-09-13 18:42:14 +02:00
Mark Johnston
8a9bdb4a7e sys/freebsd: add definitions for large pages
Also add SHM_GROW_ON_WRITE, missed previously.
2020-09-13 17:15:57 +02:00
Mark Johnston
d0a4af89ac sys/freebsd: switch to the new .const format 2020-09-13 17:15:57 +02:00
Dmitry Vyukov
306464056c sys/test/test: add a hanging test
Ensure that we can handle hanging syscalls in all modes.
2020-09-12 13:03:27 +02:00
bobogei81123
409809d8a7
sys/linux: improve descriptions of bpf tracing (#2076)
- Rename bpf_lsm to bpf_trace and put all bpf program types
  that use BPF_RAW_TRACEPOINT_OPEN here.
- Add descriptions for types RAW_TRACEPOINT(_WRITABLE), BPF_TRACING and
  BPF_EXT.
- Add the hook names for RAW_TRACEPOINT(_WRITABLE).
2020-09-09 14:02:04 -07:00
Cheng-Min Chiang
d5a3ae1f76 sys/linux: add descriptions of qat_adf_ctl
Add descriptions for qat_adf_ctl. It might need an intel qat device.
Update #533.
2020-08-28 16:09:22 +02:00
Ioana-Ruxandra Stăncioi
344da168cb Revert "sys/linux: add description for fsinfo"
The fsinfo() system call is under heavy discussion upstream, and it
might be totally changed. As a result it was dropped from linux-next
starting in next-20200819, and the pull request for 5.9
(https://lkml.kernel.org/r/1845353.1596469795@warthog.procyon.org.uk/)
wasn't accepted. Therefore revert the syscall description (commit
4b0871d) for now.
2020-08-24 16:12:41 -07:00
bobogei81123
622e52f44c
sys/linux: make bpf_lsm_btf_id optional (#2054)
Pull request #1971 add the resource bpf_lsm_btf_id and make that a
required resource for bpf$BPF_LSM_PROG_LOAD. However, we need #2035
merged to get a bpf_lsm_btf_id, and the pull request is currently
blocked by a pahole issue. Thus, bpf$BPF_LSM_PROG_LOAD will be disabled
for now.

This pull request makes bpf_lsm_btf_id optional for
bpf$BPF_LSM_PROG_LOAD, so we can test this syscall before the issue is
resolved.
2020-08-24 13:36:18 -07:00
Cheng-Min Chiang
1d75fe458f sys/linux: add descriptions of vga_arbiter
Add desciptions for testing /dev/vga_arbiter.
Update #533
2020-08-20 13:39:39 -07:00
Jiaheng Hu
ed282a3a90 sys/linux: add BTRFS specific ioctls
Add the ioctls specific to BTRFS (linux v5.8).
2020-08-19 09:29:36 -07:00
Ioana-Ruxandra Stăncioi
db7879025a sys/linux: add lwtunnel_encap_seg6 description
Uncommented because the kernel fixed the seg6_iptunnel.h uapi header
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=88fab21c691bb1ff164e540735237a385e3afeaf
2020-08-19 13:28:33 +02:00
Marco Vanotti
a7d4a4f9e7 sys/targets: update fuchsia CFLAGS 2020-08-18 18:50:34 -07:00
Stefano Duo
7c06bb218a sys/linux/test: add test performing getdents64() on FUSE dir
Add syzkaller program which correctly handles a getdents64() syscall
on a FUSE directory. Here the related comment/discussion
https://github.com/google/syzkaller/pull/2001#issuecomment-671185292.
2020-08-14 18:55:11 +02:00
Stefano Duo
a1481759c3 executor/common_linux.h: open target dir inside syz_mount_image()
Refactor syz_mount_image() to support filesystems not requiring a
backing device and filesystem image (e.g. FUSE). To do that, we check for
the presence of the pointer to the array of struct fs_image_segment: if
missingi, there is no need to setup the loop device and we can proceed
directly with the mount() syscall.
Add syz_mount_image$fuse() (specialization for FUSE) inside
sys/linux/fs_fuse.txt.
2020-08-14 18:55:11 +02:00
Stefano Duo
aa6107e60d sys/linux/fs_fuse.txt: use bytelen instead of len
Use the type bytelen instead of len to express the length of the data
structure being pointed by the pointer passed to read$FUSE().
2020-08-14 18:55:11 +02:00
Stefano Duo
19b6584f71 executor/common_linux.h: add syz_fuse_handle_req()
At the moment syzkaller is able to respond to FUSE with a syntactically
correct response using the specific write$FUSE_*() syscalls, but most of
the times these responses are not related to the type of request that
was received.
With this pseudo-syscall we are able to provide the correct response
type while still allowing the fuzzer to fuzz its content. This is done
by requiring each type of response as an input parameter and then
choosing the correct one based on the request opcode.
Notice that the fuzzer is still free to mix write$FUSE_*() and
syz_fuse_handle_req() syscalls, so it is not losing any degree of
freedom.

syz_fuse_handle_req() retrieves the FUSE request and resource
fuse_unique internally (by performing a read() on the /dev/fuse file
descriptor provided as input). For this reason, a new template argument has
been added to fuse_out (renamed to _fuse_out) so that the unique field
can be both an int64 (used by syz_fuse_handle_req()) and a fuse_unique
resource (used by the write$FUSE_*() syscalls) without any code
duplication.
2020-08-14 18:55:11 +02:00
Stefano Duo
3d9b8afae8 sys/linux/fs_fuse.txt: use expected flags for fuse_attr.mode
Instead of using a generic int32 for fuse_attr.mode, use the expected
file mode flags.
2020-08-14 18:55:11 +02:00
Stefano Duo
191c0565a1 sys/linux/fs_fuse.txt: define FUSE request id as a resource
Currently fuse_in.unique and fuse_out.unique are not linked by any
dependency chain. This causes the majority of the replies to the kernel
to be dropped because not referring to a previously sent request.
By defining them as a resource, we push the fuzzer in the right
direction (i.e., try to respond using a previously issued unique value).
The read syscall has been updated accordingly, it now expects and parses
a fuse_in header and some additional data.
2020-08-14 18:55:11 +02:00
Anton Lindqvist
872ebc286c sys/openbsd: neutralize sysctl kern.maxthread
Yet another root only knob that can cause the syz-execprog process to
panic[1]. Greg is currently working on sanitizing sysctl integer knobs
in the OpenBSD kernel. This will improve the situation but preventing
fiddling with this knob is a good call anyway.

While here, restructure the code a bit making it easier to add sysctl
neutralizers.

[1] https://syzkaller.appspot.com/bug?id=40bcbbeb244998dfc4eeec90b8f8bce372882211
2020-08-14 13:46:14 +02:00
Necip Fazil Yildiran
5ce135324a prog: fix UnionType mutation for when per-field dir is specified
prog/TestMutateRandom used to fail due to this.
2020-08-14 11:02:10 +02:00
Dmitry Vyukov
54ce1ed6b9 sys/linux: switch to the new .const format
This reduces number of const files/lines from 1288/96599 to 158/11603.
Const files are generated on next-20200813.

Update #1983
2020-08-13 17:22:16 +02:00
Dmitry Vyukov
b6de93e603 pkg/compiler: merge const files into a single file
We now have 8 arches for Linux and .const files
produce lots of noise in PRs and lots of diffs.
If 3 .txt files are touched, the PR will have 24 .const files,
which will be intermixed with .txt files.
Frequently const values are equal across arches,
and even if they don't spreading a single value
across 8 files is inconvinient.

Merge all 8 *_arch.const files into a single .const file.
See the test for details of the new format.
The old format is still parsed for now,
we can't update all OSes at once.

For Linux this reduces number of const files/lines
from 1288/96599 to 158/11603.

Fixes #1983
2020-08-13 17:22:16 +02:00
Necip Fazil Yildiran
cc59e7e4ad sys/linux: use per-field directions in descriptions 2020-08-13 13:50:25 +02:00
Necip Fazil Yildiran
f5442bde55 pkg, prog: add per-field direction attribute 2020-08-13 13:50:25 +02:00
Mark Johnston
b38f46a018 sys/targets: override DataOffset for 32-bit test targets on FreeBSD
freebsd/386 requires a non-default DataOffset value.  Since it is
currently the only platform with this constraint, just add a special
case for that when initializing target parameters.
2020-08-12 18:09:10 +02:00
Ioana-Ruxandra Stăncioi
d3694ffbb1 sys/linux: add tca_flower_key_mpls_opts descritpion
mpls_opts:
https://elixir.bootlin.com/linux/v5.8-rc4/source/net/sched/cls_flower.c#L670
mpls_opts_lse:
https://elixir.bootlin.com/linux/v5.8-rc4/source/net/sched/cls_flower.c#L731
2020-08-10 17:55:15 +02:00
zizizi
7adc7b652a sys/linux: fix make extract on latest linux-next
VIRTIO_F_IOMMU_PLATFORM was renamed to VIRTIO_F_ACCESS_PLATFORM
2020-08-10 12:06:25 +02:00
Albert van der Linde
f721e4a097 sys/linux: add missing flags to rtnexthop 2020-08-08 14:12:06 +02:00
Albert van der Linde
cb9c120a74 sys/linux: add descriptions for RTM_(NEW|DEL|GET)NEXTHOP
https://elixir.bootlin.com/linux/v5.8-rc4/source/net/ipv4/nexthop.c#L1961
2020-08-08 14:12:06 +02:00
Cheng-Min Chiang
28ac5c9e93 sys/linux/test: fix io_uring test
Fix the io_uring test by adding some blank lines after comments. This
commit changes nothing beside that.
2020-08-07 09:44:43 +02:00
Cheng-Min Chiang
20a3465b97 sys/linux: add descriptions for BPF LSM
This commit includes the following changes:
* executor: add a new syz_btf_id_by_name psuedo-syscall
* sys/linux: add descriptions for BPF LSM subsystem
* sys/linux: add instructions on how to dump vmlinux and install
  bpftool
* sys/linux/test: add tests for the new psuedo-syscall
* pkg/host: add support detection for the new psuedo-syscall
* pkg/runtest: skip the coverage test when invoking the new
  psuedo-syscall

Update #533.
2020-08-07 09:28:26 +02:00
Andy Nguyen
9969d2164d sys/linux: add HCI_COMMAND_PKT descriptions 2020-08-05 20:13:16 +02:00
Anton Lindqvist
2cea8f1f89 sys/openbsd: neutralize clock_settime
One of "no output from test machine" report causes[1].

[1] https://syzkaller.appspot.com/text?tag=ReproSyz&x=10b0c7d8900000
2020-08-05 15:05:15 +02:00
Dmitry Vyukov
5ed76afa81 pkg/compiler: check for unused resources
If a resource is never used as an input, it is not useful.
It's effectively the same as using an integer.
Detect such cases, they are quite confusing.
Fix all existing errors in descriptions.
This uncovered some interesting bugs as well,
e.g. use of a completely unrelated fd subtype after copy-paste
(while the resource that was supposed to be used there is completely unused).
2020-08-04 16:53:16 +02:00
Andy Nguyen
196277c403 sys/linux/l2cap.txt: no array for l2cap_cid_le_signaling 2020-08-02 19:34:27 +02:00
Andy Nguyen
2c26f576ae all: fake hci le conn using handle 201 2020-08-02 19:34:27 +02:00
Dmitry Vyukov
55a879802a sys/linux: add more HCI_EV_CMD_COMPLETE types 2020-08-02 13:25:08 +02:00
Dmitry Vyukov
cb435b0c8a sys/linux: refine some l2cap flags 2020-08-02 12:49:26 +02:00
Andy Nguyen
cfd7c91a0a sys/linux: add l2cap_conf_opt options 2020-08-02 11:49:48 +02:00
Ayushi Sharma
8df85ed988
sys/netbsd: Adding syscalls related to mount(2),uname(2) and sockets (#1976)
* sys/netbsd: Adding syscalls related to mount(2),uname(2) and sockets

* sys/netbsd: Adding missing flags for fstatat(2)

* sys/netbsd: reordering rlimit_type

* sys/netbsd: reordering flags for stat(2) and mount(2)
2020-07-30 14:42:32 +02:00
Dmitry Vyukov
056be1b9c8 sys/linux: assorted improvements for vhci
Regenerate const files on next-20200729.

Change conn handle to 200 because it also seems to be matches
against phy_handle fields which are int8 (current 256 does not fit into int8).
Use 200 for all handle's and all phy_handle's.

Remove hci_evt_le_cis_req, it does not seem to be used in the kernel.

Restrict some event types and statuses.

Add rssi field to hci_ev_le_advertising_info.

Use bytesize for some of the data length fields.
2020-07-30 13:31:33 +02:00
TheOfficialFloW
b094755316
all: initialize vhci in linux
* all: initialize vhci in linux

* executor/common_linux.h: improve vhci initialization

* pkg/repro/repro.go: add missing vhci options

* executor/common_linux.h: fix type and add missing header

* executor, pkg: do it like NetInjection

* pkg/csource/csource.go: do not emit syz_emit_vhci if vhci is not enabled

* executor/common_linux.h: fix format string

* executor/common_linux.h: initialize with memset

For som reason {0} gets complains about missing braces...

* executor/common_linux.h: simplify vhci init

* executor/common_linux.h: try to bring all available hci devices up

* executor/common_linux.h: find which hci device has been registered

* executor/common_linux.h: use HCI_VENDOR_PKT response to retrieve device id

* sys/linux/dev_vhci.txt: fix structs of inquiry and report packets

* executor/common_linux.h: remove unnecessary return statement and check vendor_pkt read size

* executor/common_linux.h: remove unnecessary return statement and check vendor_pkt read size

* sys/linux/dev_vhci.txt: pack extended_inquiry_info_t

* sys/linux/l2cap.txt: add l2cap_conf_opt struct

* executor/common_linux.h: just fill bd addr will 0xaa

* executor/common_linux.h: just fill bd addr will 0xaa
2020-07-30 11:33:48 +02:00
Nazime Hande Harputluoglu
233283a191 sys/linux: descriptions for /dev/snd/hw* 2020-07-29 15:49:04 +02:00