aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-03-15 14:27:33 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-03-15 14:27:33 +0100
commit38f9e55de56b226645aed1a890b90adc9c82f4d6 (patch)
tree6e380939c9e717ceaabbb3bfebcb18705afb7118 /README.md
parentbebcaf3b934ed3503a3d3875c99523c00d4b0d13 (diff)
parent423e5ccacbe46c716d916a7aad5a8cab8e85f0a5 (diff)
Merge pull request #34 from daviddrysdale/doc-update
Some doc & diagnostic updates
Diffstat (limited to 'README.md')
-rw-r--r--README.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md
index 9043d7d2e..8975c3bed 100644
--- a/README.md
+++ b/README.md
@@ -200,6 +200,44 @@ Here are some things to check if there are problems running syzkaller.
so the main configuration needs to be updated to set `dropprivs` to `false`.
+## Fuzzing new system calls
+
+This section describes how to extend syzkaller to allow fuzz testing of a new system call;
+this is particularly useful for kernel developers who are proposing new system calls.
+
+First, add a declarative description of the new system call to the appropriate file:
+ - Various `sys/<subsystem>.txt` files hold system calls for particular kernel
+ subsystems, for example `bpf` or `socket`.
+ - [sys/sys.txt](sys/sys.txt) holds descriptions for more general system calls.
+ - An entirely new subsystem can be added as a new `sys/<new>.txt` file, but needs
+ the `generate` target in the [Makefile](Makefile) to be updated to include it.
+
+The description format is described [above](#syscall-description) and in the
+master [sys/sys.txt](sys/sys.txt) file.
+
+Next, run `make LINUX=$KSRC generate` with `KSRC` set to the location of a kernel
+source tree (for up to date kernel headers); if the kernel was built into a separate
+directory (with `make O=...`) then also set `LINUXBLD=$KBLD` to the location of the
+build directory.
+
+This will re-create the following source code files:
+ - `sys/sys.go`: Code to initialize a Go [data structure](sys/decl.go) with information
+ about all of the available system calls.
+ - `prog/consts.go`: Constant definitions for all the named constants that are
+ mentioned in the system call descriptions.
+ - `sys/sys_<ARCH>.go`: Data structure to map syzkaller internal syscall IDs to
+ (per-architecture) kernel syscall numbers.
+ - `executor/syscalls.h`: Constant definitions (in C) for all system call numbers.
+
+If there are problems with this step, run `bin/syz-sysgen` directly and add
+the use `-v=5` flag to show more details of the generation process.
+
+Rebuild syzkaller (`make clean all`) to force use of the new system call definitions.
+
+Finally, adjust the `enable_syscalls` configuration value for syzkaller to specifically target the
+new system calls.
+
+
## Disclaimer
This is not an official Google product.