Commit Graph

1074 Commits

Author SHA1 Message Date
Dmitry Vyukov
46961c2ff5 sys/linux: fix more netlink warnings
Handle NLA_BITFIELD32.
Match string attribtues better.
Calculate and check min size for varlen structs.
Fix NLA_UNSPEC size check.
Fix some things in descriptions.

Update #590
2020-01-23 15:05:19 +01:00
Dmitry Vyukov
3334d684ce sys/linux: fix incorrect nlattr sizes
Update #590
2020-01-22 18:31:20 +01:00
Dmitry Vyukov
f5fe1f1fcf sys/linux: more fixing of netlink policy names
Update #590
2020-01-22 18:31:20 +01:00
Dmitry Vyukov
2bdcee05b5 sys/linux: mark all nested netlink attributes as nlnest
As far as I understand most subsystems don't care about
the nest flag, but some do. But marking them as nest
won't harm (?). Let's mark all of them.

Caught several cases where should have been used array[policy]
but used just policy.

Update #590
2020-01-22 18:31:19 +01:00
Dmitry Vyukov
e4c56f390e tools/syz-check: improve matching netlink attributes
1. Match policies that has a _suffix in our descriptions
(we frequently do this to improve precision or avoid dup names).
2. Rename policies in descriptions to match kernel names.
3. Match policy if there are several such names in kernel.
4. Recognize policies with helper sub-policies.

Update #590
2020-01-22 18:31:15 +01:00
Dmitry Vyukov
c40da18cc3 sys/linux: fix IFLA_BR_GROUP_ADDR type 2020-01-20 10:29:45 +01:00
Dmitry Vyukov
0342f8c7bc sys/linux: add more device descriptions (geneve, lowpan, ipoib, cfhsi) 2020-01-19 13:51:21 +01:00
Dmitry Vyukov
4668877967 sys/linux: add some batadv descriptions 2020-01-18 21:02:24 +01:00
Dmitry Vyukov
543c012b4e executor: create macvtap, macsec devices 2020-01-18 21:02:24 +01:00
Dmitry Vyukov
22535fecd5 pkg/compiler: don't mark flags with 0 as bitmask
They can't be a bitmask. This fixes important cases
of "0, 1" and "0, 1, 2" flags. Fix some descriptions
that added 0 to bitmasks explicitly (we should do it
automatically instead).
2020-01-18 21:02:24 +01:00
Dmitry Vyukov
d412ea5e8e pkg/compiler: sort flags values
Will simplify runtime analysis of flags.
Also just no reason to make it more deterministic
and avoid unnecessary diffs in future if values are reordered.
2020-01-18 21:02:24 +01:00
Dmitry Vyukov
132dcea0af pkg/compiler: generate const[0] for flags w/o values
Generate const[0] for flags without values and for flags
with a single value which is 0.
This is the intention in all existing cases (e.g. an enum with types
of something, but there is really only 1 type exists).
2020-01-18 21:02:24 +01:00
Dmitry Vyukov
d2f8d5ab46 sys/linux: fix sigset_t/sigaction layout on arm
Update #590
2020-01-18 21:02:24 +01:00
Dmitry Vyukov
b803944b58 prog: don't add fallback coverage after prctl
The same reason as with seccomp.
2020-01-15 17:35:31 +01:00
Dmitry Vyukov
ba92288dcf executor: ignore prctl in fallback coverage
Some prctl commands don't respect the normal convention for return values
(e.g. PR_GET_TIMERSLACK, but there are more) and may produce all possible
errno values. This conflicts with fallback coverage.
2020-01-15 17:35:31 +01:00
Dmitry Vyukov
b67897d4d1 sys/linux: extend and improve NFNL_SUBSYS_NFTABLES descriptions 2020-01-15 16:06:10 +01:00
Dmitry Vyukov
02b6b5430a sys/linux: add NFNL_SUBSYS_NFTABLES descriptions 2020-01-14 19:55:25 +01:00
Dmitry Vyukov
3288120597 sys/linux: add NFNL_SUBSYS_CTNETLINK_TIMEOUT descriptions 2020-01-13 18:02:45 +01:00
Andrey Konovalov
23f3478a8c executor: provide explicit values for usb_raw_event_type
To match the kernel uapi headers.
2020-01-13 16:14:45 +01:00
Dmitry Vyukov
99565c1a26 sys/linux: add NFNL_SUBSYS_ACCT descriptions 2020-01-13 07:58:58 +01:00
Dmitry Vyukov
76bd6dd281 sys/linux: add NFNL_SUBSYS_OSF descriptions 2020-01-13 07:58:56 +01:00
Dmitry Vyukov
53faa9fe74 sys/freebsd: fix ipv6_packet name
The common code now expects it to be called ipv6_packet_t.
The freebsd fork wasn't updated when the linux version changed.
2020-01-12 14:01:45 +01:00
Dmitry Vyukov
31290a4541 sys/linux: open more files from procfs 2020-01-12 11:13:18 +01:00
Dmitry Vyukov
4de4e9f01d sys/linux: add NFNL_SUBSYS_ULOG descriptions 2020-01-09 15:13:17 +01:00
Dmitry Vyukov
a41d89c7c9 sys/linux: add NFNL_SUBSYS_QUEUE descriptions 2020-01-09 14:44:40 +01:00
Dmitry Vyukov
d817520681 sys/linux: few minor ipset improvements.
1. Add "bitmap:port" type.
2. ipv4/6 addresses must be in network byte order.
2020-01-07 12:41:07 +01:00
Dmitry Vyukov
1bcd407ecb sys/linux: add ipset descriptions 2020-01-07 10:02:11 +01:00
Dmitry Vyukov
a0f466387d sys/linux: fix 2 netlink data layout bugs
1. Turns out that NLA_F_NESTED is actually used and checked
(nla_parse_nested checks it, while nla_parse_nested_deprecated does not).
Similarly, ipset extensively checks NLA_F_NET_BYTEORDER.
So we need these bits.

2. nla_len must not account for the trailing alighnment padding.
This means we set wrong len for payloads that are not multiple of 4
(int8/int16/strings/arrays/some structs/etc).
2020-01-07 10:02:10 +01:00
Dmitry Vyukov
d2bde102ff pkg/compiler: fix another bitfield layout bug
See the added test for details.
2020-01-07 10:02:09 +01:00
Andrey Konovalov
6738080fea executor: setns requires including sched.h on some setups 2020-01-07 10:02:02 +01:00
Dmitry Vyukov
d83499aa56 sys/linux: add NFNL_SUBSYS_CTHELPER/NFNL_SUBSYS_CTNETLINK_EXP descriptions 2020-01-05 17:15:59 +01:00
Dmitry Vyukov
d646e21ff4 prog: fix tests for string enforcement
String value enforcement broke a number of tests
where we use different values.
Be more string as to what string values we use in tests.
Required to add tmpfs descriptions to test syz_mount_image.
Also special-casing AF_ALG algorithms as these are auto-generated.
2020-01-05 12:50:29 +01:00
Dmitry Vyukov
c5f5069930 sys/linux: add AF_NETLINK/NETLINK_NETFILTER/NFNL_SUBSYS_CTNETLINK descriptions 2020-01-05 11:46:36 +01:00
Dmitry Vyukov
026aaeb2b5 prog: don't mutate strings with enumerated values
Strings with enumerated values are frequently file names
or have complete enumeration of relevant values.
Mutating complete enumeration if not very profitable.
Mutating file names leads to escaping paths and
fuzzer messing with things it is not supposed to mess with as in:

r0 = openat$apparmor_task_exec(0xffffffffffffff9c, &(0x7f0000000440)='/proc/self//exe\x00', 0x3, 0x0)
2020-01-05 11:46:35 +01:00
Dmitry Vyukov
682569741a executor: fix IPVLAN_F_VEPA definition again
Now other machines failed with redefinition IPVLAN_F_VEPA.
The #ifndef does not really work the way it should due
to the way pkg/csource preprocesses sources.
IPVLAN_F_VEPA is never defined during preprocessing.
Let's try this.
2020-01-03 21:47:45 +01:00
Dmitry Vyukov
9c216c0182 sys/linux: add vlan/macvlan/ipvlan/mactap device policies 2020-01-03 21:35:40 +01:00
Dmitry Vyukov
0d1a814324 executor: define constants that are missing on some distros 2020-01-03 21:34:46 +01:00
Dmitry Vyukov
76d86b16e6 executor: setup vlan/macvlan/ipvlan devices 2020-01-03 19:01:39 +01:00
Dmitry Vyukov
b485b85127 sys/linux: add basic AF_PHONET descriptions 2020-01-03 17:36:36 +01:00
Dmitry Vyukov
b2a0884c1b sys/linux: add minimal AFS descriptions 2020-01-03 17:04:29 +01:00
Dmitry Vyukov
8ff25100c2 sys/linux: add 80211 descriptions 2020-01-03 16:11:49 +01:00
Dmitry Vyukov
7ec787382c sys/linux: fix SIOCGIFINDEX
Mark ifindex as opt in SIOCGIFINDEX.
Otherwise it's considered inout and SIOCGIFINDEX can't be used
to produce ifindex'es on its own. It requires an input ifindex
first and only then it can output own ifindex.
2020-01-03 16:11:49 +01:00
Dmitry Vyukov
fca6a74d0c executor: connect virt_wifi to veth
virt_wifi docs say that the enslaved device won't be usable
on itself. It's probably not a good idea to make lo unusable.
Enslave a dedicated veth instead.
2020-01-03 16:11:49 +01:00
Dmitry Vyukov
4e3e3c8d4b sys/linux: add netlabel descriptions 2020-01-03 16:11:49 +01:00
Dmitry Vyukov
21d4f173c5 sys/linux: improve ipv4/ipv6 vnet descriptions
1. Use optional[T] instead of array[T, 0:1].
2. Deduplicate 3 copies of ARP packet.
3. Deduplicate IPOPT_LSRR/IPOPT_SSRR/IPOPT_RR.
4. More precise description of IPOPT_TIMESTAMP/IPOPT_LSRR/IPOPT_SSRR/IPOPT_RR.
5. Don't use IPOPT_END/IPOPT_NOOP in generic option (they have different format).
6. Restrict cipso doi values.
7. Fix IPOPT_RA value type (int16 instead of int32).
8. Match ipv4/ipv6 packet type with payload.
9. Prefer 0 frag_off for ipv4 packets (they are extremely hard to get right).
2020-01-03 16:11:49 +01:00
Dmitry Vyukov
25a0186eba sys/linux: add IPPROTO_L2TP descriptions 2019-12-31 10:52:22 +01:00
Dmitry Vyukov
7f117e28b8 sys/linux: add virt_wifi and xfrm devices
+ some netlink descriptions
2019-12-30 20:18:14 +01:00
Dmitry Vyukov
28a9676c17 sys/linux: add {MSG,SEM,SHM}_STAT_ANY 2019-12-30 16:37:38 +01:00
Dmitry Vyukov
be5c2c8197 sys/linux: fix 32-bit warnings
Lots of interesting findings...
Especially 2 byte uid/gid/pid.

Update #590
2019-12-23 10:56:16 +01:00
Dmitry Vyukov
4b042b7d67 sys/linux: fix int64 alignment on 386
Turns out int64 alignment is 4 on 386...
But on arm it's still 8.

Another amusing finding thanks to syz-check.

Update #590
2019-12-23 08:57:42 +01:00