Skip to content

Commit 8f3b15c

Browse files
committed
docs: update reproduction instructions
1. Get rid of executing_syzkaller_programs.md as it now mostly overlaps with reproducing_crashes.md. 2. Update the instructions on building the kernel with syzbot compilers. 3. Update the links throughout the documentation.
1 parent b5d2be8 commit 8f3b15c

File tree

9 files changed

+84
-92
lines changed

9 files changed

+84
-92
lines changed

docs/executing_syzkaller_programs.md

Lines changed: 0 additions & 73 deletions
This file was deleted.

docs/internals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This set may need to be extended if you are using a different kernel architectur
6363

6464
`logN` files contain raw `syzkaller` logs and include kernel console output as well as programs executed before the crash.
6565
These logs can be fed to `syz-repro` tool for [crash location and minimization](reproducing_crashes.md),
66-
or to `syz-execprog` tool for [manual localization](executing_syzkaller_programs.md).
66+
or to `syz-execprog` tool for [manual localization](reproducing_crashes.md#from-execution-logs).
6767
`reportN` files contain post-processed and symbolized kernel crash reports (e.g. a KASAN report).
6868
Normally you need just 1 pair of these files (i.e. `log0` and `report0`), because they all presumably describe the same kernel bug.
6969
However, `syzkaller` saves up to 100 of them for the case when the crash is poorly reproducible, or if you just want to look at a set of crash reports to infer some similarities or differences.

docs/linux/reporting_kernel_bugs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If there are stalls or hangs, only report them if they are frequent enough or ha
4242

4343
Overall, bugs without reproducers are way less likely to be triaged and fixed.
4444
If the bug is reproducible, include the reproducer (C source if possible, otherwise a syzkaller program) and the `.config` you used for your kernel.
45-
If the reproducer is available only in the form of a syzkaller program, please link [the instructions on how to execute them](/docs/executing_syzkaller_programs.md) in your report.
45+
If the reproducer is available only in the form of a syzkaller program, please link [the instructions on how to execute them](/docs/reproducing_crashes.md#using-a-c-reproducer) in your report.
4646
Check that the reproducer works if you run it manually.
4747
Syzkaller tries to simplify the reproducer, but the result might not be ideal.
4848
You can try to simplify or annotate the reproducer manually, that greatly helps kernel developers to figure out why the bug occurs.

docs/reproducing_crashes.md

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,65 @@ $ cd syzkaller
7171
$ ./tools/syz-env make
7272
```
7373

74-
Build the kernel and boot the VM as described above.
74+
Build the kernel and boot the VM as described in the section above.
7575

76-
Download and run the reproducer:
76+
Download the reproducer:
7777
```
78-
$ export SYZKALLER_PATH="~/syzkaller"
7978
$ wget -O 'repro.syz' 'https://syzkaller.appspot.com/x/repro.syz?x=137beac0580000'
79+
```
80+
81+
Copy the reproducer and the syzkaller binaries to the test machine:
82+
```
83+
$ export SYZKALLER_PATH="~/syzkaller"
8084
$ scp -P 10022 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes $SYZKALLER_PATH/bin/linux_amd64/* ./repro.syz root@127.0.0.1:/root/
85+
```
86+
87+
Now you can use the `syz-execprog` tool to actually execute the program.
88+
89+
```
8190
$ ssh -p 10022 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes root@127.0.0.1 './syz-execprog -enable=all -repeat=0 -procs=6 ./repro.syz'
8291
```
8392

93+
Several useful `syz-execprog` flags:
94+
```
95+
-procs int
96+
number of parallel processes to execute programs (default 1)
97+
-repeat int
98+
repeat execution that many times (0 for infinite loop) (default 1)
99+
-sandbox string
100+
sandbox for fuzzing (none/setuid/namespace) (default "setuid")
101+
-threaded
102+
use threaded mode in executor (default true)
103+
```
104+
105+
If you pass `-threaded=0`, all syscalls will be executed in the same thread.
106+
`-threaded=1` forces execution of each syscall in a separate thread, so that
107+
execution can proceed over blocking syscalls.
108+
109+
Before 2021, `syz-execprog` also supported the following flag:
110+
```
111+
-collide
112+
collide syscalls to provoke data races (default true)
113+
```
114+
`-collide=1` forced second round of execution of syscalls when pairs of syscalls
115+
are executed concurrently.
116+
117+
Starting from the revision
118+
[fd8caa54](https://github.com/google/syzkaller/commit/fd8caa5462e64f37cb9eebd75ffca1737dde447d),
119+
the behavior is controlled [directly in syzlang](/docs/program_syntax.md#async).
120+
If you are running older reproducers, you might still need to set the `-collide=1` flag.
121+
122+
123+
If you are replaying a reproducer program that contains a header along the
124+
following lines:
125+
```
126+
# {Threaded:true Repeat:true RepeatTimes:0 Procs:8 Slowdown:1 Sandbox:none Leak:false NetInjection:true NetDevices:true NetReset:true Cgroups:true BinfmtMisc:true CloseFDs:true KCSAN:false DevlinkPCI:false USB:true VhciInjection:true Wifi:true IEEE802154:true Sysctl:true UseTmpDir:true HandleSegv:true Repro:false Trace:false LegacyOptions:{Collide:false Fault:false FaultCall:0 FaultNth:0}}
127+
```
128+
then you need to adjust `syz-execprog` flags based on the values in the
129+
header. Namely, `Threaded`/`Procs`/`Sandbox` directly relate to
130+
`-threaded`/`-procs`/`-sandbox` flags. If `Repeat` is set to `true`, add
131+
`-repeat=0` flag to `syz-execprog`.
132+
84133
## Using ktest
85134

86135
[ktest](https://evilpiepirate.org/git/ktest.git/tree/README.md) is a collection

docs/syzbot.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,28 +300,35 @@ reply with a `#syz fix: commit-title` so that syzbot can close the bug report.
300300
301301
<div id="syzkaller-reproducers"/>
302302
303-
## syzkaller reproducers
303+
## Running reproducers
304+
305+
*Detailed instructions on running reproducers can be found [here](/docs/reproducing_crashes.md).*
304306
305307
`syzbot` aims at providing stand-alone C reproducers for all reported bugs.
306308
However, sometimes it can't extract a reproducer at all, or can only extract a
307309
syzkaller reproducer. syzkaller reproducers are programs in a special syzkaller
308310
notation and they can be executed on the target system with a little bit more
309-
effort. See [this](/docs/executing_syzkaller_programs.md) for instructions.
311+
effort.
310312
311313
A syskaller program can also give you an idea as to what syscalls with what
312314
arguments were executed (note that some calls can actually be executed in
313315
parallel).
314316
315-
A syzkaller program can be converted to an almost equivalent C source using `syz-prog2c` utility. `syz-prog2c`
316-
has lots of flags in common with [syz-execprog](/docs/executing_syzkaller_programs.md),
317-
e.g. `-threaded` which controls if the syscalls are executed sequentially or in parallel.
317+
A syzkaller program can be converted to an almost equivalent C source using
318+
`syz-prog2c` utility. `syz-prog2c` has lots of flags in common with
319+
[syz-execprog](/docs/reproducing_crashes.md#from-execution-logs),
320+
e.g. `-threaded` which controls if the syscalls are executed sequentially or
321+
concurrently.
322+
318323
An example invocation:
319324
320325
```
321326
syz-prog2c -prog repro.syz.txt -enable=all -threaded -repeat -procs=8 -sandbox=namespace -segv -tmpdir -waitrepeat
322327
```
323328
324-
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).
329+
However, note that if `syzbot` did not provide a C reproducer, it wasn't able to
330+
trigger the bug using the C program (it might also be the case that the bug is
331+
triggered by a rare race condition).
325332
326333
## Downloadable assets
327334
@@ -345,14 +352,23 @@ then the program needs to be built with `-m32` flag.
345352
If the reproducer exits quickly, try to run it several times, or in a loop.
346353
There can be some races involved.
347354
348-
Latest compiler used by syzbot is contained in `gcr.io/syzkaller/syzbot:gcc-10.2.1` docker image.
349-
For in-tree kernel build in current directory it can be used as follows:
355+
Sometimes it might be important to build the kernel using the exact same
356+
compiler that was used by syzbot. Normally that information is included in every
357+
email report, e.g.:
358+
359+
```
360+
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
361+
```
362+
363+
The latest compilers used by syzbot are contained in the
364+
`gcr.io/syzkaller/syzbot` docker image. For in-tree kernel build in current
365+
directory it can be used as follows:
350366
351367
```
352-
docker pull gcr.io/syzkaller/syzbot:gcc-10.2.1
368+
docker pull gcr.io/syzkaller/syzbot
353369
docker run -it --user $(id -u ${USER}):$(id -g ${USER}) \
354370
--volume "$PWD:/syzkaller/pwd" --workdir /syzkaller/pwd \
355-
gcr.io/syzkaller/syzbot:gcc-10.2.1
371+
gcr.io/syzkaller/syzbot:latest
356372
make
357373
```
358374

docs/syzbot_assets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ $ ssh -p 10022 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o I
9393
In some time, you'll see the same bug report in the VM's serial output.
9494

9595
The commands above execute the `./syz-execprog -enable=all -repeat=0 -procs=6 ./repro.syz`
96-
command inside the VM. For more details see [this document](/docs/executing_syzkaller_programs.md).
96+
command inside the VM. More details can be found in [this document](/docs/reproducing_crashes.md).
9797

9898
#### Use the `tools/syz-crush` tool
9999

docs/translations/zh_CN/executing_syzkaller_programs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
> [!WARNING]
22
>
3-
> **请注意,这是社区驱动的官方 syzkaller 文档翻译。当前文档的最新版本(英文版)可在 [docs/executing_syzkaller_programs.md](/docs/executing_syzkaller_programs.md) 找到。**
3+
> **请注意,这是社区驱动的官方 syzkaller 文档翻译。当前文档的最新版本(英文版)可在 [docs/reproducing_crashes.md](/docs/reproducing_crashes.md) 找到。**
44
55
# 运行 syzkaller 程序
66

docs/translations/zh_CN/internals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Syzkaller 是一种覆盖率导向的模糊测试器。有关覆盖率收集的
5959
如果使用不同的内核架构或看到以前未见过的内核错误消息,则可能需要扩展此正则表达式集合。
6060

6161
`logN` 文件包含原始的 `syzkaller` 日志,包括内核控制台输出以及崩溃前执行的程序。
62-
这些日志可以提供给 `syz-repro` 工具进行[崩溃定位和最小化](/docs/reproducing_crashes.md),或者提供给 `syz-execprog` 工具进行[手动定位](/docs/executing_syzkaller_programs.md)
62+
这些日志可以提供给 `syz-repro` 工具进行[崩溃定位和最小化](/docs/reproducing_crashes.md),或者提供给 `syz-execprog` 工具进行[手动定位](/docs/reproducing_crashes.md)
6363
`reportN` 文件包含经过处理和符号化的内核崩溃报告(例如,KASAN 报告)。
6464
我们通常只需要这一对文件(如 `log0``report0`)中的一个,因为它们可能描述相同的内核错误。然而,`syzkaller` 最多保存100对这样的文件,以防崩溃难以重现或者您只是想通过查看一组崩溃报告来推断一些相似之处或不同之处的情况。
6565

docs/translations/zh_CN/linux/reporting_kernel_bugs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
在提交报告前需要字斟句酌。如今,Linux 维护者被日益增加的 bug 报告所淹没,因此仅仅增加报告的提交量无助于解决内核错误本身。因此,您的报告越详细越具有可操作性,解决它的可能性就越大。请注意,人们更关心内核崩溃,如释放后使用(use-after-frees)或严重错误(panics)而非仅仅是 INFO 错误信息或者类似的信息,除非从报告中清楚地指出了到底在哪里出现了什么具体问题。如果有停顿(stalls)或挂起异常(hangs),只有在它们发生得足够频繁或能够定位错误原因时才报告它们。
1212

13-
总体而言,没有重现用例 (reproducers) 的错误不太可能被分类和修复。如果内核错误是可复现的,请提交包括重现用例(如果可能的话,使用 C 源代码,否则使用 syzkaller 程序)和编译内核使用的 `.config` 文件。如果重现用例仅以 syzkaller 程序的形式提供,请在您的报告中给出链接说明[如何执行它们](/docs/executing_syzkaller_programs.md)。如果您手动运行,请检查重现用例是否正常工作。Syzkaller 试图简化复制器,但结果可能并不理想。您可以尝试手动简化或注释重现用例,这极大地帮助内核开发人员找出错误发生的原因。
13+
总体而言,没有重现用例 (reproducers) 的错误不太可能被分类和修复。如果内核错误是可复现的,请提交包括重现用例(如果可能的话,使用 C 源代码,否则使用 syzkaller 程序)和编译内核使用的 `.config` 文件。如果重现用例仅以 syzkaller 程序的形式提供,请在您的报告中给出链接说明[如何执行它们](/docs/reproducing_crashes.md)。如果您手动运行,请检查重现用例是否正常工作。Syzkaller 试图简化复制器,但结果可能并不理想。您可以尝试手动简化或注释重现用例,这极大地帮助内核开发人员找出错误发生的原因。
1414

1515
如果您想进一步做出贡献,您可以尝试了解错误并尝试自行修复内核程序。如果您无法找到正确的修复方法,但对错误有一定的了解,也请在报告中添加您的想法和结论,这将为内核开发人员节省时间。
1616

0 commit comments

Comments
 (0)