Commit Graph

1290 Commits

Author SHA1 Message Date
Mark Johnston
5e1ad02b17 pkg/csource: Force promotion of 64-bit constant values
Constant 64-bit arguments to the variadic syscall(2) must have their
width specified explicitly.  In practice this is not necessary most of
the time, but on amd64/freebsd with clang the compiler can and does
store the constant 32-bit value to the stack, leaving garbage in the
upper 32 bits.

This makes C reproducers somewhat uglier, but I see no other solution.
2019-11-08 10:51:32 +01:00
Dmitry Vyukov
1e35461e02 pkg/report: trim panic_on_warn set few lines earlier
The KCSAN reports can be quite short.
Now with task contexts we can hopefully reduce the threshold a bit.
2019-11-08 07:51:25 +01:00
Dmitry Vyukov
30cb7f98cd pkg/bisect: detect wrong bisections
Detect bisection to merge commits and to commits that don't affect
kernel binary (comments, other arches, whitespaces, etc).
Such bisections are not reported in emails (but shown on web).

Update #1271
2019-11-07 11:07:03 +01:00
Dmitry Vyukov
f158761183 pkg/csource: don't run tests if compiler is broken
Test presence of a working compiler before running any tests for a target.
This helps to make tests pass even if some cross-compilers are not installed properly.
2019-11-07 11:07:00 +01:00
Dmitry Vyukov
d797d2018f pkg/report: fix up panic handling
Obviously there is an exception to every exception in kernel output parsing...
2019-11-06 18:06:12 +01:00
Dmitry Vyukov
da505f84d3 pkg/report: detect syzkaller panics in lost connection bugs
Some syzkaller panics happen due to memory corruptions,
but it still would be useful at least to get some visibility into these crashes.
On some OSes we actualy already detect them as they have "panic:" oops pattern,
but not e.g. on linux.

Fixes #318
2019-11-06 11:41:05 +01:00
Dmitry Vyukov
424cf6e8a1 pkg/build: add build signatures
Add optional build signature for images, currently only implemented for linux.
This can be used in bisection process to detect changes that does not affect kernel.

Update #1271
2019-11-06 11:41:05 +01:00
Dmitry Vyukov
c487cd4633 pkg/build: refactor Image function arguments
Image takes too many arguments, so we need to do lots of forwarding,
adding new argumnets is painful and most OSes are not interested
in lots of arguments.
Combine all arguments into a params struct.
2019-11-06 11:41:05 +01:00
Andrey Konovalov
80aca15c2a executor: update the list of raw usb events
The number of reported event types changed.
2019-11-05 15:11:22 +01:00
Zubin Mithra
0a2d7d8293 pkg/bisect: modify Run() to return information about commit
* Modify Run() to return the commit object when a failure occurs on the
oldest tested release(for BisectCause) and latest tested
release(for BisectFix).
* Modify tests to check the returned commit object.
2019-11-05 09:15:56 +01:00
Andrey Konovalov
76630fc947 executor, pkg/host, dashboard/config: rename usb-fuzzer to usb raw-gadget
The interface is being upstreamed and the name has changed.
2019-11-04 15:43:43 +01:00
Zubin Mithra
1d0df175f3 pkg/bisect: add more tests for various possible bisection results
Add tests for the following cases(1 each for cause and fix):
- bisection returns the correct commit
- bisection failed due to crash not occuring on the original commit
- bisection failed as crash occurs on oldest/latest commit
- bisection is inconclusive
2019-11-04 14:40:37 +01:00
Dmitry Vyukov
e2d61622eb sys/linux: improve CAN descriptions 2019-11-04 12:39:39 +01:00
Jiri Pirko
b35fad31e9 pkg/csource: remove duplicate check
Remove a check that was mistakenly added with devlink_pci feature and is
duplicate of the existing check.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
2019-11-03 16:42:57 +01:00
Dmitry Vyukov
99d946ccff executor: fix setup of vxcan
Adding vxcan1 also adds vxcan0. Setup and use both.
2019-11-03 15:00:15 +01:00
Dmitry Vyukov
2079602763 pkg/csource: fix lint warnings
CI failed:
https://travis-ci.org/google/syzkaller/jobs/606730911?utm_medium=notification&utm_source=github_status
2019-11-03 14:44:53 +01:00
Jiri Pirko
d40d75d2d7 executor: move fixed pci devlink handle into network namespace
In case there is a fixed pci devlink handle "pci/pci/0000:00:10.0"
on the system (initial network namespace), it is moved to a working
network namespace.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
2019-11-03 14:20:59 +01:00
Paul Chaignon
997ccc675b pkg/compiler: define fileoff template
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-11-01 19:14:49 +01:00
Paul Chaignon
f922d4435a pkg/compiler: special BASE argument in templates
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-11-01 19:14:49 +01:00
Anton Lindqvist
25bb509e59 pkg/report: suppress fifo_badop reports on OpenBSD
This panic is not to interesting since the intended behavior is to panic and
it requires root due to usage of mknod(2).
2019-10-26 09:02:46 +02:00
Paul Chaignon
413926c563 pkg/compiler: check range is consistent with base type
For any intN, values in the range [-MAX_INTN:MAX_INTN] are accepted.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-10-25 18:16:59 +02:00
Paul Chaignon
713f727d98 prog, pkg/compiler: alignment for integer ranges
Enables the syntax intN[start:end, alignment] for integer ranges.  For
instance, int32[0:10, 2] represents even 32-bit numbers between 0 and 10
included.  With this change, two NEED tags in syscall descriptions can be
addressed.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-10-25 18:16:59 +02:00
Paul Chaignon
ced0f73a67 pkg/compiler: check first int arg is range
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-10-25 18:16:59 +02:00
Jiri Pirko
5b49e1f605 executor: create netdevsim device
Create testing netdevsim instance with 4 ports.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
2019-10-25 13:15:56 +02:00
Dmitry Vyukov
d894f260cc pkg/report: better diffirentiate task hung reports (2)
Add file missed in the previous commit.
2019-10-23 10:38:37 +02:00
Paul Chaignon
55afb04f04 pkg/ast: unexport Node.Walk()
Other packages should use ast.Recursive and ast.PostRecursive to ensure
the root node is visited as well.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-10-23 10:22:35 +02:00
Paul Chaignon
d3cea9507f pkg/compiler: fix root node not visited in typedef checks
Without this fix, the compiler throws an error 'template argument BASE is
not used' for the following typedef.

  type templ1[BASE] BASE
  foo(a ptr[in, templ1[int64]])

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
2019-10-23 10:22:35 +02:00
Dmitry Vyukov
bb6c338b9e pkg/report: better diffirentiate task hung reports
A number of hangs happen when trying to cancel tasks in different subsystems.
2019-10-23 10:13:30 +02:00
Anton Lindqvist
d0686497a9 pkg/report: normalize pool cpu free list modified reports on OpenBSD (#1474) 2019-10-22 15:06:11 -07:00
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