Commit Graph

264 Commits

Author SHA1 Message Date
Denis Efremov
2f93b54f26 sys/linux: video4linux v4l2_jpegcompression APP_len fix
Signed-off-by: Denis Efremov <efremov@linux.com>
2018-05-29 16:32:01 +02:00
Denis Efremov
e276de775a sys/linux: cdrom generic description
Signed-off-by: Denis Efremov <efremov@linux.com>
2018-05-29 14:06:40 +02:00
Dmitry Vyukov
849705db5c sys/linux: few minor tweaks for bpf 2018-05-18 19:29:27 +02:00
Dmitry Vyukov
d302e81641 sys/linux: add MAP_FIXED_NOREPLACE const 2018-05-18 11:14:56 +02:00
Dmitry Vyukov
be1a56115b sys/linux: use optional in tun descriptions 2018-05-17 12:16:18 +02:00
Dmitry Vyukov
256b70f9cf sys/linux: fix duplicate field in struct 2018-05-17 11:45:51 +02:00
Dmitry Vyukov
c8229620ff sys/linux: regenerate video4linux consts on the right tree
Now generated on:
https://source.codeaurora.org/quic/la/kernel/msm-4.9 msm-4.9
2018-05-11 15:09:33 +02:00
Dmitry Vyukov
2d35915b13 sys/linux: add missing consts for video4linux.txt
For now other arches are regenerated on upstream tree.
It does not contain a bunch of consts, so we define them to 1 for now.
arm64 consts are left intact.
video4linux.txt is added to "android" files in syz-extract,
so that future make extract runs don't overwrite arm64 consts.

Also fix VIDIOC_G_FBUF argument direction, currently tests crash with:

panic: call ioctl$VIDIOC_G_FBUF: pointer arg 'buffer' has output direction [recovered]
	panic: call ioctl$VIDIOC_G_FBUF: pointer arg 'buffer' has output direction
2018-05-11 14:24:16 +02:00
srikanth007m
ace16942e5 sys/linux: add Video4Linux IOCTL Descriptors
* Adding Video4Linux IOCTL Descriptors

This will cover the ioctl() function used to program V4L2 devices

* Const file for video4linux_arm64.const
2018-05-11 14:11:10 +02:00
Hangbin Liu
b88872ba0e sys/linux: add AF_NETLINK/NETLINK_ROUTE SCHED support
Update #533

As TC(net sched) is a large group, I separate it from socket_netlink_route.txt.
Currently I only implement the framework with two qdisc/tclass/filters.
I will add the others later.

v2: Fix tcm_handle major and minor order. Add tcm_handle_offsets.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-05-08 17:15:21 +02:00
Dmitry Vyukov
f914e0a305 sys: dedup sanitization of common unix syscalls
Update #538
2018-05-07 14:42:55 +02:00
Dmitry Vyukov
cda1fcb742 sys: dedup mmap code across OSes
Update #538
2018-05-06 16:58:38 +02:00
Dmitry Vyukov
31ea20ce83 sys: move generate files to separate packages
Move generated files to gen subdir. This allows to:
1. Rebuild init.go without rebuilding generated code.
2. Excluding generated files from gometalinter checking.
This makes faster and consume less memory.

Update #538
2018-05-05 15:40:10 +02:00
Dmitry Vyukov
9dfb5efa91 prog: simplify code
Now that we don't have ReturnArg and only ResultArg's refer
to other ResultArg's we can remove ArgUser/ArgUsed and
devirtualize lots of code.
2018-05-05 10:13:04 +02:00
Dmitry Vyukov
0f503c18d9 gometalinter: enable misspell
Update #538
2018-05-03 15:53:13 +02:00
Dmitry Vyukov
4c24e4a467 gometalinter: enable package comment checking
Update #538
2018-05-03 13:53:01 +02:00
Dmitry Vyukov
bb79c6ab16 sys/linux: add few more filesystems with images 2018-04-29 18:59:43 +02:00
Dmitry Vyukov
67bec9bb44 sys/linux: describe block device ioctls
Describe block device ioctls.
Describe sg device ioctls.
Add few more devices.
2018-04-29 18:44:32 +02:00
Dmitry Vyukov
dba54bc2b8 sys/linux: refactor some flags to use char consts 2018-04-29 12:04:22 +02:00
Dmitry Vyukov
d5a5d04517 sys/linux: a bunch of assorted improvements 2018-04-27 19:52:20 +02:00
Dmitry Vyukov
190d92e056 sys/linux: extend namespace desciptions
Slightly extend namespace descriptions and move
them to a separate file.
2018-04-27 18:47:58 +02:00
Dmitry Vyukov
6bd8902381 syz-fuzzer: clean up after probing coverage
We left mmap memory and comparison tracing enabled.
2018-04-27 14:33:01 +02:00
Hangbin Liu
73417389ce sys/linux/socket_netlink_route: add routing rules
Also fix RTA_MULTIPATH data type. We only need struct rtnexthop,
no need to use array type.

v1 -> v2:
Use uid and sock_port instead of int32/16. Use flags for FRA_PROTOCOL
and FRA_IP_PROTO.

Add type fib_rule_hdr because even though the structure is same with rtmsg.
The table, action and flags values are not same.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-25 09:33:09 +02:00
Dmitry Vyukov
3642839c10 sys/linux: add f2fs support 2018-04-19 14:15:31 +02:00
Denis Efremov
4f18337d89 sys/linux: add i2c generic description
Basic description of i2c from SIL2LinuxMP workshop.
2018-04-19 11:34:29 +02:00
Hangbin Liu
d1b2ef6921 sys/linux/socket_netlink_route: update RTM_GETSTATS PAYLOAD format
Update RTM_GETSTATS PAYLOAD format.

Also fix ipv4_getroute and ipmr_getroute PAYLOAD format.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-19 09:21:00 +02:00
Hangbin Liu
0a0c5db668 executor: add two slave interfaces for bridge,bond,team
Bridge device is used for forwarding. Bond/team device is used for
load balance and fail over. So it would make more sense to add two
slave interfaces for these devices.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-13 09:38:31 +02:00
Hangbin Liu
e694ebbaee sys/linux/rdma_cm: remove RDMA_PS_SDP
RDMA_PS_SDP has been removed since commit 1b90d3002e3ee ("RDMA/CMA: remove
RDMA_PS_SDP")

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-13 09:38:31 +02:00
Dmitry Vyukov
9cd56d71a8 sys/linux: add veth devices to devnames
Also comment new veth code for future me.
2018-04-11 11:36:25 +02:00
Dmitry Vyukov
8b8de42714 sys/linux: add few new crypto algorithms 2018-04-10 20:13:52 +02:00
Dmitry Vyukov
2d0ec24625 sys/linux: improve team descriptions
1. Create ifindex_team, because TEAM_ATTR_TEAM_IFINDEX must
   always point to a team device.

2. Remove output only attributes like team_attr_item_port, TEAM_ATTR_LIST_PORT,
   TEAM_ATTR_OPTION_CHANGED.

3. Restructure team_nl_option_policy: we always want TEAM_ATTR_OPTION_NAME/TYPE/DATA
   + optionally TEAM_ATTR_OPTION_ARRAY_INDEX and TEAM_ATTR_OPTION_PORT_IFINDEX.

4. Provide specialized team_nl_option_policy_per_port and team_nl_option_policy_array.

5. Make team_attr_option varlen.

6. Remove unnecessary indirection via team_attr_list_option/team_attr_list_port.

7. Fix data type for bpf_hash_func and lb_tx_hash_to_port_mapping.
2018-04-06 17:29:15 +02:00
Dmitry Vyukov
8e4c2e24cb executor: create team device 2018-04-06 17:28:33 +02:00
Hangbin Liu
4f1152d4db sys/linux: add netlink generic team descriptions
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
2018-04-06 11:30:36 +02:00
Dmitry Vyukov
676bd07e7e sys/linux: test various binfmt's in execve 2018-04-02 20:10:48 +02:00
Dmitry Vyukov
3e679c51c0 pkg/compiler: support non-zero terminated filenames
Now file names become:

string[filename]

with a possibility of using other string features:

stringnoz[filename]
string[filename, CONST_SIZE]

and filename is left as type alias as it is commonly used:

type filename string[filename]
2018-04-02 20:10:07 +02:00
Dmitry Vyukov
99e3b0a7e8 sys/linux: add support for reading partition tables 2018-04-01 18:29:56 +02:00
Dmitry Vyukov
aa258367d3 sys/linux: fix misspelled const name
Fixes #552
2018-03-31 16:33:37 +02:00
Dmitry Vyukov
7c923cf8d4 sys/linux: add support for mounting filesystem images 2018-03-30 19:51:27 +02:00
Dmitry Vyukov
a5dbafc91d sys/linux: regenerate files
A previous commit included some non-regenerateed files.
Regenerate them now.
2018-03-29 11:58:32 +02:00
Dmitry Vyukov
bf5e585c5e executor: rework cgroups support
Turns out creating a cgroup per test is too expensive.
Moreover, it leads to hanged tasks as cgroup destruction
is asynchronous and overloads kernel work queues.

Create only a single cgroup per proc, but restrict
descriptions to mess with that single group,
instead test processes create own nested cgroups for messing.
2018-03-27 11:39:58 +02:00
Dmitry Vyukov
0ca7878bc3 sys/linux: add IPVS descriptions
Update #533
2018-03-26 18:27:11 +02:00
Dmitry Vyukov
2675f92065 sys/linux: add cgroup descriptions 2018-03-25 12:46:05 +02:00
Dmitry Vyukov
5b64ead83b sys/linux: add guehdr for udp packets 2018-03-21 15:27:47 +01:00
Dmitry Vyukov
7c62f71804 sys/linux: add netlink fou descriptions 2018-03-21 12:18:36 +01:00
Dmitry Vyukov
704259f644 sys/linux: fix nlattr alignment
It seems that alignment is never present in the nlattr.
2018-03-21 10:31:09 +01:00
Dmitry Vyukov
36d1c4540a all: fix gometalinter warnings
Fix typos, non-canonical code, remove dead code, etc.
2018-03-08 18:48:26 +01:00
Dmitry Vyukov
c8a1847658 sys/linux: add descriptions for /dev/infiniband/rdma_cm
Also fix uffd and bluetooth consts while we are here.
2018-03-06 19:15:44 +01:00
Dmitry Vyukov
2814d6b845 sys/linux: fix perf_event_attr layout 2018-03-06 19:15:44 +01:00
Dmitry Vyukov
42467f5b7b sys/linux: add syz_init_net_socket syscall
The new pseudo syscall allows opening sockets that can only
be created in init net namespace (BLUETOOTH, NFC, LLC).
Use it to open these sockets.

Unfortunately this only works with sandbox none at the moment.
The problem is that setns of a network namespace requires CAP_SYS_ADMIN
in the target namespace, and we've lost all privs in the init namespace
during creation of a user namespace.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
e91c118db9 sys/linux: make ifreq template, fix some usages 2018-03-05 12:10:27 +01:00
Dmitry Vyukov
f027f1a3f7 sys/linux: use size attributes on structs
1. Add size attribte on sockaddr.
2. Remove sockaddr's that are larger than 16 bytes from sockaddr.
3. Add size attribute on sockaddr_storage which wasn't actually 128 bytes.
4. Add size attribute to ifreq.
5. Fix ifmap field types as uncovered by the size attributes.
6. Fix sockaddr_storage_tcp from struct to union which is should be.
7. Make sockaddr_un_file fixed size as it should be.
8. Fix some explicit paddings that were only correct for 64 bits.
2018-03-05 12:10:27 +01:00
Dmitry Vyukov
db01d57e91 sys/linux: a bunch of assorted improvements and fixes 2018-03-05 12:10:27 +01:00
Dmitry Vyukov
2c6f473e0f sys/linux: add remaining aux netfilter descriptions 2018-03-01 19:26:53 +01:00
Dmitry Vyukov
b370d4a70c sys/linux: few assorted additions 2018-02-26 20:37:42 +01:00
Dmitry Vyukov
b37b65b0e6 sys/linux: remove proc type from network descriptions
We now always create net namespace for testing,
so socket ports and other IDs do not overlap between
different test processes.
Proc types play badly with squashing packets to ANYBLOB.
To squash into a block we need concrete value, but it depends
on process id.
Removing proc also makes tun setup and address descriptions simpler.
2018-02-26 16:48:31 +01:00
Dmitry Vyukov
67f0e5ba11 sys/linux: make tcp_seq_num asymmetric
Currently it's 0x42424242 so it's not possible to understand
the value endianess in hints code.
Make it assymmetric so that endinaness is clear.
2018-02-26 15:58:19 +01:00
Dmitry Vyukov
9fe8aa42c5 prog: add arbitrary mutation of complex structs
Squash complex structs into flat byte array and mutate this array
with generic blob mutations. This allows to mutate what we currently
consider as paddings and add/remove paddings from structs, etc.
2018-02-25 18:22:02 +01:00
Dmitry Vyukov
2145057cb8 pkg/compiler: fix alignment corner case
Fix alignemnt calculation for packed structs with alignment and bitfields.
Amusingly this affected only a single real struct -- ipv6_fragment_ext_header.
2018-02-25 14:44:29 +01:00
Dmitry Vyukov
1f4ae3f413 pkg/compiler: don't assign call IDs statically
IDs change whenever a call is added or removed,
this leads to large diffs unnecessarly.
Assign IDs dynamically.
2018-02-25 14:31:40 +01:00
Dmitry Vyukov
44f66b4026 prog: return concrete arg types from Make functions
This removes a bunch of type assertions and makes code type safer.
2018-02-24 17:00:34 +01:00
Dmitry Vyukov
e229ac7779 sys: fix descriptions for strickter return type checks
Mostly remove vma as return from some mm syscalls.
This is unnecessary and we never used these.
2018-02-23 13:42:41 +01:00
Dmitry Vyukov
3be86de046 sys/linux: prevent programs from doing arbitrary writes with ARCH_SET_FS 2018-02-23 11:55:37 +01:00
Dmitry Vyukov
8d8e249484 sys/linux: add AF_SMC sockets 2018-02-22 20:33:52 +01:00
Dmitry Vyukov
6153a72ee1 executor: bring up bond and veth devices 2018-02-22 20:16:37 +01:00
Dmitry Vyukov
907d649fc3 sys/linux: add few ip and tcp options 2018-02-22 20:14:36 +01:00
Dmitry Vyukov
c8e73b95c6 sys/linux: fix mmap call args
Also add a test for this.
2018-02-20 10:54:03 +01:00
Dmitry Vyukov
4b696a5daf sys/linux: minor fixes to bt descriptions 2018-02-19 21:48:20 +01:00
Dmitry Vyukov
a793204dd2 pkg/compiler: fix corner case in alignment calculation 2018-02-19 21:48:20 +01:00
Dmitry Vyukov
75a7c5e2d1 prog: rework address allocation
1. mmap all memory always, without explicit mmap calls in the program.
This makes lots of things much easier and removes lots of code.
Makes mmap not a special syscall and allows to fuzz without mmap enabled.

2. Change address assignment algorithm.
Current algorithm allocates unmapped addresses too frequently
and allows collisions between arguments of a single syscall.
The new algorithm analyzes actual allocations in the program
and places new arguments at unused locations.
2018-02-19 21:48:20 +01:00
Dmitry Vyukov
85d1218f41 prog: rework foreachArg
Make Foreach* callback accept the arg and a context struct
that can contain lots of aux info.
This (1) removes lots of unuser base/parent args,
(2) provides foundation for stopping recursion,
(3) allows to merge foreachSubargOffset.
2018-02-19 21:48:20 +01:00
Dmitry Vyukov
9df1a36a98 sys/linux: add bridge netfilter support 2018-02-17 19:02:12 +01:00
Dmitry Vyukov
d21a39fc48 sys/linux: fixes for network descriptions
1. Fix connlimit netfilter match version.
2. Fix xt_time_info layout.
3. Introduce mac_addr_mask type.
4. Limit vlan id's for better matches between them.
2018-02-17 19:02:12 +01:00
Dmitry Vyukov
478746a50e sys/linux: fix field names in netfilter 2018-02-10 13:22:05 +01:00
Dmitry Vyukov
033b610ec9 sys/linux: improve netfilter descriptions
Put the underflow entry at the end.
Entries must end on an unconditional, non-goto entry,
otherwise fallthrough from the last entry is invalid.

Add arp tables support.

Split unspec matches/targets to unspec and inet.

Reset ipv6 and arp tables in executor.

Fix number of counters in tables.

Plus a bunch of assorted fixes for matches/targets.
2018-02-09 20:14:33 +01:00
Dmitry Vyukov
826b35d667 sys/linux: describe some new 4.16 features 2018-02-01 21:27:02 +01:00
Dmitry Vyukov
e86ddaca2e sys/syz-extract: save unsupported consts to the const files
We currently print unsupported consts to console during make extract.
But this is not very useful as there are too many output now.
This also does not allow to understand what's unsupported
in newly checked-in descriptions, or what's unsupported in all current
decriptions.

Save unsupported consts to the const files instead.
This solves all of the above problems.
2018-02-01 20:18:51 +01:00
Dmitry Vyukov
08146b1a84 sys/linux: extend netfilter descriptions 2018-01-27 17:08:43 +01:00
Dmitry Vyukov
9a6ff11ff9 sys/linux: fix devname_mask alignment
Since we use int64, it has 8-byte alignment.
It's wrong, it must have 1-byte alignment.
Use int8 instead.
2018-01-24 11:41:13 +01:00
Dmitry Vyukov
ef6d3c0e03 sys/linux: add IPPROTO_L2TP to vnet protos 2018-01-24 11:38:45 +01:00
Dmitry Vyukov
40a6602675 sys/linux: add netfilter descriptions
Lots of TODOs and only ipv4, but some start.
2018-01-22 12:19:33 +01:00
Dmitry Vyukov
fbbdcd9228 sys/linux: add AF_VSOCK/vhost descriptions 2018-01-19 20:41:18 +01:00
Dmitry Vyukov
02dc66caa8 sys/linux: add AF_RDS descriptions 2018-01-19 18:06:43 +01:00
Dmitry Vyukov
161c1d640a sys/linux: resolve TODO re KCOV consts 2018-01-18 20:11:20 +01:00
Dmitry Vyukov
ff722179da sys/linux: make xattr prefix non-zero-terminated 2018-01-18 20:00:38 +01:00
Dmitry Vyukov
b7f99b54ae sys/linux: more selinux descriptions 2018-01-18 19:58:49 +01:00
Dmitry Vyukov
a84f016776 sys/linux: don't touch mknod$loop during sanitization
mknod$loop contains proc type as dev number.
Current sanitization code truncates 64-bit -1 to 32-bits
which later causes validation failure.
Don't do that, it's unnecessary for proc type.
2018-01-16 13:43:44 +01:00
Dmitry Vyukov
e17f4a5dfb sys/linux: generate GRE v0 packets even with incorrect payload 2018-01-15 20:26:04 +01:00
Dmitry Vyukov
47501d0f3b sys/linux: more NETLINK_ROUTE descriptions 2018-01-15 20:22:27 +01:00
Dmitry Vyukov
b75f5cb3cb sys/linux: add AF_PPPOX descriptions 2018-01-15 18:39:05 +01:00
Dmitry Vyukov
66d492a6c7 sys/linux: add vnet descriptions for GRE, MPLS, CAN 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
33bb46947a sys/linux: more AF_NETLINK/NETLINK_ROUTE descriptions 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
36e37bdf6c sys/linux: add broadcast/multicast mac addresses 2018-01-14 16:23:39 +01:00
Dmitry Vyukov
c9e7aeaef6 sys/linux: add AF_CAN descriptions 2018-01-13 12:52:09 +01:00
Dmitry Vyukov
e9aebc0683 sys/linux: add AF_NETLINK/NETLINK_ROUTE support 2018-01-13 12:52:09 +01:00
Dmitry Vyukov
212f927d3c executor: setup network devices
We test in a new network namespace, which does not have any
devices set up (even lo). Create/up as many devices as possible.
Give them some addresses and use these addresses in descriptions.
2018-01-13 12:52:09 +01:00
Dmitry Vyukov
a94baff95e sys/syz-sysgen: don't generate syz_ syscall numbers
They don't seem to be used today.
2018-01-13 12:52:09 +01:00
Dmitry Vyukov
125dadd3c9 sys/linux: use type templates for netlink
-350 lines of descriptions
2018-01-13 12:52:09 +01:00
Dmitry Vyukov
5585946e22 pkg/compiler: support void type
"void": type with static size 0
	mostly useful inside of templates and varlen unions
	can't be syscall argument
2018-01-13 12:52:09 +01:00
Dmitry Vyukov
a46637766b sys/linux: regenerate arm consts + small netlink fixed
Arm was broken on upstream kernel for some time
due to some assembler error. Now it seems to be fixed,
so regenerate consts.

Also fix small issues in new netlink descriptions.
2018-01-11 11:45:22 +01:00
Dmitry Vyukov
1f60c8289d sys/linux: add AF_NETLINK/NETLINK_NETFILTER descriptions 2018-01-09 21:24:30 +01:00
Dmitry Vyukov
94f8c64d03 sys/linux: add AF_NETLINK/NETLINK_GENERIC descriptions 2018-01-09 21:24:29 +01:00
Dmitry Vyukov
93bff6656f sys/linux: duplicate open/accept specializations with openat/accept4
open is not present on arm64, only openat.
accept is not present on 386, only accept4.
Duplicate all open/accept specializations with
corresponding openat/accept4 specializations
to enable testing on 386/arm64.
2018-01-09 21:24:29 +01:00
Dmitry Vyukov
0b470f2254 sys/linux: add AF_NETLINK/NETLINK_CRYPTO descriptions 2018-01-09 21:24:29 +01:00
Dmitry Vyukov
7166c86520 sys/linux: add ion and ashmem devices support
Note: ion supercedes the old android interface,
which is moved to sys/android.
2018-01-09 21:24:28 +01:00
Dmitry Vyukov
0ae499850c sys/linux: add type aliases for complex xfrm types 2018-01-08 12:52:31 +01:00
Dmitry Vyukov
95a1be6aa4 sys/linux: resolve few TODOs 2018-01-08 12:52:31 +01:00
Dmitry Vyukov
8ac12551c2 sys/linux: add type alias for socket port
type sock_port proc[20000, 4, int16be]

That was repeated a few times.
2018-01-08 12:52:31 +01:00
Dmitry Vyukov
f01cb93788 pkg/compiler: make signalno a type alias
We don't need compiler support for such things anymore,
now we simply can do:

type signalno int32[0:65]
2018-01-08 12:52:31 +01:00
Dmitry Vyukov
a8927abe6c prog: support opt for proc types 2018-01-06 17:40:49 +01:00
Dmitry Vyukov
8e6b9eeb27 pkg/compiler: add bitsize type
This is need for few crypto/xfrm descriptions.
2018-01-06 17:40:36 +01:00
Dmitry Vyukov
6bfd4f1979 sys/linux: netlink xfrm support 2017-12-31 12:11:12 +01:00
Dmitry Vyukov
bb6384b81a sys/linux: add multicast and ipv4 mapped ipv6 addresses 2017-12-29 22:14:12 +01:00
Dmitry Vyukov
dde1ffd49b sys/linux: describe ipv6 tlv options 2017-12-29 18:50:08 +01:00
Dmitry Vyukov
c25d74ee51 sys/linux: improve bpf descriptions 2017-12-29 17:24:21 +01:00
Dmitry Vyukov
b888d0cf5c sys/linux: improve perf descriptions 2017-12-29 12:50:21 +01:00
Dmitry Vyukov
0cbc76dfea sys/linux: assorted improvements
Mostly extensions of API in 4.15.
2017-12-29 10:09:24 +01:00
Dmitry Vyukov
6deb615310 sys/linux: fix some copy-paste errors 2017-12-28 19:16:42 +01:00
Dmitry Vyukov
7d240098d8 sys/linux: fix splice signature
...was wrong all that time
2017-12-27 20:26:51 +01:00
Dmitry Vyukov
019cf5f235 sys: move test syscalls to a separate target
We have them in linux solely for historical reasons.

Fixes #462
2017-12-17 11:39:14 +01:00
Dmitry Vyukov
da131727fb sys/linux: describe PF_KEY 2017-12-11 20:12:35 +01:00
Dmitry Vyukov
4016fc5ad7 prog: fix hints of data args
Hints for data args don't work.
We do all the work, but at the final stage we patch
arg in the _old_ program, not in the _new_ one.
So programs passed to the callback are all the same
and don't contain any mutations.
Tests did not catch this because they work right before that point
(don't test the actual interface function MutateWithHints).

Fix that and add a test that catches this.
2017-12-08 10:45:11 +01:00
Dmitry Vyukov
fadd10ac05 sys/linux: add a simple description for selinux 2017-12-08 10:15:04 +01:00
Dmitry Vyukov
3a80fe350d prog: support bytesizeN for vma
I guess this is currently unused,
but ignoring bytesizeN for vma looks wrong.
If user asks for bytesizeN for vma, divide vma size by N.
2017-11-29 11:12:47 +01:00
Dmitry Vyukov
1808de66ce prog: repair arrays/buffers with incorrect size in Deserialize
For string[N] we successfully deserialize a string of any length.
Similarly for a fixed-size array[T, N] we successfully deserialize
an array of any size.
Such programs later crash in foreachSubargOffset because static size
Type.Size() does not match what we've calculated iterating over fields.
The crash happens only in SerializeForExec in syz-fuzzer,
which is especially bad.
Fix this from both sides:
1. Validate sizes of arrays/buffers in Validate.
2. Repair incorrect sizes in Deserialize.
2017-11-28 19:15:28 +01:00
Dmitry Vyukov
ac93d7e1d8 pkg/compiler: add check that len does not refer to array with varlen elements
This [almost] always means a bug in descriptions.
Fix all bugs identified by the check.
2017-11-28 14:55:21 +01:00
Dmitry Vyukov
afba0b55e6 sys/linux: add binder descriptions 2017-11-27 15:09:30 +01:00
Dmitry Vyukov
deb5f6aea2 sys/linux: assorted improvements to descriptions 2017-11-27 09:09:06 +01:00
Dmitry Vyukov
103a5b3fa4 sys/linux: add files from net dir to list of /proc files 2017-11-27 09:09:05 +01:00
Dmitry Vyukov
502d78153c sys/linux: fix control len in msghdr's
Contol len is in bytes, not array elements.
2017-11-27 09:09:03 +01:00
Dmitry Vyukov
473d90487b sys/linux: improve hash generation for KEYCTL_DH_COMPUTE
KEYCTL_DH_COMPUTE used the old fixed list of algorithm names.
Use the new code for algorithm generation.
+ it needs only SHASH algs, but we passed in all alg names.
Pass only SHASH algs.
2017-11-27 09:09:01 +01:00
Dmitry Vyukov
d695195a6b sys/linux: resolve TODO re argument truncation 2017-11-27 09:09:00 +01:00
Dmitry Vyukov
8257de047b sys/linux: open files from /proc 2017-11-27 09:08:59 +01:00
Dmitry Vyukov
bbe60f6cb6 sys/linux: improve fuse descriptions 2017-11-27 09:08:57 +01:00
Dmitry Vyukov
4bd70f886b sys/linux: remove crypto algs starting with __
These can't be created from user-space.
2017-11-24 17:50:31 +01:00
Dmitry Vyukov
3bbb8c0b30 sys/linux: prefix non-autogenerated files with init_ 2017-11-24 14:57:38 +01:00
Dmitry Vyukov
ddf7b3e065 sys/linux: improve AF_ALG alg name generation
There is effectively infinite number of possible crypto
algorithm names due to templates. Plus there is tricky
relation between algorithms and algorithm type names.

This change adds custom mutator for sockaddr_alg struct
to improve variance in generated algorithms.
2017-11-24 13:56:20 +01:00
Dmitry Vyukov
7061d1973b sys/syz-extract: fix mmap on arm
__NR_mmap is missing on arm entirely,
so we disable mmap during generate.
Patch mmap to mmap2 right in syz-extract,
so that mmap is never missing.
2017-11-23 08:51:04 +01:00
Dmitry Vyukov
ae8da4a43e executor: move arm syscall fixup to syz-extract 2017-11-22 10:34:47 +01:00
Dmitry Vyukov
f07ea3fc22 sys/linux: remove get_kernel_syms, add quotactl syscall
get_kernel_syms does not seem to be present upstream.
Describe an old quotactl syscall.
Also fix umount/umount2 names in kallsyms.
2017-11-20 17:23:24 +01:00
Eric Biggers
38977f0e6b sys/linux: add definition for LOOP_SET_BLOCK_SIZE
The v4.14 kernel will support a new loop ioctl, LOOP_SET_BLOCK_SIZE.
2017-11-07 12:26:11 +03:00
Eric Biggers
a6b071286e sys/linux: fix wrong ioctl numbers in loop device definitions
Fix a couple apparent copy-and-paste errors:

    - ioctl$LOOP_CHANGE_FD should use LOOP_CHANGE_FD
    - ioctl$LOOP_CTL_REMOVE should use LOOP_CTL_REMOVE
2017-11-07 12:26:11 +03:00
Eric Biggers
7cff33f196 sys/linux: add definition for keyctl_restrict_keyring()
Add a definition for keyctl_restrict_keyring(), which was added in the
v4.12 kernel.
2017-11-03 12:33:25 +03:00
Eric Biggers
d53e548027 sys/linux: add definition for keyctl_dh_compute()
Add a definition for keyctl_dh_compute(), which was added in the v4.7
kernel, then in the v4.12 kernel extended to take in an optional
'keyctl_kdf_params' argument.  (Requires CONFIG_KEY_DH_OPERATIONS=y.)
2017-11-03 12:33:25 +03:00
Eric Biggers
494a18d9f8 sys/linux: use resource subtypes for "user" and "keyring" keys
Many functions in the keys API take in an ID parameter that is expected
to refer to a keyring, not to any key.  Therefore, define a resource
subtype 'keyring' which can be created by add_key("keyring", ...) or by
using one of the special keyring IDs.

Also define a resource subtype 'user_key', since we'll be adding a
definition for KEYCTL_DH_COMPUTE which takes in a struct containing
"user" key IDs.
2017-11-03 12:33:25 +03:00
Eric Biggers
2fb815f286 sys/linux: define all the key types
Add to key.txt all key types that currently might be present in the
kernel.  It was missing a few important ones such as "asymmetric", which
has a significant attack surface since the payloads are run through an
ASN.1 decoder.
2017-11-03 12:33:25 +03:00
Willem de Bruijn
6a3e678181 sys/linux: add MSG_ZEROCOPY 2017-10-17 15:26:15 +02:00
Dmitry Vyukov
4a4739bd45 sys/linux: fix fcntl signature 2017-10-16 14:21:54 +02:00
Dmitry Vyukov
eb97aa0610 executor: support fragmentation in syz_emit_ethernet
A recent linux commit "tun: enable napi_gro_frags() for TUN/TAP driver"
added support for fragmentation when emitting packets via tun.
Support this feature in syz_emit_ethernet.
2017-10-02 13:56:36 +02:00
Billy Lau
d335103a64 sys/linux: include additional header to ion.txt
This helps with resolving missing AT_FDCWD const.
2017-09-29 08:51:34 +02:00
Dmitry Vyukov
646d96d95a Makefile, sys/syz-extract: fix android 2017-09-27 08:46:03 +02:00