|
1 | 1 | ---
|
2 |
| -status: translating |
| 2 | +status: translated |
3 | 3 | title: "Adding new OS support"
|
4 | 4 | author: Syzkaller Community
|
5 | 5 | collector: jxlpzqc
|
6 | 6 | collected_date: 20240314
|
7 | 7 | translator: ElizaXiao
|
8 |
| -translating_date: 20240828 |
| 8 | +translated_date: 20240828 |
9 | 9 | link: https://github.com/google/syzkaller/blob/master/docs/adding_new_os_support.md
|
10 | 10 | ---
|
11 | 11 |
|
12 |
| -# Adding new OS support |
| 12 | +# 添加新的操作系统支持 |
13 | 13 |
|
14 |
| -Here are the common parts of syzkaller to edit in order to make syzkaller support a new OS kernel. However, there may be some specific changes that will be required for a given kernel (for example, gathering coverage from a given kernel, or some errors that might pop up and give a hint about what to tweak). |
| 14 | +为了让 syzkaller 支持一个新的操作系统内核,以下是需要编辑的 syzkaller 的共同部分。然而,对于特定的内核,可能还需要一些特定的更改(例如,从给定的内核收集覆盖率信息,或者一些可能弹出并给出调整提示的错误信息)。 |
15 | 15 |
|
16 | 16 | ## syz-executor
|
17 | 17 |
|
18 |
| -For each OS, there is this file `executor/executor_GOOS.h` where GOOS is the OS name. This file contains two important functions: |
| 18 | +对于每个操作系统,都有一个操作系统名为 GOOS 的文件 `executor/executor_GOOS.h`。这个文件包含两个重要函数: |
19 | 19 |
|
20 |
| -- `os_init` which is responsible for mapping a virtual address space for the calling process, |
21 |
| -- `execute_syscall` which is responsible for executing system calls for a particular OS kernel. |
| 20 | +- `os_init` 负责为调用进程映射虚拟地址空间, |
| 21 | +- `execute_syscall` 负责为特定操作系统内核执行系统调用。 |
22 | 22 |
|
23 |
| -These two functions, are called in `executor/executor.cc`, which is mainly responsible for executing the syscalls programs, and managing the threads in which the programs run. |
| 23 | +这两个函数在 `executor_GOOS.h` 中被调用,它主要负责执行系统调用程序,并管理程序运行的线程。 |
24 | 24 |
|
25 |
| -`executor_GOOS.h` also contains functions related to that operating system such as functions that allow it to gather coverage information, detect bitness, etc. (Example: [executor_linux.h](/executor/executor_linux.h) ). |
| 25 | +`executor_GOOS.h` 还包含与该操作系统相关的函数,例如允许它收集覆盖率信息、检测位宽等的函数(例如:[executor_linux.h](/executor/executor_linux.h))。 |
26 | 26 |
|
27 |
| -The intended function will be called according to the target kernel as defined by the macros in the `executor/executor.cc` file. |
| 27 | +目标内核将根据 `executor/executor.cc` 文件中定义的宏调用预期的函数。 |
28 | 28 |
|
29 |
| -## Build files `pkg/` |
| 29 | +## 构建文件 `pkg/` |
30 | 30 |
|
31 |
| -- The OS name is added to `pkg/build/build.go` along with the supported architecture |
32 |
| -- Creating a file that builds the image for the targeted kernel under `pkg/build/`. This file contains functions for configuring the build of the bootable image, for building it, and for generate SSH keys which will be used by Syzkaller in order to access the VM. There is a file per each of the supported OSes by Syzkaller where the name pattern is `GOOS.go`. |
| 31 | +- 在 `pkg/build/build.go` 中添加操作系统名称及其支持的架构 |
| 32 | +- 在 `pkg/build/` 下创建一个构建目标内核镜像的文件。这个文件包含配置可启动镜像构建的函数、构建它以及生成 SSH 密钥的函数,这些密钥将由 Syzkaller 用于访问虚拟机。每个由 Syzkaller 支持的操作系统都有一个名为 `GOOS.go` 的文件。 |
33 | 33 |
|
34 |
| -- Adding the given target to the `s/makefile/Makefile/`. |
| 34 | +- 将给定目标添加到 `s/makefile/Makefile/`。 |
35 | 35 |
|
36 |
| -## Report files `pkg/report/` |
| 36 | +## 报告文件 `pkg/report/` |
37 | 37 |
|
38 |
| -Creating a file that reports build errors for the targeted kernel under `pkg/report/`. There is a file per each of the supported OSes by Syzkaller where the name pattern is `GOOS.go`. |
| 38 | +在 `pkg/report/` 下为目标内核创建一个报告构建错误的文件。每个由 Syzkaller 支持的操作系统都有一个名为 `GOOS.go` 的文件。 |
39 | 39 |
|
40 |
| -## Editing `pkg/host/` |
| 40 | +## 编辑 `pkg/host/` |
41 | 41 |
|
42 |
| -- implement `isSupported` function that returns true for a supported syscall, it is located under `pkg/host/GOOS`. |
| 42 | +- 实现 `isSupported` 函数,该函数对于支持的系统调用返回 true,它位于 `pkg/host/GOOS` 目录下。 |
43 | 43 |
|
44 |
| -## Creating a file under `sys/GOOS/` |
| 44 | +## 在 `sys/GOOS/` 下创建文件 |
45 | 45 |
|
46 |
| -Creating a file `init.go` for the targeted kernel under `sys/GOOS/`that included the function `initTarget` that initializes the target and the different supported architectures. |
| 46 | +在 `sys/GOOS/` 下为目标内核创建一个 `init.go` 文件,其中包含初始化目标和不同支持架构的 `initTarget` 函数。 |
47 | 47 |
|
48 |
| -## Editing `sys/syz-extract` |
| 48 | +## 编辑 `sys/syz-extract` |
49 | 49 |
|
50 |
| -Adding the new kernel name with already existing supported kernels to the file `sys/syz-extract/extract.go`. |
| 50 | +将新内核名称添加到已支持的内核列表中,并更新到文件 `sys/syz-extract/extract.go` 中。 |
51 | 51 |
|
52 |
| -## Editing `sys/targets` |
| 52 | +## 编辑 `sys/targets` |
53 | 53 |
|
54 |
| -Adding the new kernel name with already existing supported kernels to the file `targets.go` which is located under`sys/targets`. |
| 54 | +将新内核名称添加到已支持的内核列表中,并更新到文件 `sys/targets/targets.go` 中。 |
55 | 55 |
|
56 |
| -## Editing `vm/qemu` |
| 56 | +## 编辑 `vm/qemu` |
57 | 57 |
|
58 |
| -Adding the new kernel name with already existing supported kernels to the file `qemo.go` which is located under `vm/qemu`. |
| 58 | +将新内核名称添加到已支持内核的列表中,并更新到文件 `vm/qemu/qemu.go` 中。 |
59 | 59 |
|
60 |
| -## Syzkaller description & pseudo-syscalls |
| 60 | +## Syzkaller 描述与伪系统调用 |
61 | 61 |
|
62 |
| -Check [descriptions](/docs/syscall_descriptions.md), and [pseudo-syscalls](/docs/pseudo_syscalls.md). |
| 62 | +查看 [描述](/docs/syscall_descriptions.md) 与 [伪系统调用](/docs/pseudo_syscalls.md). |
0 commit comments