diff options
Diffstat (limited to 'docs/fuchsia/README.md')
-rw-r--r-- | docs/fuchsia/README.md | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/docs/fuchsia/README.md b/docs/fuchsia/README.md index 472362c0e..5c65ea405 100644 --- a/docs/fuchsia/README.md +++ b/docs/fuchsia/README.md @@ -9,30 +9,25 @@ and [Source Code](https://fuchsia.googlesource.com/fuchsia/+/master/docs/develop To run syzkaller with a fuchsia target, you will need: * A fuchsia checkout. -* The [fuchsia - sdk](https://chrome-infra-packages.appspot.com/p/fuchsia/sdk/core/linux-amd64/+/). -* [clang with fuchsia - support](https://chrome-infra-packages.appspot.com/p/fuchsia/clang/linux-amd64/+/). The rest of the document will use the following environment variables: * `SOURCEDIR` path of your fuchsia checkout. -* `FX_SDK_PATH` path where you extracted the fuchsia sdk. -* `CLANG_PATH` path where you extracted clang. -### Build Go toolchain for fuchsia +## Building Fuchsia -Syzkaller needs to cross-compile it's Go binaries to run in fuchsia, so first -you need to compile a Go toolchain that can compile binaries for fuchsia. - -Once you downloaded and extracted the fuchsia sdk and clang, run: +To build fuchsia run: +```shell +$ fx --dir "out/arm64" set core.arm64 --with-base "//bundles:tools" +$ fx clean-build ``` -$ make TARGETOS=fuchsia TARGETARCH=amd64 \ - SOURCEDIR=path/to/fuchsia/checkout \ - FX_SDK_PATH=path/to/fuchsia/sdk \ - CLANG_PATH=path/to/clang \ - fuchsia_go + +And + +```shell +$ fx --dir "out/x64" set core.x64 --with-base "//bundles:tools" +$ fx clean-build ``` ## Building binaries for fuchsia @@ -41,9 +36,7 @@ To build all the binaries required for running syzkaller in fuchsia, run: ``` $ make TARGETOS=fuchsia TARGETARCH=amd64 \ - SOURCEDIR=path/to/fuchsia/checkout \ - FX_SDK_PATH=path/to/fuchsia/sdk \ - CLANG_PATH=path/to/clang + SOURCEDIR=path/to/fuchsia/checkout ``` ## Running syz-manager @@ -54,6 +47,8 @@ Running syz-manager requires you to have built fuchsia previously, and added the $ ${SOURCEDIR}/out/x64.zircon/tools/zbi -o ${SOURCEDIR}/out/x64/fuchsia-ssh.zbi ${SOURCEDIR}/out/x64/fuchsia.zbi --entry "data/ssh/authorized_keys=${SOURCEDIR}/.ssh/authorized_keys" ``` +Note: This needs to be repeated after each `fx build`. + Run `syz-manager` with a config along the lines of: ``` { @@ -81,20 +76,7 @@ Run `syz-manager` with a config along the lines of: ## Update syscall and fidl definitions -Syscall descriptions live in the `sys/fuchsia` folder. To update a syscall, you need to modify the `.txt` file that contains it, make sure your new definition matches the one in zircon's [syscalls.abigen](https://fuchsia.googlesource.com/fuchsia/+/master/zircon/system/public/zircon/syscalls.abigen) file. **If the syscall was used in `executor/common_fuchsia.h`, you need to update the usages there as well**. FIDL definitions do not need manual updating because they are extracted automatically when you run make extract, but they require a fuchsia built for each architecture. - -To build fuchsia run: -```shell -$ fx --dir "out/x64" set core.x64 --with-base "//bundles:tools" -$ fx clean-build -``` - -And - -```shell -$ fx --dir "out/arm64" set core.arm64 --with-base "//bundles:tools" -$ fx clean-build -``` +Syscall descriptions live in the `sys/fuchsia` folder. To update a syscall, you need to modify the `.txt` file that contains it, make sure your new definition matches the one in zircon's [syscalls.abigen](https://fuchsia.googlesource.com/fuchsia/+/master/zircon/system/public/zircon/syscalls.abigen) file. **If the syscall was used in `executor/common_fuchsia.h`, you need to update the usages there as well**. FIDL definitions do not need manual updating because they are extracted automatically when you run `make extract`, but they require Fuchsia to be rebuilt for each architecture (see "Building Fuchsia" above). Once you updated the syscalls definitions, everything can be regenerated by running: @@ -105,6 +87,8 @@ make generate ## How to generate syscall description for FIDL +TODO: This section is out of date. + Syscall descriptions for FIDL are automatically generated as part of `make extract` as described above. However, if you wish to manually generate syscall descriptions for a given `.fidl` file, do the following. @@ -112,14 +96,15 @@ However, if you wish to manually generate syscall descriptions for a given `.fid FIDL files should first be compiled into FIDL intermediate representation (JSON) files using `fidlc`: ```bash -/fuchsia/out/x64/host_x64/fidlc --json /tmp/io.json --files /fuchsia/zircon/system/fidl/fuchsia-io/io.fidl +$SOURCEDIR/out/x64/host_x64/fidlc --json /tmp/io.json --files $SOURCEDIR/zircon/system/fidl/fuchsia-io/io.fidl ``` Then run FIDL compiler backend `fidlgen` with syzkaller generator, which compiles a FIDL IR file into a syscall description file: ```bash -/fuchsia/out/x64/host_x64/fidlgen -generators syzkaller -json /tmp/io.json -output-base fidl_io -include-base fidl_io +$SOURCEDIR/out/x64/host_x64/fidlgen -generators syzkaller -json /tmp/io.json -output-base fidl_io -include-base fidl_io ``` + ## Running syz-ci locally To run `syz-ci` locally for Fuchsia, you need: |