From e9c477a5b3a05a614d9a0c68ba9724762a363784 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 25 Sep 2017 08:47:15 +0200 Subject: sys/syz-extract: support fuchsia --- docs/syscall_descriptions.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'docs/syscall_descriptions.md') diff --git a/docs/syscall_descriptions.md b/docs/syscall_descriptions.md index 3fd5de919..a1ea560ae 100644 --- a/docs/syscall_descriptions.md +++ b/docs/syscall_descriptions.md @@ -10,8 +10,8 @@ close(fd fd) open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH ``` -The description is contained in `sys/*.txt` files. -For example see the [sys/sys.txt](/sys/sys.txt) file. +The description is contained in `sys/linux/*.txt` files. +For example see the [sys/linux/sys.txt](/sys/linux/sys.txt) file. ## Syntax @@ -25,11 +25,11 @@ The first step is extraction of values of symbolic constants from Linux sources `syz-extract` generates a small C program that includes kernel headers referenced by `include` directives, defines macros as specified by `define` directives and prints values of symbolic constants. Results are stored in `.const` files, one per arch. -For example, [sys/tty.txt](/sys/tty.txt) is translated into [sys/tty_amd64.const](/sys/tty_amd64.const). +For example, [sys/linux/tty.txt](/sys/linux/tty.txt) is translated into [sys/linux/tty_amd64.const](/sys/linux/tty_amd64.const). The second step is generation of Go code for syzkaller. This step uses syscall descriptions and the const files generated during the first step. -You can see a result in [sys/sys_amd64.go](/sys/sys_amd64.go) and in [executor/syscalls.h](/executor/syscalls.h). +You can see a result in [sys/linux/amd64.go](/sys/linux/amd64.go) and in [executor/syscalls_linux.h](/executor/syscalls_linux.h). ## Describing new system calls @@ -37,24 +37,23 @@ This section describes how to extend syzkaller to allow fuzz testing of a new sy 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/.txt` files hold system calls for particular kernel + - Various `sys/linux/.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/.txt` file. + - [sys/linux/sys.txt](/sys/linux/sys.txt) holds descriptions for more general system calls. + - An entirely new subsystem can be added as a new `sys/linux/.txt` file. The description of the syntax can be found [here](syscall_descriptions_syntax.md). -If the subsystem is present in the mainline kernel, add the new txt file to `sys/extract.sh` file -and run `make extract LINUX=$KSRC` with `$KSRC` set to the location of a kernel source tree. -This will generate const files. +If the subsystem is present in the mainline kernel, run `make extract TARGETOS=linux SOURCEDIR=$KSRC` +with `$KSRC` set to the location of a kernel source tree. This will generate const files. Not, that this will overwrite `.config` file you have in `$KSRC`. If the subsystem is not present in the mainline kernel, then you need to manually run `syz-extract` binary: ``` make bin/syz-extract -bin/syz-extract -arch $ARCH -linux "$LINUX" -linuxbld "$LINUXBLD" sys/.txt +bin/syz-extract -os linux -arch $ARCH -sourcedir "$LINUX" -builddir "$LINUXBLD" .txt ``` -`$ARCH` is one of `amd64`, `arm64`, `ppc64le`. +`$ARCH` is one of `amd64`, `386` `arm64`, `arm`, `ppc64le`. If the subsystem is supported on several architectures, then run `syz-extract` for each arch. `$LINUX` should point to kernel source checkout, which is configured for the corresponding arch (i.e. you need to run `make someconfig && make` there first). If the kernel was built into a separate directory (with `make O=...`) then also set `$LINUXBLD` to the location of the build directory. -- cgit mrf-deployment