Commit Graph

1311 Commits

Author SHA1 Message Date
Marco Elver
5681358a2a syz-fuzzer, executor: Add support for blacklisting data race frames
This adds support to add frames that have already been in data races, to
the KCSAN report blacklist.
2019-10-22 17:48:18 +02:00
Dmitry Vyukov
788abb174f pkg/vcs: detect old git binary that can't do bisection 2019-10-22 15:57:26 +02:00
Dmitry Vyukov
084e388155 pkg/vcs: make EnvForCommit return full compiler path
All callers of EnvForCommit need the compiler path,
so move this logic into EnvForCommit to avoid duplication.
Also simplifies tests because test impl can now return
an empty compiler (which should be unused).
2019-10-22 15:41:03 +02:00
Zubin Mithra
a2bdbd8c37 pkg/bisect: add initial testing support for cause bisection
(note: incomplete change)

Refactor existing code as follows:
* Move reusable test utility functions from git_repo_test.go to
pkg/vcs/test_util.go and make them exported.
* Split Run() into Run()+runImpl().
* Change type of bisect.go:env.inst to `instance.BuilderTester`.
Change usage inside syz-testbuild/testbuild.go accordingly.
* Move most of linux.PreviousReleaseTags() into vcs/git.go as
git.previousReleaseTags().
* Allow build.CompilerIdentity to be mocked.

Introduce the following changes:
* instance.BuilderTester is an interface with methods
	BuildSyzkaller()
	BuildKernel()
	Test()
NewEnv() now returns this interface.
* type testEnv implements instance.BuilderTester.
* type testBuilder implements builder interface. Add a entry into table
inside pkg/build/build.go:getBuilder() to return testBuilder object.
2019-10-22 10:09:57 +02:00
Dmitry Vyukov
37dc03de04 pkg/report: improve parsing of task hung reports
The problem with task hung reports is that they manifest at random victim stacks,
rather at the root cause stack. E.g. if there is something wrong with RCU subsystem,
we are getting hangs all over the kernel on all synchronize_* calls.
So before resotring to the common logic of skipping some common frames,
we look for 2 common buckets: hangs on synchronize_rcu and hangs on rtnl_lock
and group these together.
2019-10-22 09:52:16 +02:00
Andrey Konovalov
6901a56e00 executor/usb: enable endpoints on SET_INTERFACE
This commit changes syz_usb_control_io to enable the relevant endpoints
for the interface being set via a SET_INTERFACE request.
2019-10-21 15:56:03 +02:00
Andrew Donnellan
a6aef847d9 pkg/report: Add ppc64le kernel paging request test case
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-10-14 11:17:24 +02:00
Andrew Donnellan
d18522a287 pkg/report: Add regexes for kernel data access BUG on ppc64le
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-10-14 11:17:24 +02:00
Andrew Donnellan
05c1b98356 pkg/report: Fix linuxRipFrame regex for ppc64le
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-10-14 11:17:24 +02:00
Anton Lindqvist
2f661ec405 pkg/report: normalize malloc free list modified reports on OpenBSD 2019-10-13 10:31:52 +02:00
Dmitry Vyukov
a4efa8c091 pkg/compiler: fix infinite recursion in template instantiation
Currently we replace a template argument and then recurse
into the new type AST to see if there is more to replace.
If the description is buggy and the template argument
contains itself, then we will recurse infintiely trying
to replace it more and more.
Use post-order traversal when replacing template argument to fix this.
2019-10-10 11:57:33 +02:00
Kamil Rytarowski
c4b9981b5f Disable checkFeature[FeatureNetworkInjection] for NetBSD
There is a problem with the image. Until the problem will be resolved,
disable the feature as it causes premature death of the syzbot setup.
2019-10-09 19:16:07 +02:00
Dmitry Vyukov
b1ebbfef72 pkg/report: fix up test 2019-10-08 16:36:45 +02:00
Dmitry Vyukov
ec93713427 pkg/report: ignore mutex_slowlock in task hung reports 2019-10-08 16:06:25 +02:00
Marco Elver
137e37cac2 Change KCSAN info file to debugfs 2019-10-08 15:04:54 +02:00
Dmitry Vyukov
28ac6e6496 pkg/report: fix ODEBUG parsing for v4.4 2019-10-07 09:37:24 +02:00
Marco Elver
69b8b8fa36 pkg/report: Fix formatting 2019-10-04 16:46:37 +02:00
Marco Elver
c86336cf24 pkt/report: Shorten KCSAN report titles 2019-10-04 15:52:40 +02:00
Marco Elver
b2f369e56e executor, host, csource: Add support to enable KCSAN
By default, the current KCSAN .config does not enable KCSAN during boot,
since we encounter races during boot which would prevent syzkaller from
ever executing.

This adds support to detect if KCSAN is available, and enables it on the
fuzzer host.
2019-10-04 13:44:09 +02:00
Anton Lindqvist
eb6b9855e0 pkg/report: improve uvm_fault reports on OpenBSD
Some reports[1] does not include a symbol but rather an address in the
"Stopped at" line. There's unfortunately no useful context to add to the
title so make them generic instead.

[1] https://syzkaller.appspot.com/bug?id=3e44d0b128fd8d6826e4d0044baadcfc02ba7125
2019-09-28 12:05:58 +02:00
Anton Lindqvist
2f1548bc77 pkg/report: normalize attempt to execute user address reports on OpenBSD (#1431) 2019-09-26 12:52:00 -07:00
Andrey Konovalov
24d405a355 pkg/report: improve USB reports 2019-09-25 18:48:23 +02:00
Andrey Konovalov
a3355dba73 pkg/report: improve USB reports
tty_unregister_device looks generic enough, add to ignore list.
2019-09-25 14:55:31 +02:00
Andrey Konovalov
0942eab8c6 pkg/report: improve USB report titles 2019-09-24 15:15:04 +02:00
Andrey Konovalov
792da3da86 executor, csource: adjust syz_open_dev$hiddev timeout
Looks like opening hiddev can take up to ~100 ms.
2019-09-24 10:45:51 +02:00
Andrey Konovalov
5ff4e14cb1 pkg/runtest: allow empty signal 2019-09-24 10:45:51 +02:00
Anton Lindqvist
aac00cc3db pkg/vcs: handle git commits without a body
OpenBSD uses cvs and does not enforce the standard Git convention for
commit messages of putting a summary followed by a new line and body.
If such commit[1] contains a `Reported-by` header, it's currently not
detected. Instead, if the body is empty try to extract data from the
commit summary.

[1] bdbfbec5ce
2019-09-24 10:43:57 +02:00
Mark Johnston
83620b5b4e pkg/report: deduplicate some common FreeBSD panics 2019-09-24 10:42:43 +02:00
Veronica Radu
5a7028d005 pkg/db: moved ReadCorpus function to avoid duplicate code 2019-09-23 15:35:26 +02:00
Dmitry Vyukov
d96e88f320 pkg/report: add a test case which we mis-handle now 2019-09-20 09:37:36 +02:00
Andrey Konovalov
4d3ae0b784 executor: handle USB IN requests with wLength == 0 2019-09-19 19:31:56 +02:00
Andrey Konovalov
0c00210ff3 executor: always provide DEVICE_QUALIFIER USB descriptor 2019-09-19 19:31:56 +02:00
Siddharth M
7fa5d0a69b pkg/build: build netbsd using config files 2019-09-18 15:00:55 +02:00
Dmitry Vyukov
ad847b96aa pkg/report: ignore "INFO: recovery required on readonly filesystem"
This is not a kernel bug.
2019-09-17 16:14:31 +02:00
Andrey Konovalov
d62be7809c runtest: add a flag to specify tests to run 2019-09-17 15:58:29 +02:00
Andrey Konovalov
5883acb646 pkg/report: improve some USB reports 2019-09-17 15:09:43 +02:00
Andrey Konovalov
51ca0454d7 pkg/osutil: fix arm build
pkg/osutil/osutil_linux.go:44:13: cannot use info.Totalram (type uint32) as type uint64 in return argument
2019-09-16 14:15:38 +02:00
Marco Vanotti
40fa42bc27 executor/fuchsia: close vmo handle in syz_mmap.
This commit fixes a handle leak in syz_mmap. The bug was pointed out by
mdempsky during a code review.

The `syz_mmap` function creates a VMO and maps it to a VMAR in the address
specified by the `syz_mmap` parameters. Once a VMO is mapped to a vmar,
the handle to the vmo can be closed without problems.

The new code makes sure that `zx_handle_close(vmo_handle)` gets called before
the `syz_mmap` function returns.
2019-09-12 21:17:27 -03:00
Marco Vanotti
f4e53c1037 executor/fuchsia: don't crash on syz_mmap failure.
syz_mmap is a pseudo-syscall that can be used by syzkaller in fuzzing
programs, however, it is also used to setup the environment for
syz-executor. syz-executor already checks the return value[0] when it is
used for setting up the environment, so it doesn't make sense for the
function to crash (most probably, in a fuzzing program it will be called
with arguments that would make it fail).

The previous behavior was causing a bunch of "Lost connection to test
machine" syzkaller crashes which were meaningless. An example of a
program in which syz_mmap would crash would be any program in which the
handle to the root vmar is closed before calling syz_mmap.

[0]:
a60cb4cd84/executor/executor_fuchsia.h (L15)
2019-09-11 16:38:45 -03:00
Marco Vanotti
000d39a9b8 pkg/ipc: Send output from syz-executor for non-Forkserver oses.
This change reuses the logic for sending the output back from
syz-executor to syz-fuzzer that forkserver oses use: reading it
periodically. This will be useful for debugging issues in Fuchsia that
does not support forkserver yet.
2019-09-11 16:38:45 -03:00
Andrey Konovalov
a60cb4cd84 executor/usb: use UTF16 encoding for default string
Also respond with lang ID when string #0 is requested.
2019-09-06 20:11:54 +02:00
Andrey Konovalov
3fe4b3b1aa executor/usb: fix null-ptr-deref in syz_usb_control_io 2019-09-06 20:11:54 +02:00
Andrey Konovalov
1af11d9328 executor/usb: improve debugging messages 2019-09-06 20:11:54 +02:00
Andrey Konovalov
2d7c71133a executor/usb: allow syz_usb_control_io args to be 0 2019-09-06 20:11:54 +02:00
Andrey Konovalov
a38da1b89a sys/linux, executor: basic support for multiple USB interfaces 2019-09-06 17:19:55 +02:00
Andrey Konovalov
c16be727a6 executor: fix sigsegv for default USB string response 2019-09-05 19:03:35 +02:00
Andrey Konovalov
3977854c2a
pkg/compiler: remove fixed TODO (#1376) 2019-09-04 12:58:59 +02:00
Dmitry Vyukov
b0e5f924b5 pkg/report: update ODEBUG warning format
It seems something has changed in the kernel again...
2019-09-04 10:35:20 +02:00
Andrey Konovalov
a50398545a pkg/compiler: detect unused template params 2019-09-04 07:10:15 +02:00
Dmitry Vyukov
8d48456885 tools/syz-symbolize: fix kernel dir calculation
syz-symbolize did not use the common mgrconfig logic
to calculate kernel dirs. Thus KernelBuildSrc ended up empty,
+dirs were not extended to absolute paths.
Use the common mgrconfig logic to calculate kernel dirs.
2019-09-03 15:00:40 +02:00
Andrey Konovalov
7ca47f80a8
pkg/report: improve USB reports (#1372) 2019-09-03 14:09:51 +02:00
Dmitry Vyukov
14544a569e pkg/build: fix linux make invocation
-j flag is weird, make fails on -j=N.
2019-09-02 07:41:19 +02:00
Dmitry Vyukov
db7c31ca79 pkg/build: make linux builds more deterministic
Kbuild inserts build timestamp into every build.
This makes vmlinux change always even if no present.
Make the build more deterministic.
We plan to use it for detecting no-op changes during bisection.

Update #1271
2019-09-01 20:42:42 -07:00
Dmitry Vyukov
aaf9e5bb5e pkg/build: factor out linux make execution
Remove duplication when calling linux make.
2019-09-01 20:42:35 -07:00
Zubin Mithra
bad3cce26c dashboard/app: allow reporting of BisectFix results
* Modify mail_bisect_result.txt to allow for sending fix bisection
results.
* Modify BisectResult to have a Fix field; introduce selectBisect for
use within the template for choosing between BisectCause/BisectFix
fields.
* Modify bisectFromJob() to return BisectResult with Fix field set if
relevant.
* Modify the tests inside bisect_test.go to account for bisect fix
related reporting emails.
* Modify incomingMail() to ignore any emails from syzbot itself.
2019-08-30 19:50:12 -07:00
Anton Lindqvist
9adfa8760f pkg/report: improve witness extraction for OpenBSD
Reports from witness regarding returning to userspace with locks held is not
unique enough, causing all lock leaks to be grouped under the same bug.
Instead try to extract the name of syscall where the first held lock was
grabbed.

While here, shorten the title a bit.
2019-08-30 06:13:56 -07:00
Matthew Dempsky
fd37b39ea8 all: convert Fuchsia to use "host fuzzing" mode
Go support is not a priority for Fuchsia at the moment, so it's
preferable to use host fuzzing mode for Fuchsia like currently done
for Akaros.

This commit basically looks for all the places where there was special
logic for OS=="akaros" and extends the same logic for OS=="fuchsia".
2019-08-27 14:39:18 -07:00
Andrey Konovalov
78ded1969a
sys/linux, executor: minor USB fixes (#1361) 2019-08-23 14:50:37 +02:00
Michael Pratt
d003d6d021 Merge pull request #1338 from prattmic/patch-3
pkg/report: ignore exceeded race limits
2019-08-22 07:21:17 -07:00
Michael Pratt
b231f4c271 pkg/gvisor: suppress one more gvisor PID exhaustion 2019-08-22 07:21:09 -07:00
Andrey Konovalov
c6c81a0bd3
executor: fix procid not declared properly for netbsd (#1358) 2019-08-22 14:49:06 +02:00
Andrey Konovalov
0ab81da2cf
pkg/report: revert bucketing MAX_STACK_TRACE_ENTRIES reports (#1357)
MAX_STACK_TRACE_ENTRIES crash reports caused by a particular issues can come
from any part of the kernel, so bucketing them based on the stack trace is
pointless and only creates duplicate bug reports.
2019-08-22 14:42:17 +02:00
Siddharth M
8570f91c22 pkg/csource: fix failing syz-runtest for NetBSD
* pkg/csource: fix failing syz-runtest for NetBSD

* update common.go
2019-08-21 07:13:43 -07:00
Andrey Konovalov
5e0a9c712f pkg/report: improve netdev reports titles 2019-08-21 07:09:54 -07:00
Marco Vanotti
4ea67ff893 pkg/build: use sandbox to build fuchsia.
We have noticed that the build process was being invoked as root. This
change modifies the calls to use osutil.Sandbox before invoking cmds to
build fuchsia.

This is required for the process to use goma, as goma is running under
the syzkaller user.
2019-08-20 18:47:02 -07:00
Andrey Konovalov
ae348fb726 pkg/report: ignore finish_wait frame 2019-08-19 09:44:52 -07:00
Andrey Konovalov
8fd428a197 pkg/report: improve ODEBUG titles 2019-08-15 13:39:03 -07:00
Marco Vanotti
5576551bab pkg/build: increase timeout for building fuchsia 2019-08-14 09:34:25 +02:00
Andrey Konovalov
ef801a3eab
pkg/report: improve some titles (#1332)
* pkg/report: improve BUG: MAX_STACK_TRACE_ENTRIES titles

* pkg/report: improve refcount bug titles
2019-08-13 19:05:24 +02:00
Andrey Konovalov
acb5163814
sys/linux: add basic USB CDC Ethernet descriptions (#1328) 2019-08-09 19:46:27 +02:00
Dmitry Vyukov
c576290a35 pkg/host: fix linux netdevices detection
We don't use ip command for netdevices and tun setup.
2019-08-09 18:20:11 +02:00
Zubin Mithra
a02b5bcae2 dashboard/app: allow main UI to show bisect results
* Modify uiBug type. Rename BisectCause to BisectCauseDone. Introduce
BisectFixDone.
* Modify createUIBug() and MergeUIBug() to set the above fields
appropriately.
* Modify bug_list to display the bisection status; remove yesSort() as
it is not used anymore. Adjust ".list_table .stat" to appropriate width.
* Add TestBugBisectionStatus() to check bisection status on main page.
* Add file from running "make generate": pkg/html/generated.go
2019-08-08 15:58:57 +02:00
Andrey Konovalov
657092bddf pkg/report: add KMSAN kernel-usb-infoleak tests 2019-08-08 15:57:02 +02:00
R3x
bcc419e941 executer/common_bsd.h: increase the number of tap/tun devices for NetBSD 2019-08-08 15:23:39 +02:00
Andrey Konovalov
8f0516c5fa pkg/report: ignore flush_work related frames 2019-08-08 15:19:28 +02:00
Andrey Konovalov
e6ebef88ac
executor: add some USB realted TODOs (#1319)
Also simplify timeout related code a bit.
2019-08-07 18:11:33 +02:00
Mark Johnston
6affd8e838 pkg/build: Enable additional invariants-checking in FreeBSD kernels 2019-08-02 14:38:31 -04:00
Dmitry Vyukov
7c7ded697e prog: fix out-of-bounds access
ParseLog can access data out-of-bounds.
Fix that and fix regression fuzz tests to catch this.
2019-07-30 19:33:02 +02:00
Dmitry Vyukov
3b37734422 pkg/ast: fix out-of-bounds access
Scanner can access data out of bounds on bad input.
Also fix regression fuzz test to be able to detect the bug.
2019-07-30 18:43:14 +02:00
Dmitry Vyukov
314ea0c952 pkg/compiler: refactor regression fuzz test
Reuse most of the existing Fuzz function
rather than duplicate the logic.
2019-07-30 18:38:35 +02:00
Dmitry Vyukov
c85e1c5be9 pkg/cover: hierarchical coverage reports
Better coverage reports with hierarchical coverage information,
number of programs covering each line,
handling of partially covered lines,
links to programs covering lines.

Fixes #682
2019-07-26 19:32:14 +02:00
Dmitry Vyukov
de453f342b pkg/csource: skip cross-builds that are doomed to fail
OpenBSD instance failed with:

--- FAIL: TestSysTests (12.50s)
    --- FAIL: TestSysTests/linux/386 (0.16s)
        csource_test.go:145: failed to generate C source for ../../sys/linux/test/binder: cpp failed: exec: "cant-build-linux-on-openbsd": executable file not found in $PATH
...

Skip unsupported cross-builds in TestSysTests.
2019-07-23 10:01:44 +02:00
Dmitry Vyukov
78f30a5156 pkg/report: fix linux path prefix trimming
After f613a7c4 ("pkg/cover: fix prefix computation") we stopped trimming
starting "/" from linux path names. This broke get_maintainers.pl script
which is now given non-existent absolute paths (e.g. "/mm/mmap.c"),
as the result syzbot can't find any maintainers for bug reports
and mails them into lkml limbo.

Trim starting slashes and dots. Extend tests for catch this.
2019-07-23 09:24:09 +02:00
Dmitry Vyukov
d9ec038e02 pkg/report: refactor argument passing
We now pass 5 arguments through a bunch of functions,
this is quite inconvinient when the set of arguments changes.
Incapsulate all arguments in a struct and pass/store it as a whole.
2019-07-23 09:15:43 +02:00
Marco Vanotti
f171a40c6b pkg/build: change gcc for clang in fuchsia
Recently fuchsia changed the default compiler from GCC to clang. This
change updates the paths in the build package.
2019-07-23 08:44:20 +02:00
Marco Vanotti
5aec592bda pkg/build: Add ssh keys for fuchsia
This change modifies the way fuchsia is built to add the ssh keys to the
zbi image after building it. Previously that was done via the
"extra_ssh_keys" argument to the build system, but that was removed
recently.
2019-07-23 08:44:20 +02:00
Dmitry Vyukov
f3ad684464 executor: drop CAP_SYS_NICE
A process with CAP_SYS_NICE can bring kernel down by asking for too high SCHED_DEADLINE priority,
as the result rcu and other system services that use kernel threads will stop functioning.
Some parameters for SCHED_DEADLINE should be OK, but we don't have means to enforce
values of indirect syscall arguments. Peter Zijlstra proposed sysctl_deadline_period_{min,max}
which could be used to enfore safe limits without droppping CAP_SYS_NICE, but we don't have it yet.
See the following bug for details:
https://groups.google.com/forum/#!topic/syzkaller-bugs/G6Wl_PKPIWI
2019-07-22 11:59:00 +02:00
Dmitry Vyukov
5181b54d45 executor: drop CAP_SYS_PTRACE with sandbox=none
We only drop CAP_SYS_PTRACE for sandbox=namespace,
but it can equally affect testing with sandbox=none.
Drop it for sandbox=none, add a test.
2019-07-22 11:51:53 +02:00
Dmitry Vyukov
e530ec1bef pkg/csource: test sys/*/test programs
Running sys/*/test programs requires real machines and kernels for each OS.
We can't do that in unit tests, but at least try to deserialize these programs
so that they don't get rotten.
2019-07-22 10:20:51 +02:00
Dmitry Vyukov
d8b4c311be pkg/mgrconfig: add example for "enable_syscalls" 2019-07-22 09:27:11 +02:00
Dmitry Vyukov
18678d6989 pkg/report: support older format of "bad usercopy" 2019-07-22 09:07:23 +02:00
Dmitry Vyukov
8304907db0 tools/syz-env: restrict Makefile parallelism based on RAM
Ensure that we have at least 1GB per Makefile job.
Go compiler/linker can consume significant amount of memory
(observed to consume at least 600MB). See #1276 for context.
Update #1276
2019-07-19 09:51:07 +02:00
Dmitry Vyukov
f53c0235fa pkg/cover: fix objdump process hang
One instance we observed that objdump hanged due to stdout
pipe overflow due to panic in archCallInsn.
The reason for the original panic is still unclear,
but fix the objdump hang. We need to terminate objdump
and propagate the panic.
Also extend the panic messages.
2019-07-18 09:37:07 +02:00
Siddharth M
f613a7c41d pkg/cover: fix prefix computation
* pkg/cover: Modify parsing logic
1. Remove prefix computation
2. Add a mgrconfig for kernel build directory

* pkg/report: shorten reports with kernelBuildSrc instead of kernelSrc

* pkg/report: Fix failing tests

* pkg/report: fix formating issues

* tools/syz-cover: Fix unintended redefinition

* make changes to fix failing ci build

* pkg/report: fix issues
2019-07-17 11:58:23 +02:00
Marco Vanotti
0d10349cf0
sys/fuchsia: update zx_clock_get syscall (#1292)
* sys/fuchsia: update zx_clock_get.

zx_clock_get was deprecated and replaced by zx_clock_get_new. In a
recent CL[0], they replaced the zx_clock_get by zx_clock_get_new and
moved all client. This commit updates syzkaller to use the new function.

[0]: https://fuchsia-review.googlesource.com/c/fuchsia/+/298575

* run make extract && make generate
2019-07-16 17:09:43 -07:00
Dmitry Vyukov
4ec4ea4890 pkg/report: support new format of "held lock freed" linux bugs 2019-07-16 16:37:33 +02:00
Andrey Konovalov
6bc0be8b21
sys/linux, executor: improve USB descriptions
1. Change HID descriptions to allow devices to have two interrupt endpoints.
2. Remove unneeded responses to OUT control requests from descriptions.
3. Add some debugging code to detect and report missing descriptions.
2019-07-16 13:07:56 +02:00
Dmitry Vyukov
a963689197 pkg/log: rename -v to -vv
To avoid conflicts with programs that import both syzkaller packages
and github.com/golang/glog which also defines -v flag.
2019-07-16 11:18:12 +02:00
Siddharth M
0b48f538f1 pkg/report: enable feature comparisons for NetBSD 2019-07-15 18:10:08 +03:00
R3x
a827bf70d7 pkg/report: Fix corrupted reports 2019-07-14 19:22:39 +03:00
Siddharth M
2bbe2f0558 executor: add network packet injection for NetBSD
* Initial Commit

* working build of network packet fuzzing

* Add missed csource file

* pkg/csource: fix build

* executor/common_bsd.h: Add comment stating reason for ifconfig create
2019-07-14 17:59:29 +03:00
Andrey Konovalov
baa5258a5e executor: fix out-of-bounds in USB fuzzing code
We might not have any string descriptors provided at all, use a hardcoded
string in this case.
2019-07-11 15:44:30 +02:00
Andrey Konovalov
186a30b993 executor: update USB fuzzing code to use new kernel API
The kernel API has changed and now differentiates between IN and OUT
control requests.
2019-07-11 15:03:48 +02:00
Anton Lindqvist
429efa16d6 executor: make errors during thread creation exit zero
On OpenBSD, the executor sometimes manages to set the memory resource
limit 0 causing any following memory allocation to fail. Since threads
are potentially created from such a thread which cannot allocate any
memory, the executor will exit non-zero which in turn will cause
false-positive panics to be reported. For more info see the
discussion[1] in PR #1243.

Instead, if hitting a fatal error during thread creation exit zero.

[1] https://github.com/google/syzkaller/pull/1243
2019-07-04 20:26:46 +02:00
Dmitry Vyukov
5f175e9c09 pkg/report: ignore __wake_up function on linux
They are very generic and a bug is almost always in the parent frame.
2019-07-02 09:03:49 +02:00
Andrey Konovalov
cccc4302d7 sys/linux, executor: run make extract and generate 2019-07-01 17:26:35 +02:00
Andrey Konovalov
13c3a99962 sys/linux, executor: add syz_usb_ep_read syzkall
syz_usb_ep_read reads data from USB endpoints other than #0.
2019-07-01 17:26:35 +02:00
R3x
df9270ba7f pkg/report: fix ASan report parsing bug 2019-07-01 16:28:15 +02:00
R3x
4d3422405e pkg/report: fix error in report symbolization 2019-06-26 11:19:18 +02:00
Andrey Konovalov
82c13b6b49 sys/linux, executor: run make extract and generate 2019-06-24 17:24:44 +02:00
Andrey Konovalov
fa26c3cf35 sys/linux, executor: add basic USB HID fuzzing support
This commit adds the necessary descriptions and executor adjustments to
enable targeted fuzzing of the enumeration process of USB HID devices.
2019-06-24 17:24:44 +02:00
R3x
35a4434115 pkg/build: add DEBUG also 2019-06-24 16:24:48 +02:00
R3x
3a7e9179b1 pkg/build: add LOCKDEBUG and KASAN_PANIC 2019-06-24 16:24:48 +02:00
Andrey Konovalov
2873954bda pkg/report: add KMSAN kernel-usb-infoleak title regex 2019-06-24 12:58:49 +02:00
Dmitry Vyukov
472f0082fd pkg/ifuzz: update to latest intelxed
Update all-enc-instructions.txt to b7231de4c808db821d64f4018d15412640c34113
and regenerate instruction info.
2019-06-23 15:10:27 +02:00
Dmitry Vyukov
da9246f6d7 pkg/report: fix up parsing of lockdep stacks 2019-06-23 14:48:05 +02:00
Siddharth M
a139f92fef pkg/report: Add initial support for report symbolisation
* pkg/report: initial netbsd commit

* pkg/report: fix netbsd errors and add comments to help

* fix spelling error
2019-06-13 18:39:32 +02:00
mspecter
d2f63c9b49 pkg/host: improve openat check
* Add support for non-obvious open commands

* Adding Michael Specter to CONTRIBUTORS

* update

* /pkg/host/host_linux.go: leverage .txt for OpenAt

Allows users to specify OpenAt flags. Currently, Syzkaller will
automatically attempt to open device nodes at startup, and ignore
descriptions that do not exist. Unfortunately, Syzkaller only opens with
read-only permissions, and some device drivers will
return -EINVAL or likewise if the correct flags are not specified.
2019-06-11 12:06:50 +02:00
R3x
5b5826d065 pkg/build: fix the failing build
1. Add MKCTF option
2. Remove the command to make the kcov node. Since do it in the script.
2019-06-11 11:49:04 +02:00
Dmitry Vyukov
f5dd5568d2 pkg/report: improve should_fail regexp
Some kernels print hex PC value before frames.
Account for that in should_fail-matching regexp.
2019-06-06 09:26:26 +02:00
Andrey Konovalov
f41f5458bb pkg/host: enable evdev, hidraw and hiddev when USB fuzzing is on 2019-06-06 09:26:18 +02:00
Dmitry Vyukov
ad87cdf3c7 pkg/runtest: detect and ignore flakes
Add retry logic that detects and ignores episodic flakes.
This test episodically flakes on syzbot.
We run with the default timeout, but require a test
to pass in 50+% of cases.
Running 72 test binaries in parallel I am getting 35-44 failures out of 72
with 1 retry. With 3 retries it drops to ~7. With 5 it is close to 0.
Use 7 retries for now. Let's see if it still flakes.
2019-06-04 14:57:43 +02:00
Dmitry Vyukov
61f5c63922 pkg/report: skip refcount_* functions
These are too generic and don't point to any subsystem. Skip them.
2019-06-04 08:53:37 +02:00
Aditya Basu
4a4d36b4af pkg/build: update env variables for akaros
* Remove the environment variable: AKAROS_XCC_ROOT
(refer to commit: brho/akaros bdab8c3a)
* Add environment variable AKAROS_TOOLCHAINS which
points to the parent directory of the old AKAROS_XCC_ROOT.
(refer to commit: brho/akaro 62ec5c3c)
* Add "$AKAROS_TOOLCHAINS/x86_64-ucb-akaros-gcc/bin" to PATH.

Signed-off-by: Aditya Basu <mitthu@google.com>
2019-06-03 18:58:22 +02:00
Andrey Konovalov
63bf051fc1 pkg/report: add del_timer_sync to skip patterns 2019-06-03 13:14:08 +02:00
Dmitry Vyukov
5368a448e4 pkg/host: disable syz_execute_func
See the added comment for explanation.
2019-06-03 13:13:56 +02:00
Andrey Konovalov
142ce68175 pkg/runtest: add simple USB runtest 2019-05-31 13:35:25 +02:00
Andrey Konovalov
c054a92dde pkg/csource: generate timeouts for USB syzcalls
This patch only covers per call timeouts, per prog one is not adjusted yet.
2019-05-31 13:35:25 +02:00
Andrey Konovalov
2673c53079 pkg/report: ignore more frames for warnings in usb_submit_urb 2019-05-29 16:16:46 +02:00
Dmitry Vyukov
f5a25d38ac pkg/cover: factor out common code into combinePrefix
Combining of prefixes is now repeated in 2 places.
Factor it out into a common function.
2019-05-29 14:58:40 +02:00
Michael Tuexen
59a32682c0 pkg/cover: further improve prefix computation
When computing the prefix, take the covered and uncovered PCs into
account.
2019-05-29 14:58:36 +02:00
Michael Tuexen
17c2df6f20 pkg/cover: improve prefix computation
When the prefix becomes the empty string during the computation,
stop computing it, since the empty string is the result.
2019-05-29 14:58:31 +02:00
Andrey Konovalov
6bd615015d pkg/repro: don't double-reverse log entries
For extractProgSingle() lastEntries are already reversed, so no need to
call reverseEntries().

Also for extractProgBisect() there's no point in reversing the entries,
as the idea is to try connecting multiple programs in chronological order.
2019-05-27 20:03:37 +02:00
Andrey Konovalov
d53d0cd242 pkg/report: improve usb_submit_urb report titles 2019-05-27 13:52:30 +02:00
Anton Lindqvist
85c573157d pkg/csource: add ability to annotate syscalls using comments in C reproducers
Providing additional info, especially regarding syscall arguments, in reproducers
can be helpful. An example is device numbers passed to mknod(2).

This commit introduces an optional annotate function on a per target basis.

Example for the OpenBSD target:

  $ cat prog.in
  mknod(0x0, 0x0, 0x4503)
  getpid()
  $ syz-prog2c -prog prog.in
  int main(void)
  {
    syscall(SYS_mmap, 0x20000000, 0x1000000, 3, 0x1012, -1, 0, 0);
    syscall(SYS_mknod, 0, 0, 0x4503); /* major = 69, minor = 3 */
    syscall(SYS_getpid);
    return 0;
  }
2019-05-24 22:33:56 +02:00
R3x
0dadcd9d91 pkg/build: Add the KCOV build commands 2019-05-23 08:48:16 +02:00
Dmitry Vyukov
13427bd9a9 pkg/vcs: disable CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER before v5.2
See https://groups.google.com/d/msg/syzkaller/mODXmnauUZM/HLZiO2UDBAAJ for context.
2019-05-21 16:50:29 +02:00
R3x
9809825e48 make changes to prevent failing build 2019-05-21 13:56:38 +02:00
Dmitry Vyukov
712bfcbdd8 pkg/runtest: test host.Setup
This would catch binfmt_misc breakage on non-linux.
2019-05-21 12:35:51 +02:00
Dmitry Vyukov
f35ffcc16f pkg/host: don't enable binfmt_misc on non-linux
The csource options lack any relation to the tested OS,
while they do depend on the tested OS (most are linux-specific).
As the result we enable binfmt_misc, but its setup fails on anything
other than linux. As a work-around don't enable binfmt_misc on non-linux.
2019-05-21 12:23:44 +02:00
Dmitry Vyukov
40957b8193 executor: exit after first detected leak in C repros
Otherwise C repros print infinite stream of the same leaks again and again.
2019-05-21 12:00:02 +02:00
Dmitry Vyukov
e503f048b0 docs: don't duplicate manager config parameters
Currently we have them duplicated in docs/configuration.md
and the actual source in pkg/mgrconfig/config.go.
Documentation is missing in one place or another,
some is outdated, some is phrased slightly differently.
Move all docs to pkg/mgrconfig/config.go and reference it
from docs/configuration.md instead.
2019-05-21 11:47:51 +02:00
Dmitry Vyukov
8285069f89 executor: implement support for leak checking
Leak checking support was half done and did not really work.
This is heavy-lifting to make it work.

1. Move leak/fault setup into executor.
pkg/host was a wrong place for them because we need then in C repros too.
The pkg/host periodic callback functionality did not work too,
we need it in executor so that we can reuse it in C repros too.
Remove setup/callback functions in pkg/host entirely.

2. Do leak setup/checking in C repros.
The way leak checking is invoked is slightly different from fuzzer,
but much better then no support at all.
At least the checking code is shared.

3. Add Leak option to pkg/csource and -leak flag to syz-prog2c.

4. Don't enalbe leak checking in fuzzer while we are triaging initial corpus.
It's toooo slow.

5. Fix pkg/repro to do something more sane for leak bugs.

Few other minor fixes here and there.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
32ebe81cf3 pkg/repro: fix no output timeout
We duplicated the no output timeout in the repro package,
and it got out of sync. It's not 3 mins now, but 5 mins.
Remove the duplication and fix this.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
2c9280d432 pkg/rpctype: use string type for leak frames
We need them as string everywhere.
Not sure why they were []byte to begin with.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
4d4a4420e7 pkg/report: add Type/Frame to Report
In several places we do special handling for some crash types.
Currently we compare report title with magic strings,
which is error-prone. Add explicit Type to reports.
2019-05-20 19:40:20 +02:00
Dmitry Vyukov
5a4461b07f pkg/instance: fix types in OverrideVMCount
vmConfig value is interface{}, not string.
So compare with nil and assign int.
2019-05-18 08:41:48 +02:00
Andrew Donnellan
2755003a34 pkg/report: Label powerpc unreliable stack frames as questionable
Add a second "questionable" regex to match the powerpc "(unreliable)"
format.

Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-05-17 07:15:52 +02:00
Andrew Donnellan
2233782fc1 pkg/report: Add powerpc's __switch_to to function skip list
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-05-17 07:15:52 +02:00
Dmitry Vyukov
76fc461b55 pkg/compiler: add offsetof type
Similar to C offsetof gives offset of a field
from the beginning of the parent struct.
We have several TODOs in descriptions asking for this.
2019-05-16 18:05:05 +02:00
Dmitry Vyukov
491919b14f pkg/compiler: work around 0-array-size errors due to missing consts
A const can be used as array size. Then if the const is not present
on all arches, compiler will produce an error about 0-sized-array.
There is no easy way to work around this for a user.
Use value of 1 for missing consts. It's just a bit safer.
2019-05-15 13:48:59 +02:00
Dmitry Vyukov
01d1494471 .golangci.yml: add codeanalysis build tag
Using a build tag to exclude files for golangci-lint
reduces memory consumption (it does not parse them).
The naive attempt with skip-dirs did not work.
So add codeanalysis build tag and use it in auto-generated files.

Update #977
2019-05-15 11:39:31 +02:00
Dmitry Vyukov
2376f0f937 pkg/compiler: allow to refer to syscall arguments in len paths
This allows to use len[syscall:arg] expressions.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
9a4969814e pkg/compiler: refactor len target checking
Create named const for "parent" and move some code into a helper function.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
16c881ad85 pkg/compiler: generate complex len targets
Change the generated format for len type to support multiple path elements.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
eea28fee30 pkg/compiler: support complex len targets
This change adds compiler support for complex path
expressions in len targets. E.g. it allows to refer
to a sibling field as len[parent_struct:field:another_field].
See the docs change for details.

This is just a compiler change.
The feature is not yet supported by the prog package.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
1886b2a481 pkg/ast: refactor COLON handling
This prepared for handling of bytesize[parent:foo:bar] expressions
by allowing multiple identifiers after colon.
No functional changes for now, just preparation for storing more
than one identifier after colon.
2019-05-14 19:28:01 +02:00
Dmitry Vyukov
69423a1d41 pkg/email: allow commands in subject
Several users attempted this and there does not seem
to be any reason to not allow this.
So parse out command from subject as well.
2019-05-13 14:15:14 +02:00
Greg Steuck
ddba9a616e
pkg/instance: break the line to appease linter (#1173)
* pkg/instance: break the line to appease linter

* fix up format
2019-05-12 23:38:17 -07:00
Dmitry Vyukov
39449875b6 syz-ci: don't assume kernel config is called .config
.config is linux-ism. We have a convention that kernel config
is copied to kernel.config file. Use it.
2019-05-12 11:38:18 +02:00
Dmitry Vyukov
8f24b7d63e syz-ci: always use 10 VMs for bisection
If a manager has less then 10 VMs override it to 10 for bisection.
If a manager has only 1 VM, bisection won't end well.
2019-05-10 11:06:17 +02:00
Dmitry Vyukov
4e7ecf0713 pkg/report: preserve trackback from other CPUs
For some bug types kernel produces traceback of all CPUs
(which is presumably useful for these crashes).
However, we currently throw it away because it has context
different from the oops context.
Detect such traceback and preserve output.
2019-05-10 10:31:07 +02:00
Dmitry Vyukov
e551e0ce0d pkg/report: remove debugging leftover 2019-05-10 10:31:07 +02:00
Dmitry Vyukov
214bf476d3 pkg/report: improve format of "locking bug" reports 2019-05-09 15:04:17 +02:00
Dmitry Vyukov
6fc130d361 pkg/report: add new format of kernel page faults 2019-05-09 14:33:39 +02:00
Andrew Donnellan
98ec0fac71 pkg/host: Add test for kallsymsRenameMap
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
2019-05-08 16:52:55 +02:00
Andrew Donnellan
2697cc88bb pkg/host: Add stat to kallsyms rename map
On powerpc, the "stat" syscall is implemented by "sys_newstat" entry point.
This causes a test failure as we can't find "sys_stat" in kallsyms.

Add "stat" -> "newstat" to the kallsyms rename map to work around this.

Closes: #1083 ("pkg/host: TestSupportedSyscalls fails on ppc64le")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-05-08 16:52:55 +02:00
Andrey Konovalov
f8f0147ff7 pkg/report: don't mark unknown oopses as corrupted 2019-05-08 16:50:27 +02:00
Dmitry Vyukov
b12c1ab14c dashboard/app: restore printing of email commands
After commit 9ad9ef29ca
we started saying "your command '3' is accepted"
because we use numbers now. Keep string representation
of the command when parsing and use it in reply emails.
2019-05-08 16:29:04 +02:00
Dmitry Vyukov
a7383bfac1 Makefile: enable 386 executor build in presubmit
This hacky way to install 386 packages seems to unbreak executor build.
2019-05-07 18:01:24 +02:00
Dmitry Vyukov
04165d8f66 Makefile: enable arm executor build in presubmit
arm build seems to work now on Travis since we switched to xenial.
2019-05-07 18:01:24 +02:00
Dmitry Vyukov
6a9fb250a6 pkg/report: fix WARNING parsing for powerpc
2 recent commits conflict and cause test 380 to fail:

pkg/report: improve warning titles
pkg/report: Handle powerpc stack traces correctly

Currently 380 is detected as "WARNING in program_check_exception"
rather than the expected "WARNING in assert_slb_presence".
The reason is that we started parsing WARNING stack trace and applying
proper skip patterns to frames.

Adjust WARNING matching and skip common powerpc WARNING frames.
2019-05-07 09:50:41 +02:00
Siddharth M
27544d0fc8 pkg/report: fix other NetBSD corrupted reports
* Fix Superviser mode and lock error

* Fix smaller issues
2019-05-07 09:03:05 +02:00
Andrey Konovalov
024f6c4b7f pkg/report: improve warning titles
This change makes the reporting code account for the skip patterns when
selecting the frame that is used in a title of a generic warning report.
2019-05-07 08:53:52 +02:00
munjinoo
001e36bc78 executor: change syscall argument type to intptr_t
The type size of long depends on compiler.
Therefore, changing to intptr_t makes it depends on architecture.
2019-05-07 08:48:35 +02:00
Andrew Donnellan
04e9d8cedd pkg/report: Handle powerpc stack traces correctly
powerpc stack traces are printed a bit differently from x86 stack traces.
Adjust the regexes accordingly to cope with this format.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-05-07 08:41:33 +02:00
Andrey Konovalov
148296f478 pkg/report: improve titles of 'sleeping function called from invalid context' 2019-05-06 18:39:08 +02:00
Dmitry Vyukov
c73da24c18 pkg/report: add __ia32_sys_ syscall prefix 2019-05-03 12:40:49 +02:00
Andrew Donnellan
90c8f82ae8 pkg/build: Add ppc64le Linux as a supported configuration
Enable the Linux builder for ppc64le.

For ppc64le, we use zImage rather than bzImage as our kernel target. Pass
through the target architecture to buildKernel() so we can pick the right
target based on arch.

Closes: #1084 ("pkg/build: Support building Linux on ppc64le")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-05-03 10:00:16 +02:00
Andrew Donnellan
0642ca0c5c pkg/build: Call Linux image creation script with target arch argument
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-05-03 10:00:16 +02:00
Andrew Donnellan
bfc19a4b19 tools/create-gce-image.sh: Generate ppc64le pseries disk images
Add support for generating ppc64le pseries disk images. This will create a
disk image with a PowerPC PReP boot partition at the start, and install
the IEEE1275/OpenFirmware version of GRUB.

If we ever support the powernv platform in the future we're going to have
to do something different here.

Add a command line argument to specify architecture, defaulting to amd64.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
2019-05-03 10:00:16 +02:00
Andrey Konovalov
8e54d550ca repro: speedup bisection for flaky crashes
Limit the amount of bisection chunks to 8. Going over this value probably
means that we are bisection a flaky crash, and continuing bisection would
just take a lot of time and likely produce no result.
2019-05-03 08:30:36 +02:00
Andrey Konovalov
1bfa09b967 pkg/report: skip printk and other printing functions 2019-05-03 08:10:28 +02:00
Anton Lindqvist
e9039493d7 executor: unbreak on OpenBSD at runtime
Not using `elif GOOS_freebsd' since it could cause breakage on other *BSDs
due to unused variables.

Regression introduced in commit c7c3f772 (executor: improve setup for packet
handling on *BSD).
2019-05-02 19:21:37 +02:00
Anton Lindqvist
1852eb1814 sys/openbsd: add vmm descriptions (#1152)
Most probably limited to input validation for now. In the future, it
could be extended to provide a bootable kernel during vm create (/bsd)
and turn vmid into a proper resource.

The OpenBSD VMs on GCE does support vmm(4).
2019-05-01 19:30:36 -07:00
Michael Tüxen
c7c3f772ca
executor: improve setup for packet handling on *BSD (#1153)
Improve the handling of packets by:
* setting the local MAC address.
* configuring the local IPv4 address with prefix /24.
* adding an entry in the arp cache for the remote IPv4 address.
* adding an entry in the IPv6 neighbour cache for the remote
  IPv6 address.
2019-05-01 22:45:36 +02:00
Andrey Konovalov
f46aabc8c6 executor: fix another compiler warning 2019-04-25 16:06:29 +02:00
Andrey Konovalov
8e3c52b11d executor: fix compiler warning 2019-04-24 11:00:51 +02:00
Dmitry Vyukov
0766ce61fd pkg/report: fix stalls in RIP frame
Even though we extract an anchor frame which usually higher up the stack,
the anchor frame can be on RIP: line too. Account for that.
2019-04-24 00:02:57 +03:00
Andrey Konovalov
e99d004deb executor: use NONFAILING in common_usb.h
Also move some code to helper functions.
2019-04-23 23:42:31 +03:00
Andrey Konovalov
4d3d6a5007 executor: adjust waiting time for all usb syzcalls
Allow 2000 ms of waiting time for syz_usb_connect and and the same time for
the whole program is this syzkall is present. Allow 200 ms of waiting time
for syz_usb_disconnect. Remove sleep from syz_usb_control_io.
2019-04-23 23:37:02 +03:00
Dmitry Vyukov
deda7c38f9 pkg/report: skip osq_lock on linux
Another new helper for locking.
2019-04-23 19:18:39 +03:00
Andrey Konovalov
18c131578d pkg/email: support quilt patch format
Quilt uses a slightly different patch format to traditional git
diff/format-patch. Support it.
2019-04-23 19:04:22 +03:00
Dmitry Vyukov
8095117313 all: fix some static analysis warnings
Fix warnings produced by golangci-lint.

Update #977
2019-04-23 17:58:54 +03:00
Kristof Provost
2398edeacc sys/freebsd: Add pf ioctl()s
Tweak the building of the FreeBSD vm image to ensure pf is loaded at
startup, so that we can test it.
2019-04-23 15:55:07 +02:00
Marco Vanotti
4d3be36006 pkg/build: update zircon build directory. (#1132)
Recently, fuchsia changed the build directory for zircon, now instead of
build-zircon, we have arch.zircon, where arch is x64 or arm64.
2019-04-22 10:51:48 -07:00
Andrey Konovalov
05dbaf1bf4 report: skip strscpy and read_word_at_a_time frames 2019-04-22 12:02:56 +03:00
Andrey Konovalov
c6165716a5 pkg/report: ignore 'down' frame in the call stack 2019-04-11 18:54:45 +02:00
Andrey Konovalov
44841b9f9c all: run make generate 2019-04-11 16:24:45 +02:00
Andrey Konovalov
f4a3dc9128 all: add basic USB fuzzing support
This commits implements 4 syzcalls: syz_usb_connect, syz_usb_io_control,
syz_usb_ep_write and syz_usb_disconnect. Those syzcalls are used to emit USB
packets through a custom GadgetFS-like interface (currently exposed at
/sys/kernel/debug/usb-fuzzer), which requires special kernel patches.

USB fuzzing support is quite basic, as it mostly covers only the USB device
enumeration process. Even though the syz_usb_ep_write syzcall does allow to
communicate with USB endpoints after the device has been enumerated, no
coverage is collected from that code yet.
2019-04-11 16:24:45 +02:00