Commit Graph

1311 Commits

Author SHA1 Message Date
Kamil Rytarowski
775a8882a6 pkg/build: Raise the timeout limit to 30min for building LLVM (tools) 2020-02-22 10:02:01 +01:00
Dmitry Vyukov
4428511d10 sys/linux: add NETLINK_RDMA descriptions 2020-02-21 17:38:10 +01:00
Dmitry Vyukov
135c18aadb tools: add script that checks copyright headers
Fixes #1604
2020-02-18 16:05:10 +01:00
Dmitry Vyukov
39cd0f85a1 executor: disable IFF_NAPI_FRAGS
Update #1594
2020-02-18 10:31:02 +01:00
Jason A. Donenfeld
c5ed587f4a
wireguard: setup some initial devices in a triangle
* wireguard: setup some initial devices in a triangle

The fuzzer will wind up undoing some of this, which is fine, but at
least it now has the chance of hitting some other paths it wasn't
before.

Closes: #1599

* wireguard: make code ugly after `make generate` pass

* wireguard: get rid of unused structs that are still interesting

* wireguard: compile in C++ mode with gcc 7

Complex designated initializers are only supported in C++ mode from gcc
8, and for whatever reason syzkaller wants to be compiled in C++ mode.

* wireguard: add braces around debug statements for checker

* wireguard: regenerate go source
2020-02-13 15:28:57 +01:00
Dmitry Vyukov
e624765350 pkg/csource: don't print too much error output
We print whole reproducer programs on failure,
if lots of programs fail, this results in thousands
of lines of output, which is esp bad on travis.
Limit amount of output.
2020-02-13 13:26:26 +01:00
Dmitry Vyukov
18847f55bb pkg/ast: introduce hex-encoded string literals
The stringnozescapes does not make sense with filename,
also we may need similar escaping for string flags.
Handle escaped strings on ast level instead.
This avoids introducing new type and works seamleassly with flags.

As alternative I've also tried using strconv.Quote/Unquote
but it leads to ugly half-escaped strings:
"\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn"

Make hex-encoded strings a separate string format instead.
2020-02-10 14:45:20 +01:00
Jason A. Donenfeld
b97dee873b pkg/compiler: allow for escaped strings
This adds stringnozescapes to allow parsing of escape sequences in
strings.
2020-02-10 10:51:16 +01:00
Jason A. Donenfeld
4f86d32773 wireguard: use wg0, wg1, wg2
This matches more closely what people are used to dealing with. We also
add one additional device for interesting multi-interface effects.
2020-02-10 10:51:16 +01:00
Dmitry Vyukov
553630e1a9 pkg/ipc: remove use of unsafe
Unsafe is, well, unsafe.
Plus it fails under the new checkptr mode in go1.14.
Remove some uses of unsafe.
2020-02-09 14:09:19 +02:00
Dmitry Vyukov
93e5e33559 pkg/report: update parsing of rcu stalls in ioctls
vfs_ioctl is now inlined somethimes...
2020-02-02 12:56:15 +01:00
Dmitry Vyukov
c30117b2ac pkg/report: don't attribute deadlocks to workqueue functions
In all cases we seen deadlocks in workqueue functions are related
to the subsystem that submits work items.
2020-01-31 19:14:47 +01:00
Dmitry Vyukov
96ce537b15 sys/linux: add some wireguard descriptions
Update #806
2020-01-31 19:12:16 +01:00
Dmitry Vyukov
b190f06061 dashboard/app: fix testing for go1.11 runtime
0. Remove aetest build tag. We don't need it anymore, go test should work.
1. IsDevAppServer does not return true in tests anymore, so don't use it
2. Use a different mechanism to register test/prod config.
We don't have aetest tag anymore, so we need something even more dynamic.
3. Fix new golangci-lint warnings: all test files are checked now.

Update #1461
2020-01-29 16:01:06 +01:00
Dmitry Vyukov
0692a5861f pkg/report: add a note about an existing suppression 2020-01-28 13:38:53 +01:00
Dmitry Vyukov
dd56146d26 prog: remove unused ResourceDesc.Type 2020-01-26 11:30:18 +01:00
Dmitry Vyukov
55da6462ff pkg/serializer: do not write field names if it won't save space
If we are going to write all values, don't write field names.
This only increases size of generated files.
The change reduces size of generated files by 5.8%
(62870496-59410354=3460142 bytes saved).
2020-01-26 11:07:18 +01:00
Dmitry Vyukov
2e95ab3357 pkg/build: switch to sha256
SHA-1 is insecure. See a representative summary of known attacks here:
https://en.wikipedia.org/wiki/Hash_function_security_summary
Some external build systems warn about sha1 uses and reject to build.
Whitelisting is pain. Switch to sha256.
2020-01-23 16:11:47 +01:00
Dmitry Vyukov
02754a8f9a tools/syz-check: check netlink policy descriptions
Overall idea of netlink checking.
Currnetly we check netlink policies for common detectable mistakes.
First, we detect what looks like a netlink policy in our descriptions
(these are structs/unions only with nlattr/nlnext/nlnetw fields).
Then we find corresponding symbols (offset/size) in vmlinux using nm.
Then we read elf headers and locate where these symbols are in the rodata section.
Then read in the symbol data, which is an array of nla_policy structs.
These structs allow to easily figure out type/size of attributes.
Finally we compare our descriptions with the kernel policy description.

Update #590
2020-01-22 12:19:53 +01:00
Dmitry Vyukov
d2557fb5ca pkg/report: treat nfnetlink_rcv_msg as anchor frame
There is tremendous branching after that frame to all
existing netlink callbacks which are effectively completely
different syscalls.
2020-01-20 10:57:28 +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
3de7aabbb7 pkg/vcs: disable CONFIG_DEBUG_KOBJECT during bisection
We disabled it in configs, now also disable during bisection.
This config only adds debug output. It should not be enabled at all,
but it was accidentially enabled on some instances for some periods of time,
and kernel is boot-broken for prolonged ranges of commits with deadlock
which makes bisections take weeks.
2020-01-16 11:31:02 +01:00
Jann Horn
069a5a4486 pkg/report: add pattern for Linux #SS faults
On X86-64, dereferencing a non-canonical address normally causes a #GP, for
which syzkaller already has a pattern. However, if the base register of the
non-canonical address is RBP (which can happen in builds that use RBP as a
general-purpose register because they don't use frame pointer unwinding),
#SS is thrown instead, for which syzkaller did not yet have a pattern.

To see this kind of fault, you can insert the following code in
kernel_init() after the call to rcu_end_inkernel_boot():

	asm volatile(
		"movabs $0x8000000000000000, %rbp\n\t"
		"movq (%rbp), %rax\n\t"
		"ud2\n\t"
	);

Linux prints a different error message for #SS, so add that error message
to syzkaller's list of patterns.
2020-01-15 16:06:40 +01:00
Andrew Turner
fa12bd3c2e pkg/report: Add the calling function to sx reports
These can fail in many functions, include the calling function in
the report
2020-01-14 19:55:46 +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
Andrey Konovalov
a20859865e pkg/report: add more ignored frames 2020-01-07 16:02:48 +01:00
Dmitry Vyukov
7042566e4b pkg/email: accept #syz- prefix for commands
Some users spell the command as "#syz-dup:".
Support this and few more variations.
2020-01-07 14:32:50 +01:00
Dmitry Vyukov
7824163310 pkg/vcs: disable CONFIG_DEBUG_INFO_BTF during bisection
BTF fails lots of builds with:
pahole version v1.9 is too old, need at least v1.13
Failed to generate BTF for vmlinux. Try to disable CONFIG_DEBUG_INFO_BTF.
2020-01-07 11:31:59 +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
c43471c3ac pkg/repro: simplify C repros over DevlinkPCI 2020-01-07 10:02:02 +01:00
Andrey Konovalov
6738080fea executor: setns requires including sched.h on some setups 2020-01-07 10:02:02 +01:00
Anton Lindqvist
53430d9719 pkg/report: normalize kqueue_check report on OpenBSD 2020-01-06 20:37:03 +01:00
Dmitry Vyukov
438e122712 pkg/host: fix detection of enabled LSMs
securityfs may not be mounted, but it does not mean that no LSMs are enabled.
2020-01-05 17:48:19 +01:00
Dmitry Vyukov
b726d37627 pkg/host: detect unsupported LSMs 2020-01-05 11:46:32 +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
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
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
5e3bc74104 pkg/cover: support out-of-tree linux build
Looks for source files in object dir.
This is required for out-of-tree linux builds.
E.g. security/selinux/flask.h contains some sources
with coverage callbacks, but it's auto-generated
and located in the build dir.
2020-01-03 16:11:49 +01:00
Anton Lindqvist
9dcc1191cb pkg/report: normalize unhandled af report on OpenBSD 2020-01-03 08:37:12 +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
6b36d33868 syz-manager: corpus rotation
Use a random subset of syscalls/corpus/coverage for each individual VM run.
Hypothesis is that this should allow fuzzer to get more coverage
find more bugs in saturated state (stuck in local optimum).
See the issue and comments for details.

Update #1348
2019-12-30 16:37:38 +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
Dmitry Vyukov
ae5ed0b140 pkg/compiler: fix bitfield layout bug
Fixes #1542

Found thanks to syz-check. Update #590
2019-12-20 16:45:34 +01:00
Dmitry Vyukov
4bba9fd162 pkg/compiler: fix alignment of string-formatted values
We used size as alignment, this is very wrong.

Found thanks to syz-check. Update #590
2019-12-20 16:45:34 +01:00