Commit Graph

1475 Commits

Author SHA1 Message Date
Dmitry Vyukov
c1147c8df7 all: fix comments format
Fix capitalization, dots at the end
and two spaces after a period.

Update #1876
2020-07-12 08:22:44 +02:00
Cheng-Min Chiang
18d18b591b sys/linux: add descriptions for IP tunnels
Add descriptions related to IPv4/v6 tunnels
(include/uapi/linux/if_tunnel.h).
Descriptions of netlink actions are not included in this commit.
Update #533.
2020-07-10 13:02:07 -07:00
Alexander Egorenkov
56d01184e3 executor: fix bitfields for big-endian arch
Add bitfield tests for big-endian arch

Issue: #1885

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-07-10 10:25:58 +02:00
Jiaheng Hu
edf162e8c3 sys/linux: add SECCOMP_IOCTL_NOTIF_ADDFD
Added the ioctl decsription for adding a fd to a seccomp notifier,
currently in linux next.
(https://lore.kernel.org/lkml/20200617220327.3731559-7-keescook@chromium.org/)
2020-07-09 11:39:39 -07:00
Necip Fazil Yildiran
ff85e8be1a sys/linux: improved the desc for ioprio priority values
ioprio priority values (as passed to ioprio_set()) take values from
a limited range. This fact was reflected in the descriptions.
2020-07-09 09:06:26 +02:00
Jiaheng Hu
bc238812ae sys/linux: add close_range
Added description for close_range which is currently in linux-next
(https://lore.kernel.org/lkml/20200602204219.186620-2-christian.brauner@ubuntu.com/).
2020-07-08 13:37:34 -07:00
Necip Fazil Yildiran
6154150efc sys/linux: enhanced socket netlink ethool descriptions 2020-07-08 22:34:46 +02:00
Jiaheng Hu
5962a2dc88 sys/linux: add process_madvise
Adde description for process_madvise syscall in
linux-next (https://lore.kernel.org/lkml/20200622192900.22757-4-minchan@kernel.org).
2020-07-07 18:08:11 -07:00
Jiaheng Hu
789dd0861d sys/linux: add new flags into clone3
Added the CLONE_INTO_CGROUP and CLONE_CLEAR_SIGHAND flag for the clone3
syscall.
2020-07-07 12:34:11 -07:00
Dmitry Vyukov
3e0ce485a1 tools/syz-linter: check variable declarations
Warn about:

var x int = foo

In most cases this can be expressed shorter as:

var x int
x := foo
x := int(foo)

Update #1876
2020-07-06 08:23:03 +02:00
Necip Fazil Yildiran
37d770b0c3 sys/linux: improved the descriptions for cgroup
fix: hugetlb.<hugepagesize>.limit_in_bytes can be set.
     hugetlb.<hugepagesize>.usage_in_bytes is for reading.

added descriptions for the following resource controllers:
 net_cls, net_prio, devices, freezer.
2020-07-05 09:14:39 +02:00
Dmitry Vyukov
813f363bff all: fix dup types in func args 2020-07-04 15:05:30 +02:00
Necip Fazil Yildiran
510951950d sys/linux: added descs. for DEVLINK_CMD_TRAP_POLICER 2020-07-03 20:39:30 +02:00
Dmitry Vyukov
090d8f7bdf sys/linux: add riscv_flush_icache syscall
+extract constants on next-20200701
2020-07-01 10:57:23 +02:00
Anton Lindqvist
c0383ebe66 sys/openbsd: add missing wskbd ioctl descriptions 2020-06-30 21:08:59 +02:00
Jiaheng Hu
917afeaa70 sys/linux: add faccessat2
Added the faccessat2 description (linux 5.8) (https://git.kernel.org/linus/c8ffd8bcdd28296a).
2020-06-29 13:44:45 -07:00
Anton Lindqvist
cc1e9bc12d sys/openbsd: neutralize yet another pf ioctl command
Disarms the latest reproducer[1] for the discovered "no output from test
machine" panic.

While here, tidy up and improve comments.

[1] https://syzkaller.appspot.com/bug?id=4c3b1ac22d6d7f1d9ebcad5469a28cb4562debda
2020-06-29 21:36:27 +02:00
Tobias Klauser
032b42395f sys/linux: generate fsinfo description for riscv64
PR #1856 added the fsinfo description before support for linux/riscv64
was added through PR #1867.

Re-generate the description so fsinfo is covered on linux/riscv64 as
well.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-27 10:14:25 +02:00
Ayushi Sharma
ffec44b5d1
Adding stat(2) and statfs(2) related syscalls (#1855)
* sys/netbsd: adding filesystem and communication syscalls

* sys/netbsd: add fix for struct sockaddr_storage and profil(2)

* sys/netbsd: add common ioctl(2) commands

* sys/netbsd: resolving conflicts

* sys/netbsd: adding stat() and statfs() related syscalls

* sys/netbsd: adding missing flags for getfsstat(2)

Co-authored-by: Siddharth M <siddharth.muralee@gmail.com>
2020-06-26 13:26:51 -07:00
Jiaheng Hu
4b0871d90d sys/linux: add description for fsinfo
Added the description for the new fsinfo sys call (currently in
linux-next). Details about fsinfo can be seen in
https://lkml.kernel.org/linux-fsdevel/158454408854.2864823.5910520544515668590.stgit@warthog.procyon.org.uk/.
2020-06-26 11:31:35 -07:00
Tobias Klauser
999d3ea4e0 sys/linux: add initial support for riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
bf9f00404e sys/targets: add support for linux/riscv64
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
a7c0649868 sys/syz-sysgen: ignore *_kvm.txt on linux/riscv64
The Linux RISC-V port in linux-next doesn't support KVM yet. Ignore it
for now until KVM support is added upstream.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Tobias Klauser
42306a435d sys/syz-extract: ignore *_kvm.txt on linux/riscv64
The Linux RISC-V port in linux-next doesn't support KVM yet. Ignore it
for now until KVM support is added upstream.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-06-26 16:41:30 +02:00
Alexander Egorenkov
aea82c003a sys/linux: first 64bit big-endian architecture s390x
* mmap syscall is special on Linux s390x because
  the parameters for this syscall are passed as a struct
  on user stack instead of registers.
* Introduce the SyscallTrampolines table into targets.Target
  to address the above problem.
* There is a bug in Linux kernel s390x which causes QEMU TCG
  to hang when KASAN is enabled. The bug has been fixed
  in the forthcoming Linux 5.8 version. Until then do not enable
  KASAN when using QEMU TCG, QEMU KVM shall have no problems with
  KASAN.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-25 23:08:45 +02:00
Necip Fazil Yildiran
c7b4497a9d sys/linux: documented the findings on qrtr rpmsg and mhi drivers
The QRTR rpmsg and mhi interfaces are not tested at this time.
The reasoning is documented for future reference in the corresponding
descriptions file.
2020-06-25 11:44:18 +02:00
Jiaheng Hu
9d60b18e94 sys/linux: add openat2 description
Added the openat2 syscall for file and for directory. Details of the
syscall can be seen at
https://man7.org/linux/man-pages/man2/openat2.2.html.
2020-06-24 12:08:15 -07:00
Alexander Egorenkov
bbad15ae75 target: support of big-endian architectures
* Introduce the new target flag 'LittleEndian' which specifies
  of which endianness the target is.
* Introduce the new requires flag 'littleendian' for tests to
  selectively enable/disable tests on either little-endian architectures
  or big-endian ones.
* Disable KD unit test on s390x architecture because the test
  works only on little-endian architecture.

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>
2020-06-23 21:24:30 +02:00
Danielle Ratson
6930bbef3b sys/linux: Add port and sb devlink syscalls
Add support for set of devlink port and sb interface syscalls.

Signed-off-by: Danielle Ratson <danieller@mellanox.com>
2020-06-23 17:57:38 +02:00
Dmitry Vyukov
2528093954 sys/targets: fix mknod neutralize for netbsd
mknod on netbsd can now also accept a resource for the last arg.
Fix that and add a test that will catch such things more reliably.
2020-06-23 16:54:07 +02:00
Necip Fazil Yildiran
54566aff16 sys/linux: add descriptions for qrtr-tun 2020-06-23 10:34:37 +02:00
Necip Fazil Yildiran
39240c9e93 sys/linux/socket_qipcrtr: enhance desc for qipcrtr
Utilization of special values for port and node ids.
Added desc for sendmsg and recvmsg.
2020-06-23 10:34:37 +02:00
Necip Fazil Yildiran
0c8fbbfce1 sys/linux: add descriptions for qrtr socket
Added descriptions to test Qualcomm's IPC router protocol for sockets.
Update #533.
2020-06-23 10:34:37 +02:00
Ayushi Sharma
eabcced432
sys/netbsd: add common ioctl() commands (#1850)
* sys/netbsd: adding filesystem and communication syscalls

* sys/netbsd: add fix for struct sockaddr_storage and profil(2)

* sys/netbsd: add common ioctl(2) commands

* sys/netbsd: resolving conflicts

Co-authored-by: Siddharth M <siddharth.muralee@gmail.com>
2020-06-21 10:00:43 -07:00
Michael Tuexen
9529a48126 sys/freebsd: update SCTP related socket options for FreeBSD
For implementing sctp_bindx(), FreeBSD uses two IPPROTO_SCTP
level socket options SCTP_BINDX_ADD_ADDR and SCTP_BINDX_REM_ADDR.
The type of the value was changed from struct sctp_getaddresses *
to struct sockaddr_in * or struct sockaddr_in6 * in
https://svnweb.freebsd.org/changeset/base/362451
2020-06-21 12:54:51 -04:00
Ayushi Sharma
4f2acff939
sys/netbsd: increase syscall support (#1805)
* sys/netbsd: increase syscall support

* sys/netbsd: increase syscall support fixed

* sys/netbsd: fixed mknod issue

* sys/netbsd: add fix for getdents, futimes and setpriority
2020-06-21 01:41:23 -07:00
Andrey Konovalov
2c4fd27e5b dashboard/config, sys/linux: update usb config 2020-06-19 18:43:45 +02:00
Dmitry Vyukov
03658df6d9 sys/syz-sysgen: be less verbose if no errors happened
There is little point in printing all targets if no errors happened.
Generation is fast, so this is not even working as a "progress bar".
Only print target if there are any errors.
2020-06-19 11:56:47 +02:00
Jiaheng Hu
b1b22865fc sys/linux: add descriptions for new tipc crypto APIs
Added the TIPC_NLA_NODE_KEY and TIPC_NLA_NODE_ID fields in the
socket_tipc_netlink.txt file. Created a new struct to hold the key.
Created two new descriptions for TIPC_NL_KEY_SET and TIPC_NL_KEY_FLUSH.
The related kernel commits can be seen in
https://git.kernel.org/linus/134bdac39766 and
https://git.kernel.org/linus/e1f32190cf7d.
2020-06-18 09:38:16 -07:00
Amit Cohen
d45a4d69d8 sys/linux: add support for devlink trap syscalls
Add support for set of devlink trap interface syscalls.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
2020-06-17 18:13:33 +02:00
Amit Cohen
84586a4955 sys/linux/socket_netlink_generic_devlink: use template type for netlink msg
Add template type for netlink msg with CMD and POLICY as
arguments, it can be used for all sendmsg calls in this file.

Refactor the existing code.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
2020-06-17 18:13:33 +02:00
Ayushi Sharma
b6c46f4351
sys/netbsd: adding filesystem and communication syscalls (#1826) 2020-06-17 02:40:05 -07:00
TheOfficialFloW
2e9b5f5949 sys/linux/l2cap.txt: fix structs 2020-06-14 09:01:52 +02:00
Dmitry Vyukov
a61674a581 sys/linux: fix some warnings in descriptions
syz-check pointed to a new batch of bugs in descriptions.
Fix them.
2020-06-13 20:50:20 +02:00
Dmitry Vyukov
83af9a2cef sys/linux: regenerate .warn files
On latest kernel, with latest *.txt files and with kernels compiled with
-fno-eliminate-unused-debug-types -fno-eliminate-unused-debug-symbols flags.
2020-06-13 19:56:20 +02:00
Andrey Konovalov
f4724dd308 sys/linux: move vhci stuff to dev_vhci.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
835efa70b0 sys/linux: rename vhci.txt to dev_vhci.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
4ece6be9e2 sys/linux: rename watch_queue.txt to dev_watch_queue.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
b798117396 sys/linux: rename trusty.txt to dev_trusty.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
ef27ba34a6 sys/linux: rename mptcp.txt to vnet_mptcp.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
af47d1d5c0 sys/linux: rename ipvs.txt to netfilter_ipvs.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
8ddccc2581 sys/linux: rename fsverity.txt to fs_ioctl_fsverity.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
2a2ff48439 sys/linux: rename fscrypt.txt to fs_ioctl_fscrypt.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
562406d573 sys/linux: rename fuse.txt to fs_fuse.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
9a5c775864 sys/linux: rename 9p.txt to fs_9p.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
c94245053a sys/linux: rename fs_btrfs.txt to fs_ioctl_btrfs.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
ea75f0e93e sys/linux: rename fs_ext4.txt to fs_ioctl_ext4.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
a47f57a951 sys/linux: rename apparmor.txt to security_apparmor.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
5644d14ff1 sys/linux: rename selinux.txt to security_selinux.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
0b84f68300 sys/linux: rename smack.txt to security_smack.txt 2020-06-12 18:42:12 +02:00
Andrey Konovalov
1e72cce4ed sys/linux: rename devio.txt to dev_bus_usb.txt 2020-06-12 18:42:12 +02:00
Alexey Kardashevskiy
819b58b09f ppc64: Increase page size
The default configuration on PPC64 uses 64K system page size. Having it
4K was not a problem until recently when 365fba2440
"executor: surround the data mapping with PROT_NONE pages" added
surrounding mappings not aligned to the actual system page size.

This changes the page size for ppc64 to 64K and introduces the upper
limit to randPageCount() as we have the hard coded limit of 16MB.
If the unlikely event of a PPC64 system with 4K pages, we will end up
allocating less pages which is not great but acceptable.

This avoids using os.Getpagesize() as the page size on a building host
may be different than on the test machine so we always use the bigger
size for simplicity.

Signed-off-by: Alexey Kardashevskiy <aik@linux.ibm.com>
2020-06-12 05:54:26 +02:00
Dmitry Vyukov
829fd56fbf sys/targets: always fail if SOURCEDIR_GOOS is set but compiler is broken
We should not skip the second check as well.
2020-06-11 23:18:52 +02:00
Christoph Paasch
1ffa7b1e77 sys/linux: mptcp: Add netlink-API for MPTCP path-management
MPTCP exposes a generic netlink API to control address advertisement and
subflow-creation. syzkaller should make use of this interface.
2020-06-11 22:16:56 +02:00
Lorenz Bauer
6dd6b37bc7 sys/linux: update BPF_MAP_UPDATE_ELEM to enable more thorough sockmap fuzzing
sockmap and sockhash expect the value of the update syscall to be a file
descriptor for a UDP or TCP socket. Add this knowledge by introducing a
separate union for map update values.
2020-06-11 21:10:50 +02:00
Lorenz Bauer
954e0f8699 sys/linux: update bpf_attach_args
Attaching and detaching can be done on some map types (sockmap) and
the current network namespace as well.
2020-06-11 21:10:50 +02:00
Dmitry Vyukov
5c25fdab08 sys/targets: fail loudly if SOURCEDIR_GOOS is set but compiler is broken
Since we now have SOURCEDIR_{FUCHSIA,AKAROS,NETBSD} exported in the
syz-big-env docker image, this will make CI fail for broken cross-builds too.

Update instructions in the docker image to fix the current problem
with permissions in syz-big-env: we need to tar with --mode=go=u.
2020-06-11 18:06:49 +02:00
TheOfficialFloW
1beaee2171
sys/linux: add l2cap descriptions
* sys/linux: add l2cap descriptions

* sys/linux: restore bpf and fscrypt changes

* sys/linux: restore key.txt
2020-06-11 17:59:37 +02:00
Michael Tüxen
dfdd11f777
sys/targets: use a different SYZ_DATA_OFFSET for 32-bit FreeBSD (#1809)
* sys/targets: use a different SYZ_DATA_OFFSET for 32-bit FreeBSD

It seems that the value used on all platforms (512 << 20) does
not work on 32-bit FreeBSD when using the clang tools.
Try (256 << 20) instead.

* sys/targets: add comment why a non-default value is needed
2020-06-11 17:57:14 +02:00
Marco Vanotti
3ab7a05ad8 sys/targets: fix fuchsiaCFlags
This commit modifies the fuchsia cflags to use the short version of
the «target» flag. The previous code seemed to be broken due to lacking
an `=` after the flag name using the long version.
2020-06-10 18:12:49 -03:00
Eric Biggers
80e99b01d7 sys/linux: update fscrypt descriptions
- Add fscrypt_add_key_arg::key_id and "fscrypt-provisioning" key type
  (Linux 5.6, https://git.kernel.org/linus/93edd392cad7)

- Add FS_IOC_GET_ENCRYPTION_NONCE
  (Linux 5.7, https://git.kernel.org/linus/e98ad464750c)

- Add FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32
  (Linux 5.8, https://git.kernel.org/linus/e3b1078bedd3)
2020-06-10 10:13:43 -07:00
TheOfficialFloW
5caaad3a74
sys/linux: add vhci headers for event packets
* sys/linux: add vhci headers for command packets

* sys/linux: make generate

* sys/linux: use event packet instead of command packets

* sys/linux/vhci.txt: move low-energy entries to hci_ev_le_meta_un

* sys/linux/vhci.txt: add hci_ev_cmd_complete opcodes
2020-06-10 14:11:42 +02:00
Paul Chaignon
b4eca5502e
sys/linux: BPF update for 5.8 merge window part 1
* sys/linux: update BPF constants

Signed-off-by: Paul Chaignon <paul@cilium.io>

* sys/linux: Add BPF_ENABLE_STATS bpf(2) command

Signed-off-by: Paul Chaignon <paul@cilium.io>

* sys/linux: Add BPF_ITER_CREATE bpf(2) command

Signed-off-by: Paul Chaignon <paul@cilium.io>

* sys/linux: Fix BPF_*_GET_NEXT_ID bpf(2) commands

These commands are used to retrieve a new ID for various BPF objects.
With the current command descriptions, however, the output 'next ID' is
treated as an input field.

Fix: c2dcd70 ("sys/linux: update BPF's anonymous structures")
Signed-off-by: Paul Chaignon <paul@cilium.io>

* sys/linux: Add LINK_GET_* bpf(2) commands

Signed-off-by: Paul Chaignon <paul@cilium.io>
2020-06-10 13:16:19 +02:00
Dmitry Vyukov
860c4de9cf sys/linux: regenerate const files on next-20200609 2020-06-09 16:01:11 +02:00
Ricardo Cañuelo
ed70e69f00 sys/linux: v4l2 and vim2: update and add additional const files
Add missing const files for dev_video4linux_vim2m: 386, arm and
ppc64le).

Update dev_video4linux const files.
2020-06-09 15:58:40 +02:00
Ricardo Cañuelo
07fe0fb871 sys/linux: v4l2 and vim2m2 refactoring
Remove a single template parameter to v4l2_buffer, as it should always
use a fd_request descriptor. Update all syscalls that use it.

Refactor the VIDIOC_STREAMON and VIDIOC_STREAMOFF vim2m ioctls to use
v4l2_buf_type_vim2m as a parameter instead of an union.

Remove ioctl$VIDIOC_RESERVED from dev_video4linux.txt (not defined in
upstream kernel).
2020-06-09 15:58:40 +02:00
Ricardo Cañuelo
c5e085d96d sys/linux: specific descriptions for vim2m (v4l2)
Add a set of descriptions to focus the fuzzing process on the V4L2 vim2m
test driver. This should be useful to test the M2M framework.

The syscalls are based on a specific file descriptor for the vim2m
device and a selection of v4l2 ioctls that operate on it. Some of the
existing v4l2 data structure definitions have been extended to allow
restricting and selecting some options in order to narrow down the
fuzzing process.

Initial support for Request API added.
2020-06-09 15:58:40 +02:00
Dmitry Vyukov
948dd3af44 prog: remove target.StringDictionary
The linux string dictionary comes from extremely old times
when we did not have proper descriptions for almost anything,
and the dictionary was a quick hack to guess at least some
special strings.
Now we have way better descriptions and the dictionary
become both unnecessary and probably even harmful.
2020-06-07 10:41:01 +02:00
Matt Morehouse
e6b89e4e5a sys/linux: add MREMAP_DONTUNMAP flag
Update https://github.com/google/syzkaller/issues/533.
2020-06-06 07:49:50 +02:00
Matthew Dempsky
f243c88ffd sys/fuchsia: regenerate FIDL descriptions
This commit is the results of running:

  rm sys/fuchsia/*.const sys/fuchsia/*.syz.txt
  TARGETOS=fuchsia make extract
2020-06-05 15:08:57 -03:00
Matthew Dempsky
57a83e9453 sys/fuchsia: update "make extract" support code
FIDL fuzzing hasn't been working for a while, and it's further
bit-rotted as upstream FIDL functionality has continued to evolve.
This commit updates enough FIDL functionality to get a minimal FIDL
test case to work again.
2020-06-05 15:08:57 -03:00
Dmitry Vyukov
48b44e1ce0 .golangci.yml: reenable dupl checker
At some point it was enabled, but then somehow got disabled.
Re-enable and fix some regressions.
2020-06-05 12:23:19 +02:00
Dmitry Vyukov
503fd5b2f7 .golangci.yml: enable whitespace checker
Points to bad empty lines very precisely.
2020-06-05 12:23:19 +02:00
Michael Tuexen
2bacf9b5a6 sys/freebsd: mark some fields as big endian 2020-06-04 12:35:47 +02:00
Matthew Dempsky
f3ba1b5b7b sys/syz-sysgen: add -src and -out flags
This is useful for integrating into Fuchsia's build system, where we
need to be able to run syz-sysgen with a read-only source directory,
and emit the output files elsewhere.
2020-06-02 10:29:24 -07:00
Dmitry Vyukov
52fd7b7d77 tools: add syz-big-env
On top of syz-env it provides akaros/fuchsia/netbsd toolchains and gcloud sdk.
With this it's possible to run dashboard/app tests on CI and locally
and test executor build and pkg/{csource,cover} for these OSes.

Update #1765
2020-06-02 13:39:30 +02:00
Dmitry Vyukov
d56234396c pkg/cover: support coverage reports on fuchsia 2020-06-02 13:39:30 +02:00
m00nbsd
954bd312f9 sys/netbsd: improve vusb.txt 2020-05-29 21:25:38 +02:00
Dmitry Vyukov
bed0830408 sys/targets: fix cross-compiler CI check
cdc5f8a23e accidentially changed
this condition to a wrong one. Change it back.
2020-05-29 15:33:29 +02:00
Dmitry Vyukov
cdc5f8a23e sys/targets: support SOURCEDIR_GOOS vars
Support SOURCEDIR_GOOS env vars as an alternative to SOURCEDIR.
SOURCEDIR_GOOS takes precedence.
This allows to test several OSes at the same time.

Update #1765
2020-05-29 13:02:19 +02:00
Anton Lindqvist
142a0957d0 sys/openbsd: change type of sysctl namelen argument
The namelen argument must reflect the number of elements in the name
vector. Since it's a vector of integers, bytesize4 seems more
appropriate.

With help from by Dmitry[1].

[1] https://github.com/google/syzkaller/pull/1761#discussion_r430139775
2020-05-27 21:39:33 +02:00
Dmitry Vyukov
fdf90f622b pkg/cover: add test for report generation
Test various combinations of no debug info,
no coverage instrumentation, no PCs, bad PCs, good PCs,
and what errors we produce for these.
Also implement support for cross-arch reports:
prefix objdump with cross-compile prefix
(e.g. aarch64-linux-gnu-objdump instead of objdump).
2020-05-27 14:38:28 +02:00
Dmitry Vyukov
8ca3b7d2bb sys/linux: fix some warnings in descriptions 2020-05-25 18:06:29 +02:00
Dmitry Vyukov
47dd291b8e sys/linux: update warn files on next-20200521 2020-05-25 18:06:29 +02:00
Anton Lindqvist
1128418284 sys/openbsd: add sysctl descriptions 2020-05-24 21:38:38 +02:00
Dmitry Vyukov
cecffa2df9 sys/syz-sysgen: don't format descriptions
Formatting takes 10 seconds.
make format will run go fmt anyway.
2020-05-21 16:18:44 +02:00
Dmitry Vyukov
dd849aa3a2 sys/linux: generate consts on next-20200519 2020-05-20 19:40:08 +02:00
Dmitry Vyukov
204f4fde06 sys/syz-extract: fix for full paths
pkg/ast now uses full paths since 554f8f39c5.
Fix syz-extract accordingly.
2020-05-20 19:38:14 +02:00
m00nbsd
67fa1f59b8 executor: add support for USB fuzzing on NetBSD 2020-05-19 23:07:55 +02:00
Dmitry Vyukov
0ee915a4b7 pkg/runtest: disable broken test combinations
Amusingly this was always broken but nobody was ever able to compile
32-bit binaries on Linux since the addition of the tests.
2020-05-18 11:34:42 +02:00
Dmitry Vyukov
58d6f672b9 sys/targets: check that <dirent.h> works in compilation test
Without linux-libc-dev:i386 installed the test passes,
but executor compilation fails because <dirent.h> is broken.
2020-05-18 11:34:42 +02:00
Ayushi Sharma
37bccd4ed9 sys/netbsd: increase syscall support 2020-05-15 13:43:55 -07:00
Andrey Konovalov
8a9f1e7dbd executor, sys/linux: syz_usb_ep_read/write accept endpoint address
This patch changes syz_usb_ep_read/write pseudo-syscalls to accept endpoint
address as specified in its endpoint descriptor, instead of endpoint index.
2020-05-15 16:30:32 +02:00
Alexander Potapenko
d7f9fffab3 targets: syz-extract: add Clang support for Linux builds
Allow targets.go use Clang instead of the default Linux compiler by
setting the SYZ_CLANG=1 env var. Doing so changes the compiler to
"clang" and the linker to "ld.ldd", assuming they are in $PATH, and adds
the --target and -ferror-limit CFLAGS.

Target also exports KernelCompiler and KernelLinker fields now, which allows
overriding the compiler and linker in the kernel make invocation.

Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-15 14:08:01 +02:00
Alexander Potapenko
4da021feb0 targets.go: append flags in a more readable way
As suggested by Dmitry Vyukov

Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-15 14:08:01 +02:00
Alexander Potapenko
e2993cfc13 targets: replace target.CCompilerPrefix with target.Triple
This field will soon be used in Clang builds. Also, we'd better
encapsulate compiler name generation in targets.go

Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-15 14:08:01 +02:00
Michael Tuexen
2d572622ca sys/targets: fix typo 2020-05-14 11:06:41 +02:00
Michael Tuexen
4dcd09e8cb sys/targets: add -lc++ when building for test os on FreeBSD
This unbreaks gmake presubmit on FreeBSD.
2020-05-14 11:06:41 +02:00
Michael Tuexen
e36b2ae53d sys/targets: fix tests when building on FreeBSD
gmake test is failing on FreeBSD since switching to clang.

To address this:
* use g++ as the C preprocessor for now.
* use a C compiler for compiling C sources and add -lc++ when
  compiling executor.cc. Without this, clang warns about
  using a C++ compiler for compiling C code.
* some test configs add -no-pie, which is not used by clang.
  Add -Wno-unused-command-line-argument to silence a warning
2020-05-14 11:06:41 +02:00
Alexander Potapenko
a99fd8b014 targets: introduce osCommon.cflags, make -static a common flag on Linux
Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-13 13:05:41 +02:00
Alexander Potapenko
88a97d1a7a Get rid of "Cross" in variable names
Renamed Target.BrokenCrossCompiler to Target.BrokenCompiler and
Target.CrossCFlags to Target.CFlags

"Everything in Target is about Cross now."

Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-13 13:05:41 +02:00
Alexander Potapenko
ad606d93b2 targets: delete CFlags
According to
https://github.com/google/syzkaller/pull/1732#issuecomment-627809865,
they have been unused since 3aa3800.

Signed-off-by: Alexander Potapenko <glider@google.com>
2020-05-13 13:05:41 +02:00
Dmitry Vyukov
9cea41ad33 sys/syz-sysgen: fix up linux/arm/kvm hack
We have some private files that need to be excluded as well... oh, hacks.
2020-05-12 11:58:00 +02:00
Dmitry Vyukov
160c769827 pkg/mgrconfig: fix errors reported by linter
pkg/mgrconfig/load.go:78:1: cyclomatic complexity 26 of func `Complete` is high (> 24)
sys/targets/targets.go:217: File is not `gofmt`-ed with `-s`
2020-05-12 09:15:58 +02:00
Michael Tuexen
a497a5b4b9 sys/targets: don't remove CrossCFlags 2020-05-12 08:46:41 +02:00
Michael Tuexen
1670262071 sys/targets: use clang on FreeBSD 2020-05-12 08:46:41 +02:00
Ayushi Sharma
44aa83104c
sys/netbsd: add access(2) 2020-05-11 23:18:48 -07:00
Dmitry Vyukov
f4bf31dc3c sys/syz-extract: use -nostdinc on linux
This makes the build completely hermetic.
2020-05-11 16:54:44 +02:00
Dmitry Vyukov
b17a8c4474 sys/linux: extract consts on next-20200511 2020-05-11 16:54:44 +02:00
Dmitry Vyukov
7711af6356 sys/syz-extract: don't warn about unsupported consts for 1 arch
Only warn about unsupported consts when generating consts for all arches.
2020-05-11 16:54:44 +02:00
Dmitry Vyukov
d44f7473de sys/syz-extract: add another compiler message about missing const
New message from clang.
2020-05-11 16:54:44 +02:00
Ayushi Sharma
3b3a2b78da
sys/netbsd: add __getcwd(2) (#1725) 2020-05-11 00:03:33 -07:00
Dmitry Vyukov
8742a2b9db sys/syz-extract: run mrproper for all linux arches
We only run for the current arch, but it's not enough
to clean a build for another arch.
Run mrproper for all non-clean arches.
2020-05-09 16:08:22 +02:00
Dmitry Vyukov
f40567d255 all: reformat code 2020-05-08 14:02:16 +02:00
Dmitry Vyukov
6c70a1c220 all: replace TRAVIS env var with CI
In preparation to running some tests as github actions.
Both Travis and Github define CI env var, while TRAVIS is, well,
too Travis-specific.

Update #1699
2020-05-07 15:41:50 +02:00
Andrey Konovalov
1b2b36d6ab sys/android: dev_ prefix for ion descriptions 2020-05-07 11:26:03 +02:00
Dmitry Vyukov
e42fa3fd02 prog: refactor hints tests
The way the tests fabricate types dynamically creates
problems during any non-trivial changes to prog package.

Use existing types from descriptions instead.
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
1905d7c090 prog: refactor ANY to not fabricate new types
Currently ANY implementation fabricates new types dynamically.
This is something we don't do anywhere else, generally types
come from compiler and all are static.
Dynamic types will conflict with use of Ref in Arg optimization.
Move ANY types creation into compiler.

Update #1580
2020-05-05 14:01:52 +02:00
Dmitry Vyukov
71db69869e sys/linux: mark some ioctls as disabled
Mark ioctls we disable in init.go as disabled.

Update #477
Update #502
2020-05-04 20:56:20 +02:00
Dmitry Vyukov
a4d38b39a8 prog: support disabled attribute
Update #477
Update #502
2020-05-04 20:56:20 +02:00
Dmitry Vyukov
58ae5e1862 prog: remove StructDesc
Remove StructDesc, KeyedStruct, StructKey and all associated
logic/complexity in prog and pkg/compiler.
We can now handle recursion more generically with the Ref type,
and Dir/FieldName are not a part of the type anymore.
This makes StructType/UnionType simpler and more natural.

Reduces size of sys/linux/gen/amd64.go from 5201321 to 4180861 (-20%).

Update #1580
2020-05-03 12:55:42 +02:00
Dmitry Vyukov
58da4c35b1 prog: introduce Field type
Remvoe FieldName from Type and add a separate Field type
that holds field name. Use Field for struct fields, union options
and syscalls arguments, only these really have names.

Reduces size of sys/linux/gen/amd64.go from 5665583 to 5201321 (-8.2%).
Allows to not create new type for squashed any pointer.
But main advantages will follow, e.g. removing StructDesc,
using TypeRef in Arg, etc.

Update #1580
2020-05-02 12:16:06 +02:00
Dmitry Vyukov
bc734e7ada prog: rename {PtrType,ArrayType}.Type to Elem
Name "Type" is confusing when referring to pointer/array element type.
Frequently there are too many Type/typ/typ1/t and typ.Type is not very informative.
It _is_ a type, but what's usually more relevant is that it's an _element_ type.
Let's leave type checking to compiler and give it a more meaningful name.
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
e54e9781a4 prog: remove Dir from Type
Having Dir is Type is handy, but forces us to duplicate lots of types.
E.g. if a struct is referenced as both in and out, then we need to
have 2 copies and 2 copies of structs/types it includes.
If also prevents us from having the struct type as struct identity
(because we can have up to 3 of them).

Revert to the old way we used to do it: propagate Dir as we walk
syscall arguments. This moves lots of dir passing from pkg/compiler
to prog package.
Now Arg contains the dir, so once we build the tree, we can use dirs
as before.

Reduces size of sys/linux/gen/amd64.go from 6058336 to 5661150 (-6.6%).

Update #1580
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
986fa4971c prog: don't squash objects that contain pointers
Squashing pointers creates several problems:
- we need to generate pointer types on the fly,
  something we don't do in any other contexts,
  it complicates other changes
- pointers are very special as values,
  if we change size of the surrounding blobs,
  offsets changes and we will use something that's
  not a pointer as pointer and vise versa,
  boths things are most likley very bad as inputs
- squashing/any implementation is just too complex

This disqualifies several types for squashing:

    <         alloc_pd_cmd
    <         arpt_replace
    <         array[cmsghdr_rds]
    <         create_cq_cmd
    <         create_flow_cmd
    <         create_qp_cmd
    <         create_srq_cmd
    <         ebt_counters_info
    <         ip6t_replace
    <         ipt_replace
    <         mlx5_alloc_pd_cmd
    <         mlx5_create_dv_qp_cmd
    <         open_xrcd_cmd
    <         post_recv_cmd
    <         post_send_cmd
    <         post_srq_recv_cmd
    <         query_qp_cmd
    <         query_srq_cmd
    <         reg_mr_cmd
    <         rereg_mr_cmd
    <         resize_cq_cmd
    <         usbdevfs_urb
    <         vhost_memory
    <         vusb_connect_descriptors

and adds few new:

    >         binder_objects
    >         query_qp_resp
    >         resize_cq_resp
    >         usb_bos_descriptor
    >         usb_string_descriptor

Overall this looks sane.
Majority is still unchanged.
2020-05-01 13:31:17 +02:00
Dmitry Vyukov
ec42220e77 Makefile: generate descriptions on-the-fly
Checking in the generated descriptions files makes few things simpler,
but causes pain for pull requests: (1) PRs that touch descriptions
_always_ conflict, (2) PRs are large and harder to review,
(3) people sometimes forget to add auto-generated files.

The proposed way does not require us to hardcode lots of dependencies
in the Makefile (which is nice) and seem to work.
Let's see how it works.

The main contributor-visible consequence is that the auto-generated
files do not need to be checked-in now.

Credit for figuring the Makefile magic goes to @melver.

Fixes #1291
2020-04-30 17:18:29 +02:00
Dmitry Vyukov
136082ab38 pkg/cmdprof: add package
cmdprof simplifies cpu/memory profiling for command line tools. Use as:

	flag.Parse()
	defer cmdprof.Install
2020-04-30 17:18:29 +02:00
Dmitry Vyukov
3698959af9 sys/targets: fix detection of optional compiler flags
The test source is now C++, so use -x c++.
Stupid bug, but testing this is not trivial
in the context where we specifically make
behavior "flexible"...
2020-04-30 11:54:39 +02:00
Andy Nguyen
c42af8f753 sys: add mldv2 packet structs
Use special values for hop limit to increase likelihood of triggering certain paths.
2020-04-29 18:55:57 +02:00
Andy Nguyen
bd365072bf sys: add more specific ipv6 options
Additionally fix a type for ipv6_hopopts_ext_header
2020-04-29 16:46:34 +02:00
Dmitry Vyukov
3b93a8e003 sys/targets: better detection for missing/broken cross-compilers
1. Detect when compiler is present, but is not functioning
(can't build a simple program, common for Linux distros).

2. Be more strict with skipping tests due to missing/broken compilers on CI
(on CI they should work, so fail loudly if not).

3. Dedup this logic across syz-env and pkg/csource tests.

4. Add better error reporting for syz-env.

Fixes #1606
2020-04-29 16:32:33 +02:00
Dmitry Vyukov
0ce7569ee7 pkg/compiler: deduplicate Types in descriptions
Add prog.Ref Type that serves as a proxy for real types
and allows to deduplicate Types in generated descriptions.
The Ref type is effectively an index in an array of types.
Just before serialization pkg/compiler replaces real types
with the Ref types and prepares corresponding array of real types.
When a Target is registered in prog package, we do the opposite
operation and replace Ref's with the corresponding real types.

This brings improvements across the board:
compiler memory consumption is reduced by 15%,
test building time by 25%, descriptions size by 33%.

Before:
$ du -h sys/linux/gen
54M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m54.200s
real	0m53.883s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m27.911s
real	0m27.767s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
20.59 100% 3200016
20.97 100% 3445976
20.25 100% 3209684

After:
$ du -h sys/linux/gen
36M	sys/linux/gen

$ time GOMAXPROCS=1 go test -p=1 -c ./prog
real	0m42.290s
real	0m43.230s

$ time GOMAXPROCS=1 go install -p=1 ./tools/syz-execprog
real	0m24.337s
real	0m24.727s

$ TIME="%e %P %M" GOMAXPROCS=1 time go tool compile ./sys/linux/gen
19.11 100% 2764952
19.66 100% 2787624
19.35 100% 2749376

Update #1580
2020-04-26 05:58:31 +02:00
Greg Steuck
99b258ddc3 sys/openbsd: extend vnet
* started with freebsd/vnet.txt
  * pruned unsupported items
  * gmake extract
  * gmake generate_sys
  * gmake fomat
2020-04-26 04:43:15 +02:00
Andrey Konovalov
b9233cab41 dashboard/config, sys/linux: update usb config 2020-04-23 16:47:51 +02:00
Ayushi Sharma
2e44d63e40
sys/netbsd: add lchmod(2) (#1687) 2020-04-21 13:22:03 +02:00
Dmitry Vyukov
6dfd45e1d0 sys/syz-sysgen: better formatting for syscall descriptions
We don't really need clang-format for auto-generated code.
We can do better ourselves!
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
2152cfbcb2 all: fix liner errors
pkg/compiler/compiler.go:182: line is 125 characters
func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) (res map[*attrDesc]uint64) {
sys/targets/common.go:47:21: unnecessary conversion
				makeMmap(^uint64(target.PageSize)+1, target.PageSize, 0),
				                ^
sys/targets/common.go:61: File is not `gofmt`-ed with `-s`
			&prog.Call{
sys/windows/init.go:35: File is not `gofmt`-ed with `-s`
		&prog.Call{
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
91db3ed8ce prog: add ignore_return and breaks_returns call attribtues
We had these hard-coded for fuchsia and linux accordingly.
Replace with call attributes.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
1155a0d1d6 sys/linux: sync call timeouts with executor
Timeouts in executor and sys/linux get out of sync. Sync them.
2020-04-19 10:26:57 +02:00
Dmitry Vyukov
cc8708904d sys/linux: add timeout call attributes
Move additional call/prog timeouts to descriptions.

Due to this logic duplication executor used 50ms
for syz_mount_image, while pkg/csource used 100ms.
2020-04-19 10:26:57 +02:00