1810 Commits

Author SHA1 Message Date
Dmitry Vyukov
9150b3e544 prog: lazily initialize targets
We now have a bunch of targets compiled into each binary.
All targets are initialized eagerly on startup time.
As the result a do nothing binary starts for ~0.58s and
consumes ~21MB.

Initialize targets lazily. Usually only 1 target is used.
This reduces startup time to ~0.00s and memory consumption
to ~5.4MB.
2017-12-17 11:39:14 +01:00
Dmitry Vyukov
0da2fed84f prog: simplify MakeResultArg
Fixes #445
2017-12-17 11:39:14 +01:00
Dmitry Vyukov
2b4927e6ce prog: add benchmark for Mutate 2017-12-17 11:39:14 +01:00
Dmitry Vyukov
f2d5384a68 vm/isolated: allow to specify ssh port for target machines 2017-12-17 11:39:14 +01:00
Dmitry Vyukov
b6f0c91b3a
Update found_bugs.md 2017-12-16 08:25:34 +01:00
Tim Tianyang Chen
ac20b98c1b syz-manager: add simple email support
Users can specify an email address to reveive notifications when a
bug is discovered for the first time, without setting up a full fledged
dashboard. The supported mailer is mailx.

Signed-off-by: Tim Tianyang Chen <soapcn@gmail.com>
2017-12-14 08:57:27 +01:00
Andrey Konovalov
ea8dc17ee9 executor: fix macros in common.h 2017-12-14 08:54:55 +01:00
Andrey Konovalov
06ea774dca pkg/report: fix __this_cpu_* report header call trace capture 2017-12-13 19:48:13 +01:00
Andrey Konovalov
ce7f2399c4
Update found_bugs_usb.md 2017-12-12 16:57:20 +01:00
Andrey Konovalov
7e77969996
Update found_bugs_usb.md 2017-12-12 16:57:07 +01:00
Dmitry Vyukov
414a185f4d pkg/report: add another corruped report format 2017-12-12 15:35:21 +01:00
Dmitry Vyukov
9d46048cb9 dashboard/app: allow fragment links to namespaces
Now "#foo" link will point to namespace "foo".
2017-12-12 14:55:43 +01:00
Dmitry Vyukov
433029d5d4 pkg/report: add another guilty file test 2017-12-12 14:23:28 +01:00
Dmitry Vyukov
32f694fc72 pkg/report: properly infer kernel location if kcov is not enabled
We used to infer kernel source location based on __sanitizer_cov_trace_pc symbol.
But it's not present if KCOV is not enabled.
Look at more symbols.
2017-12-12 14:02:59 +01:00
Dmitry Vyukov
4224245438 pkg/report: add few more corrupted reports 2017-12-12 13:51:27 +01:00
Dmitry Vyukov
867fe6a840 pkg/report: improve using __this_cpu_add() in preemptible code report 2017-12-12 13:40:08 +01:00
Dmitry Vyukov
1b3ae9a6d0 pkg/report: handle syzkaller binaries
syzkallerNNN binaries are coming from pkg/repro.
2017-12-12 13:29:45 +01:00
Dmitry Vyukov
081721ff15 pkg/report: clean guilty files 2017-12-12 12:24:52 +01:00
Dmitry Vyukov
7130893383 pkg/report: merge TestLinuxParseLog into TestParse
That was the last test that used inline input data.
Merge it into TestParse.
Test Output for all crashes in TestParse.
Support multiple oopes in crash
Add more test cases for start/end line.
2017-12-12 12:20:41 +01:00
Dmitry Vyukov
9d0132a2fb pkg/report: move guilty file 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:59:13 +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
Dmitry Vyukov
8b77d41235 syz-manager: show the same file after cover page reload
Handy when you are looking at a single file
and periodically reload page to get new coverage.
2017-12-12 09:13:35 +01:00
Dmitry Vyukov
da131727fb sys/linux: describe PF_KEY 2017-12-11 20:12:35 +01:00
Andrey Konovalov
8d4ab42605 pkg/report: bad unlock balance can be a WARNING 2017-12-11 16:01:10 +01:00
Andrey Konovalov
c0020ec197 pkg/report: detect corrupted old-style KASAN reports 2017-12-11 16:01:10 +01:00
Andrey Konovalov
02b8de13ac pkg/report: better detect corrupted stack traces
We may find stack frames from the second stack trace in a report when
searching from frames of the first one.
2017-12-11 16:01:10 +01:00
Andrey Konovalov
27f5dfefff pkg/report: improve report header extraction
Allow stack traces to be intermixed with random kernel messages that don't
start with a ' ' char (all frames in a stack trace do).

Also improve report headers for BUGs from mm/usercopy.c, as we get quite a
lot of those.
2017-12-11 14:42:45 +01:00
Dmitry Vyukov
5ad0ce9589 dashboard/app: fix test
Fix test after the previous commit.
2017-12-08 19:06:08 +01:00
Dmitry Vyukov
2f6fb92368 dashboard/app: improve working in bug email
As per discussion in:
https://groups.google.com/d/msg/syzkaller-bugs/atbKWcFqE9s/w88o2OvsAwAJ
2017-12-08 18:46:20 +01:00
Dmitry Vyukov
8e1e4403ac
Update syzbot.md 2017-12-08 18:45:02 +01:00
Andrey Konovalov
2d8c311ede pkg/report: fix corrupted call trace detection
linuxSymbolizeRe can match "IP: depot_fetch_stack+0x11/0x40", which is not
part of the call stack trace. Add another regexp that only matches frames.
2017-12-08 15:53:22 +01:00
Andrey Konovalov
20860a992a pkg/report: add arch/*/mm/fault.c to guilty file blacklist 2017-12-08 15:25:06 +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
dcd99c6fd1 tools: fix create-image.sh
Uncomment unintentionally commented out lines from a previous commit.
2017-12-08 13:20:50 +01:00
Dmitry Vyukov
221ec6c697 docs: clarify what is syzkaller config parameter 2017-12-08 13:18:37 +01:00
Dmitry Vyukov
b0fa969c09 prog: speedup and simplify hints code
Clone program only once.
Preallocate slices in clone.
Remove the clone full mode.
Always mutate args in place.
Allocate replacers map lazily.
Don't allocate res map at all (calculate valus on the go).
Remove sliceToUint64, pad.

benchmark          old ns/op     new ns/op     delta
BenchmarkHints     122100048     7466013       -93.89%
2017-12-08 12:27:39 +01:00
Dmitry Vyukov
5e7b20cfc3 prog: fix a data race
The race initially showed up on the new benchmark (see race report below).
The race indicated a wrong call passed to replaceArg,
as the result we sanitized the wrong call and left the new call un-sanitized.

Fix this.
Add test that exposes this.
Run benchmarks in race mode during presubmit
(benchmarks have higher chances of uncovering races than tests).

WARNING: DATA RACE
Write at 0x00c42000d3f0 by goroutine 18:
  github.com/google/syzkaller/sys/linux.(*arch).sanitizeCall()
      sys/linux/init.go:155 +0x256
  github.com/google/syzkaller/sys/linux.(*arch).(github.com/google/syzkaller/sys/linux.sanitizeCall)-fm()
      sys/linux/init.go:42 +0x4b
  github.com/google/syzkaller/prog.(*Prog).replaceArg()
      prog/prog.go:357 +0x239
  github.com/google/syzkaller/prog.generateHints.func2()
      prog/hints.go:105 +0x124
  github.com/google/syzkaller/prog.checkConstArg()
      prog/hints.go:128 +0xf3
  github.com/google/syzkaller/prog.generateHints()
      prog/hints.go:120 +0x495
  github.com/google/syzkaller/prog.(*Prog).MutateWithHints.func1()
      prog/hints.go:72 +0x67
  github.com/google/syzkaller/prog.foreachSubargImpl.func1()
      prog/analysis.go:86 +0x9f
  github.com/google/syzkaller/prog.foreachSubargImpl()
      prog/analysis.go:104 +0xc8
  github.com/google/syzkaller/prog.foreachArgArray()
      prog/analysis.go:113 +0x89
  github.com/google/syzkaller/prog.foreachArg()
      prog/analysis.go:121 +0x50
  github.com/google/syzkaller/prog.(*Prog).MutateWithHints()
      prog/hints.go:71 +0x18e
  github.com/google/syzkaller/prog.BenchmarkHints.func1()
      prog/hints_test.go:477 +0x77
  testing.(*B).RunParallel.func1()
      testing/benchmark.go:626 +0x156

Previous read at 0x00c42000d3f0 by goroutine 17:
  github.com/google/syzkaller/prog.clone()
      prog/clone.go:38 +0xbaa
  github.com/google/syzkaller/prog.(*Prog).cloneImpl()
      prog/clone.go:21 +0x17f
  github.com/google/syzkaller/prog.generateHints()
      prog/hints.go:95 +0xd0
  github.com/google/syzkaller/prog.(*Prog).MutateWithHints.func1()
      prog/hints.go:72 +0x67
  github.com/google/syzkaller/prog.foreachSubargImpl.func1()
      prog/analysis.go:86 +0x9f
  github.com/google/syzkaller/prog.foreachSubargImpl()
      prog/analysis.go:104 +0xc8
  github.com/google/syzkaller/prog.foreachArgArray()
      prog/analysis.go:113 +0x89
  github.com/google/syzkaller/prog.foreachArg()
      prog/analysis.go:121 +0x50
  github.com/google/syzkaller/prog.(*Prog).MutateWithHints()
      prog/hints.go:71 +0x18e
  github.com/google/syzkaller/prog.BenchmarkHints.func1()
      prog/hints_test.go:477 +0x77
  testing.(*B).RunParallel.func1()
      testing/benchmark.go:626 +0x156
2017-12-08 11:33:30 +01:00
Dmitry Vyukov
4016fc5ad7 prog: fix hints of data args
Hints for data args don't work.
We do all the work, but at the final stage we patch
arg in the _old_ program, not in the _new_ one.
So programs passed to the callback are all the same
and don't contain any mutations.
Tests did not catch this because they work right before that point
(don't test the actual interface function MutateWithHints).

Fix that and add a test that catches this.
2017-12-08 10:45:11 +01:00
Dmitry Vyukov
5c1e6a291b tools/syz-execprog: extend hints output
Print call number because one is usually interested
in a particular call only.
2017-12-08 10:25:41 +01:00
Dmitry Vyukov
c29495e0f9 prog: append a bunch of bytes during mutation
In some cases we need to extend a buffer by a large
margin to pass the next if in kernel (a size check).
Currently we only append a single byte, so we can
never pass the if incrementally (size is always
smaller than threshold, so 1-byte larger inputs
are not added to corpus).
2017-12-08 10:22:56 +01:00
Dmitry Vyukov
c0e5b8c81f tools: include selinux packages when building images
These packages are required to actually activate selinux during boot.
2017-12-08 10:19:09 +01:00
Dmitry Vyukov
fadd10ac05 sys/linux: add a simple description for selinux 2017-12-08 10:15:04 +01:00
Dmitry Vyukov
08c5c8bfdd dashboard/app: fix manager failed build reset
Only reset manager failed build if it uploaded _new_
successful build. On manager restart it uploads its
_old_ working build, and it should not reset a later
failed build.
2017-12-07 10:28:40 +01:00
Dmitry Vyukov
5d643f8e70 dashboard/app: fix typo in template 2017-12-06 13:12:38 +01:00
Dmitry Vyukov
a65439d5fd dashboard/app: add "pass through" reporting status
ReportingPassThrough is mostly the same as ReportingDisabled,
but dalays "special" bugs (no report, corrupted report, build error, etc).
2017-12-06 13:12:38 +01:00
Dmitry Vyukov
528deaed27 syz-ci: combine build.ID from both kernel tag and syzkaller commit
Builds with equal IDs are merged by dashboard,
so if only syzkaller commit has changed
dashboard won't create a new build and the new
syzkaller commit will be lost.
2017-12-06 13:12:38 +01:00
Dmitry Vyukov
b1d1979cc6 dashboard/app: improve error message
For some reason people sometimes drop syzbot from CC.
Then we receive the message from mailing list and can't
find the corresponding bug.
Log email subject in such cases so that it's easier to find
the corresponding email thread.
2017-12-06 13:12:38 +01:00
Dmitry Vyukov
71ac44a0c2 executor: fix build
exitf function was not defined with some combinations of options in csource.
Fix defines and switch exitf back to fail, fail already checks ENOMEM/EAGAIN,
so there is no reason to use exitf in this particular case.
2017-12-06 10:34:58 +01:00
Dmitry Vyukov
e8062ae15f dashboard/app: show more crashes on bug page
We have maxCrashes crashes without reproducers + arbitrary number
of crashes with reproducers. Crashes with reproducers can be stale.
Show more crashes.
2017-12-05 20:08:06 +01:00
Dmitry Vyukov
9a976e63d1 pkg/report: add proper oops format for kernel reboot 2017-12-05 20:08:06 +01:00