2017-08-17 13:08:38 +02:00
# syzbot
`syzbot` system continuously fuzzes main Linux kernel branches and automatically
2018-03-20 15:09:10 +01:00
reports found bugs to kernel mailing lists.
[syzbot dashboard ](https://syzkaller.appspot.com ) shows current statuses of
bugs. All `syzbot` -reported bugs are also CCed to
[syzkaller-bugs mailing list ](https://groups.google.com/forum/#!forum/syzkaller-bugs ).
Direct all questions to `syzkaller@googlegroups.com` .
2017-08-17 13:08:38 +02:00
2017-10-24 13:30:53 +02:00
## Bug status tracking
`syzbot` needs to know when a bug is fixed in order to (1) verify that it is
in fact fixed and (2) be able to report other similarly-looking crashes
(while a bug is considered open all similarly-looking crashes are merged into
the existing bug). To understand when a bug is fixed `syzbot` needs to know
what commit fixes the bug; once `syzbot` knows the commit it will track when
the commit reaches all kernel builds on all tracked branches. Only when the
commit reaches all builds, the bug is considered closed (new similarly-looking
crashes create a new bug).
## Communication with syzbot
2017-12-25 12:07:06 +01:00
If you fix a bug reported by `syzbot` , please add the provided `Reported-by`
tag to the commit. You can also communicate with `syzbot` by replying to its
emails. The commands are:
2017-10-24 13:30:53 +02:00
2017-12-25 12:07:06 +01:00
- to attach a fixing commit to the bug (if you forgot to add `Reported-by` tag):
2017-10-24 13:30:53 +02:00
```
#syz fix: exact-commit-title
````
2017-12-08 18:45:02 +01:00
It's enough that the commit is merged into any tree, in particular,
you don't need to wait for the commit to be merged into upstream tree.
`syzbot` only needs to know the title by which it will appear in tested trees.
In case of an error or a title change, you can override the commit simply
by sending another `#syz fix` command.
2017-11-17 21:04:40 +01:00
- to test a patch for a bug *with reproducer* :
```
#syz test: git://repo/address.git branch
```
and provide the patch inline or as a text attachment. Attachments are more
reliable because of email clients splitting lines and messing with whitespaces.
`syzbot` will test the patch on `HEAD` of the specified git repo/branch.
2018-01-16 11:58:28 +01:00
Note: this can be used both for testing fix patches and just for debugging
(i.e. adding additional checks to code and testing with them).
2018-02-22 12:53:31 +01:00
Note: you may send the request only to `syzbot` email address, as patches sent
to some mailing lists (e.g. netdev, netfilter-devel) will trigger patchwork.
2018-01-16 11:58:28 +01:00
After sending an email you should get a reply email with results within an hour.
2017-10-24 13:30:53 +02:00
- to mark the bug as a duplicate of another `syzbot` bug:
```
#syz dup: exact-subject-of-another-report
```
2018-04-01 13:43:18 +02:00
- to undo a previous dup command and turn it into an independent bug again:
```
#syz undup
```
2017-10-24 13:30:53 +02:00
- to mark the bug as a one-off invalid report (e.g. induced by a previous memory corruption):
```
#syz invalid
```
2017-12-08 18:45:02 +01:00
**Note**: if the crash happens again, it will cause creation of a new bug report.
2017-10-24 13:30:53 +02:00
2017-12-08 18:45:02 +01:00
**Note**: all commands must start from beginning of the line.
**Note**: please keep `syzkaller-bugs@googlegroups.com` mailing list in CC.
2017-11-18 18:54:17 +01:00
It serves as a history of what happened with each bug report.
2017-10-24 13:30:53 +02:00
2017-08-17 13:08:38 +02:00
## syzkaller reproducers
`syzbot` aims at providing stand-alone C reproducers for all reported bugs.
However, sometimes it can't extract a reproducer at all, or can only extract a
syzkaller reproducer. syzkaller reproducers are programs in a special syzkaller
notation and they can be executed on the target system with a little bit more
effort. See [this ](https://github.com/google/syzkaller/blob/master/docs/executing_syzkaller_programs.md )
for instructions.
A syskaller program can also give you an idea as to what syscalls with what
arguments were executed (note that some calls can actually be executed in
parallel).
2018-03-07 17:08:01 +01:00
A syzkaller program can be converted to an almost equivalent C source using `syz-prog2c` utility. `syz-prog2c` has lots of flags in common with [syz-execprog ](https://github.com/google/syzkaller/blob/master/docs/executing_syzkaller_programs.md ), e.g. `-threaded` /`-collide` which control if the syscalls are executed sequentially or in parallel. An example invocation:
```
syz-prog2c -prog repro.syz.txt -threaded -collide -repeat -procs=8 -sandbox=namespace -tun -tmpdir -waitrepeat
```
However, note that if `syzbot` did not provide a C reproducer, it wasn't able to trigger the bug using the C program (though, it can be just because the bug is triggered by a subtle race condition).
2017-08-17 13:08:38 +02:00
## Crash does not reproduce?
2018-02-02 09:49:21 +01:00
If the provided reproducer does not work for you, most likely it is related to the
2017-08-17 13:08:38 +02:00
fact that you have slightly different setup than `syzbot` . `syzbot` has obtained
the provided crash report on the provided reproducer on a freshly-booted
machine, so the reproducer worked for it somehow.
2018-02-02 09:49:21 +01:00
`syzbot` uses GCE VMs for testing, but *usually* it is not important.
2017-08-17 13:08:38 +02:00
If the reproducer exits quickly, try to run it several times, or in a loop.
There can be some races involved.
2017-10-24 13:17:14 +02:00
2018-04-05 11:56:07 +02:00
Exact compilers used by `syzbot` can be found here:
- [gcc 7.1.1 20170620 ](https://storage.googleapis.com/syzkaller/gcc-7.tar.gz ) (245MB)
- [gcc 8.0.1 20180301 ](https://storage.googleapis.com/syzkaller/gcc-8.0.1-20180301.tar.gz ) (286MB)
2018-04-12 15:57:16 +02:00
- [gcc 8.0.1 20180412 ](https://storage.googleapis.com/syzkaller/gcc-8.0.1-20180412.tar.gz ) (33MB)
2018-04-05 11:56:07 +02:00
- [clang 7.0.0 (trunk 329060) ](https://storage.googleapis.com/syzkaller/clang-kmsan-329060.tar.gz ) (44MB)
2017-10-26 18:12:36 +02:00
A qemu-suitable Debian/wheezy image can be found [here ](https://storage.googleapis.com/syzkaller/wheezy.img ) (1GB, compression somehow breaks it), root ssh key for it is [here ](https://storage.googleapis.com/syzkaller/wheezy.img.key ).
2017-10-26 10:29:03 +02:00
2017-10-24 13:17:14 +02:00
## No reproducer at all?
Reproducers are best-effort. `syzbot` always tries to create reproducers, and
once it has one it adds it to the bug. If there is no reproducer referenced in a
bug, a reproducer does not exist. There are multiple reasons why `syzbot` can
fail to create a reproducer: some crashes are caused by subtle races and are
very hard to reproduce in general; some crashes are caused by global accumulated
state in kernel (e.g. lockdep reports); some crashes are caused by
non-reproducible coincidences (e.g. an integer `0x12345` happened to reference an
existing IPC object) and there is long tail of other reasons.
2017-10-24 13:30:53 +02:00
2018-04-05 11:56:07 +02:00
## KMSAN bugs
`KMSAN` is a dynamic, compiler-based tool (similar to `KASAN` ) that detects
uses of uninitialized values. As compared to (now deleted) `KMEMCHECK` which
simply detected loads of non-stored-to memory, `KMSAN` tracks precise
propagation of uninitialized values through memory and registers and only flags
actual eventual uses of uninitialized values. For example, `KMSAN` will detect
a branch on or a `copy_to_user()` of values that transitively come from
uninitialized memory created by heap/stack allocations. This ensures
/theoretical/ absense of both false positives and false negatives (with some
implementation limitations of course).
`KMSAN` is not upstream yet, though, we want to upstream it later. For now,
it lives in [github.com/google/kmsan ](https://github.com/google/kmsan ) and is
based on a reasonably fresh upstream tree. As the result, any patch testing
2018-04-09 09:49:36 +02:00
requests for `KMSAN` bugs need to go to `KMSAN` tree
(`https://github.com/google/kmsan.git` ). Also note that `KMSAN` requires
`clang` compiler.
Report explanation. The first call trace points to the `use` of the uninit value
(which is usually a branching or copying it to userspace). Then there are 0 or
more "Uninit was stored to memory at:" stacks which denote how the unint value
travelled through memory. Finally there is a "Uninit was created at:"
section which points either to a heap allocation or a stack variable which
is the original source of uninitialized-ness.
2018-04-05 11:56:07 +02:00
2018-04-10 13:36:15 +02:00
## No custom patches
While `syzbot` can test patches that fix bugs, it does not support applying
custom patches during fuzzing. It always tests vanilla unmodified git trees.
There are several reasons for this:
- custom patches may not apply tomorrow
- custom patches may not apply to all of the tested git trees
- it's hard to communicate exact state of the code with bug reports (not just hash anymore)
- line numbers won't match in reports (which always brings suspecion as to the quality of reports)
- custom patches can also introduce bugs, and even if they don't a developer may (rightfully)
question validity of and may not want to spend time on reports obtained
with a number of out-of-tree patches
- order of patch application generatelly matters, and at some point patches
need to be removed, there is nobody to manage this
We've experimented with application of custom patches in the past and it lead
to unrecoverable mess. If you want `syzbot` to pick up patches sooner,
ask tree maintainers for priority handling.
2017-10-24 13:30:53 +02:00
## Is syzbot code available?
Yes, it is [here ](https://github.com/google/syzkaller/tree/master/dashboard/app ).