Commit Graph

69 Commits

Author SHA1 Message Date
Dmitry Vyukov
21d289c28f pkg/report: add gvisor "stuck task" pattern 2020-09-12 12:04:32 +02:00
Pedro Lopes
242b0eb219 pkg: get and store Maintainers data
Create a struct on pkg/vcs to store data of syzkaller email recipients
and update its users. The struct contains default name, email, and a
label to divide user into To and Cc when sending the emails.
2020-07-31 17:18:29 +02:00
Dmitry Vyukov
8caeeeb724 pkg/report: parse linux undead task reports 2020-07-20 10:42:01 +02:00
Dmitry Vyukov
c1147c8df7 all: fix comments format
Fix capitalization, dots at the end
and two spaces after a period.

Update #1876
2020-07-12 08:22:44 +02:00
Dmitry Vyukov
813f363bff all: fix dup types in func args 2020-07-04 15:05:30 +02:00
Dmitry Vyukov
6fe5725de8 pkg/report: ingore another android debug output that looks like kernel crash 2020-06-12 08:23:36 +02:00
Dmitry Vyukov
50749f54cd pkg/report: add ParseAll
ParseAll returns all reports in output.
Use it in syz-symbolize.
2020-05-13 20:49:07 +02:00
Dmitry Vyukov
3d789641a3 pkg/report: add Report.SkipPos
SkipPos is what pkg/instance needs,
but also will be needed for ParseAll.
2020-05-13 20:37:26 +02:00
Dmitry Vyukov
78267cec1a vm: better handle VM diagnosis output
1. Always append diagnosis output at the end.
Don't intermix it with kernel output. It's confusing and not useful.

2. Don't include diagnosis output into Report.
It's too verbose and is not the crash. Keep it only in the Output.
2020-03-21 16:30:35 +01:00
Dmitry Vyukov
a2d5b1c04d pkg/report: handle cases when whole stack is questionable
If the report is identified as corrupted because there are no frames at all,
try to re-extract using questionable frames.
This is a bit risky and may produce lots of one-off corrupted reports
at random locations. But we won't know until we deploy this...

Fixes #1216
2020-03-21 14:43:26 +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
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
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
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
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
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
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
Dmitry Vyukov
c3d7012379 pkg/report: remove .PID from syz-executor
pkg/ipc changed format of binaries, but pkg/report wasn't updated.
Update pkg/report for the new format.
2019-04-05 08:45:44 +02:00
Dmitry Vyukov
6b138f0f3c pkg/report: work around GCE console bugs 2019-03-29 09:40:31 +01:00
Dmitry Vyukov
7da2392541 pkg/report: support CONFIG_PRINTK_CALLER
CONFIG_PRINTK_CALLER has reached linux-next:
https://groups.google.com/d/msg/syzkaller/xEDUgkgFvL8/d5bBS3BJBwAJ

Enable CONFIG_PRINTK_CALLER and support parsing of its output format.

This gives us several advantages:
 - output from different contexts don't intermix
 - intermixed output doesn't cause corrupted reports
 - we can keep larger prefix since we know it comes from the same task

Credit for the kernel part goes to Tetsuo Handa.
Also Sergey Senozhatsky and Petr Mladek for reviews of the kernel part.

Fixes #596
Fixes #600
2019-01-03 19:23:07 +01:00
Dmitry Vyukov
1749e412ca pkg/instance: make kernel reboot detection portable
The current code is linux specific, generalize it to other OSes.
2018-12-16 16:48:05 +01:00
Anton Lindqvist
4e1aade2fe pkg/report: pass the target to each OS report constructor
In order to use the already defined kernel name in sys/targets to reduce
duplications.
2018-12-08 18:59:10 +01:00
Dmitry Vyukov
98b28ead6c pkg/report: fix few fuzz bugs
Improve go-fuzz fuzzer function and fix few new bugs it finds:
1. Panic in linux parser (bad).
2. Akaros can report empty rep.Report.
3. Fuchsia can return empty rep.Report.
2018-09-27 12:50:25 +02:00
Dmitry Vyukov
db716d6653 pkg/report: fix guilty file extraction
Account for the case that some file names can appear _before_ crash report starts.
Start extracting guilty file starting from StartPos.
2018-09-26 12:02:43 +02:00
Dmitry Vyukov
b692332724 pkg/report: improve rcu stall/lockup reports
During rcu stalls and cpu lockups kernel loops in some part of code,
usually across several functions. When the stall is detected, traceback
points to a random stack within the looping code. We generally take
the top function in the stack (with few exceptions) as the bug identity.
As the result stalls with the same root would produce multiple reports
in different functions, which is bad.
Instead we identify a representative function deeper in the stack.
For most syscalls it can be the syscall entry function (e.g. SyS_timer_create).
However, for highly discriminated functions syscalls like ioctl/read/write/connect
we take the previous function (e.g. for connect the one that points to exact
protocol, or for ioctl the one that is related to the device).

Fixes #710
2018-09-10 16:19:47 +02:00
Anton Lindqvist
b771b17ec9 Add mandatory OpenBSD bits (#689)
all: add openbsd support

squash of the following commits:

* openbsd: add mandatory bits
* report: add OpenBSD support
* executor: skip building kvm on OpenBSD
* executor: add OpenBSD support
Linking against libutil is necessary due to usage of openpty(3).
* executor: fix typo in fail() message
* fixup! report: add OpenBSD support
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! openbsd: add mandatory bits
* fixup! report: add OpenBSD support
* gometalinter: skip sys/openbsd
2018-08-28 10:07:26 -07:00
Dmitry Vyukov
fbedd425b5 pkg/mgrconfig: move from syz-manager/mgrconfig
mgrconfig was used only by syz-manager initially,
but now it's used by a dozen of packages and it's
weird to import from under a binary dir.
pkg/ is much more reasonable dir for a widely used
helper package.
2018-08-02 16:57:32 +02:00
Dmitry Vyukov
50c3709eb0 .gometalinter: reduce dupl threshold
Reduce dupl threshold from 63 to 60 and fix violations.

Update #538
2018-07-31 12:42:52 +02:00
Dmitry Vyukov
bad4246bf2 pkg/report: improve akaros reporter and implement symbolization 2018-07-16 17:03:14 +02:00
Dmitry Vyukov
d9ed95ab6f pkg/report: add simpler reporter for akaros 2018-07-05 10:44:34 +02:00
Dmitry Vyukov
3e16f33c65 vm: suppress "no output" and "lost connection" reports 2018-06-30 14:51:07 +02:00
Dmitry Vyukov
2a075d57ab pkg/report: allow to specify suppressions per OS
Currently all (linux-specific) suppressions are hardcoded in mgrconfig.
This is very wrong. Move them to pkg/report and allow to specify per OS.
Add gvisor-specific suppressions.
This required a bit of refactoring. Introduce mgrconfig.KernelObj finally.
Make report.NewReporter and vm.Create accept mgrconfig directly
instead of passing it as multiple scattered args.
Remove tools/syz-parse and it always did the same as tools/syz-symbolize.
Simplify global vars in syz-manager/cover.go.
Create reporter eagerly in manager. Use sort.Slice more.
Overall -90 lines removed.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
c71647f2cc pkg/report: add gvisor support 2018-06-22 16:40:45 +02:00
Dmitry Vyukov
3cf0de82e9 pkg/report: move title sanitization from linux to common code
Stripping dynamic data (addresses, numbers) is required for all OSes.
Move this code from linux to common code.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
9a7d0a5412 pkg/report: pass vm type to NewReporter
For the case when VM type affects output.
Will be needed for gvisor. It is kinda linux, but kinda not.
2018-06-22 16:40:45 +02:00
Dmitry Vyukov
a6bf43aeeb pkg/report: add simplistic fuchsia reporter 2018-06-06 16:29:59 +02:00
Dmitry Vyukov
b9fea20df7 pkg/report: remove duplicated stub code
Update #538
2018-05-07 13:05:41 +02:00
Dmitry Vyukov
fd5157bebf pkg/report: sanitize titles better
Strip non-printable characters from titles.
Trim whitespaces on both ends.
Replace tabs with spaces.
Remove duplicate spaces.
Reduce max title length.
2018-04-24 19:17:07 +02:00
Dmitry Vyukov
7a67784ca8 pkg/report: detect hangs in unregister_netdevice
Add special report format for hangs in unregister_netdevice.
And support new format of lockdep reports (otherwise they all
are marked as corrupted).
2018-04-13 17:44:45 +02:00
Dmitry Vyukov
3fdee3b005 pkg/report: improve corrupted report detection
1. If we see should_failslab frames during report parsing,
   that's a corrupted report with intermixed frames from
   fault injection stack.
2. If we matched report title and this report should contains
   a guilty stack frame, but we failed to extract any frame,
   consider it as corrupted.

New tests added. Also one of the old tests is fixed.
2018-04-09 14:19:51 +02:00
Dmitry Vyukov
36d1c4540a all: fix gometalinter warnings
Fix typos, non-canonical code, remove dead code, etc.
2018-03-08 18:48:26 +01:00
Dmitry Vyukov
d2473bc545 pkg/report: improve guilty frame extraction
1. Make extractStackFrame more picky about stray frames.
This fixes some TODO's in tests where we matched completley
unrelated frames printed by another task.

2. Extract KASAN guilty frame from report header
if the frame should not be skipped (e.g. not __lock_acquire).
This makes parsing more tolerant to corrupted reports.
2018-02-07 13:46:35 +01:00
Dmitry Vyukov
66c15deb7a pkg/report: fix KASAN report parsing
We did not skip kasan_check_read.
Also don't let stack parsing to silently sink to another stack trace.
2018-02-06 15:29:56 +01:00
Dmitry Vyukov
645ce5da79 pkg/report: improve report titles
1. Replace stacktraceRe with custom code which is more flexible.
stacktraceRe stumbled on any unrelated lines and
could not properly parse truncated stacks.

2. Match report regexp earlier.
If we match simler title regexp, but don't match
report regexp or fail to parse stack trace, the report is corrupted.
This eliminates lots of duplicate corrupted oops entries,
which were there only because we had complex regexp's in titles.

3. Ignore low-level frames during stack parsing.
E.g. we never want to report a GPF in lock_acquire or memcpy
(somewhat similar to what we do for guilty files).

4. Add a bunch of specialized formats for WARNINGs.
There is number of generic debugging facilities (like ODEBUG,
debug usercopy, kobject, refcount_t, etc), and the bug
is never in these facilities, it's in the caller instead.

5. Improve some other oops formats.

6. Add a bunch of additional tests.

This resolves most of TODOs in tests.
Fixes #515
2018-02-06 14:44:03 +01:00
Dmitry Vyukov
1556ebc4cc pkg/report: move test data to testdir/
linux_test.go is total mess and very hard to work with.
Turns out we had 2 tests that do exactly the same
(verify Report), but nobody ever noticed.

Move all test data to testdir/. One file per crash.
2017-12-12 11:28:37 +01:00
Andrey Konovalov
38a2a3f586 pkg/report: fix report extraction
Try extracting report from console output only first. If that doesn't work,
try extracting it from the whole log.

Add regexp for executor printed BUGs.

Optimize regexps for rcu detected stalls.

Update rep.StartPos and rep.EndPos in vm/vm.go as well as rep.Output.
2017-12-08 15:08:13 +01:00
Dmitry Vyukov
c92879679c pkg/report: extinguish panics
We see panic during report parsing as in #457.
This does not really fix them, but should stop managers crashing.

Update #457
2017-12-04 10:53:25 +01:00
Andrey Konovalov
e0375d3ee6 pkg/report: return raw log in Report.Output 2017-12-01 16:16:28 +01:00
Dmitry Vyukov
29b0fd90e6 pkg/report: include Maintainers into report
Currently getting a complete report requires a complex,
multi-step dance (including getting information that
external users are not interested in -- guilty file).

Simplify interface down to 2 functions: Parse and Symbolize.
Parse does what it did before, Symbolize symbolizes report
and fills in maintainers. This simplifies both implementations
of Reporter interface and all users of the interface.

Potentially we could get this down to 1 function Parse
that does everything. However, (1) Symbolize can fail,
while Parse cannot, (2) usually we want to ignore (log)
Symbolize errors, but otherwise proceed with the report,
(3) repro does not need symbolization for all but the
last report.
2017-11-29 18:24:30 +01:00