Skip to content

Commit

Permalink
Merge pull request #17 from Athanlaich/提交翻译setup_linux-host_android-d…
Browse files Browse the repository at this point in the history
…evice_arm-kernel.md

翻译完成setup_linux-host_android-device_arm-kernel.md
  • Loading branch information
mudongliang authored Apr 7, 2024
2 parents 01564f5 + 33c987b commit 9336b6c
Showing 1 changed file with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
---
status: translating
status: translated
title: "Setup: Linux host, Android device, arm32/64 kernel"
author: Syzkaller Community
collector: jxlpzqc
collected_date: 20240314
translator: Athanlaich
translated_date: 20240401
link: https://github.com/google/syzkaller/blob/master/docs/linux/setup_linux-host_android-device_arm-kernel.md
---

# Setup: Linux host, Android device, arm32/64 kernel
# 设置:Linux 主机,Android 设备,arm32/64 内核

**Note: fuzzing the kernel on a real Android device may brick it.**
**注意:对真实的 Android 设备进行内核模糊测试可能会使其被破坏。**

This document details the steps involved in setting up a syzkaller instance fuzzing an `arm32/64` linux kernel on an Android device.
本文详细介绍了在 Android 设备上设置 syzkaller 实例对 `arm32/64` Linux 内核进行模糊测试的步骤。

Some features of syzkaller may not yet work properly on `arm32`. For example, not all debugging and test coverage features are available in the Linux kernel for `arm32`, limiting the efficacy of syskaller in finding bugs fast.
一些 syzkaller 的功能可能在 `arm32` 上尚不能正常工作。例如,对于 `arm32`,Linux 内核中并不提供所有的调试和测试覆盖功能,这限制了 syzkaller 在快速发现错误方面的有效性。

These were tested on an NXP Pico-Pi-IMX7D following the instructions [here](https://developer.android.com/things/hardware/developer-kits.html).
这些步骤在 NXP Pico-Pi-IMX7D 上进行了测试,遵循了[这里](https://developer.android.com/things/hardware/developer-kits.html)的说明.

You may find additional details in syzkaller's `adb` vm implementation [here](/vm/adb/adb.go).
您可以在 syzkaller`adb` vm 实现[这里](https://github.com/google/syzkaller/blob/master/vm/adb/adb.go)找到更多详细信息。

## Device setup
## 设备设置

Follow the instructions for your board to install Android and make sure the device boots properly.
按照您的开发板说明安装 Android,并确保设备正常启动。

Set up the adb bridge so that adb and fastboot work.
设置 adb 桥接,使 adb fastboot 正常工作。

Set up a serial port, following the instructions for your device so that you can monitor kernel log messages. On Android-based boards the serial port is typically exposed as a USB (or some custom) port, or over GPIO pins. On phones you can use Android Serial Cable or [Suzy-Q](https://chromium.googlesource.com/chromiumos/platform/ec/+/master/docs/case_closed_debugging.md). syzkaller can work without a dedicated serial port as well (by falling back to `adb shell dmesg -w`), but that is unreliable and turns lots of crashes into "lost connection to test machine" crashes with no additional info.
设置串行端口,按照您设备的说明操作,以便监视内核日志消息。在基于 Android 的开发板上,串行端口通常以 USB(或某些自定义)端口,或通过 GPIO 引脚的形式暴露。在手机上,您可以使用 Android 串行电缆或[Suzy-Q](https://chromium.googlesource.com/chromiumos/platform/ec/+/master/docs/case_closed_debugging.md)syzkaller 也可以在没有专用串行端口的情况下工作(通过回退到`adb shell dmesg -w`),但这是不可靠的,并且会将许多崩溃转换为 "丢失与测试机器的连接" 崩溃,并且没有额外的信息。

Get the proper compiler toolchain for your device.
获取适合您设备的编译器工具链。

Recompile and reinstall the Linux kernel with [debugging kernel options](https://github.com/xairy/syzkaller/blob/up-docs/docs/linux/kernel_configs.md) available on your board. You might benefit from backporting KCOV or KASAN patches.
在您的开发板上重新编译并重新安装具有[调试内核选项](https://github.com/xairy/syzkaller/blob/up-docs/docs/linux/kernel_configs.md) 的 Linux 内核。你可能会从后向移植 KCOV KASAN 补丁中受益。

## Building syzkaller
## 构建 syzkaller

Get syzkaller as described [here](/docs/linux/setup.md#go-and-syzkaller).
按照[这里](https://github.com/google/syzkaller/blob/master/docs/linux/setup.md#go-and-syzkaller)的说明获取 syzkaller。

The build it for either `arm` or `arm64` target architecture depending on the device you're using.
然后根据您使用的设备,为 `arm` `arm64` 目标架构构建 syzkaller。

``` bash
make TARGETOS=linux TARGETARCH=arm
Expand All @@ -46,15 +47,15 @@ make TARGETOS=linux TARGETARCH=arm
make TARGETOS=linux TARGETARCH=arm64
```

In case you have old Android `/dev/ion` driver (kernel <= 3.18) before building syzkaller copy old `/dev/ion` descriptions:
如果您使用的是旧版 Android `/dev/ion` 驱动程序(内核 <= 3.18),在构建 syzkaller 之前,请复制旧的`/dev/ion`描述:

``` bash
cp sys/android/* sys/linux
```

## Manager config
## 管理器配置

Create a manager config `android.cfg`:
创建一个管理器配置文件 `android.cfg`

```
{
Expand All @@ -72,24 +73,24 @@ Create a manager config `android.cfg`:
}
```

Replace the variables `$GOPATH`, `$KERNEL` (path to kernel build directory), and `$DEVICES` (the device ID for your board as reported by adb devices, e.g. `ABCD000010`) with their actual values.
将变量 `$GOPATH``$KERNEL`(内核构建目录的路径)和 `$DEVICES` (由 adb devices 报告的您的开发板设备 ID,例如 `ABCD000010`)替换为实际值。

For `arm64` use `"target": "linux/arm64"`.
对于 `arm64`,使用 `"target": "linux/arm64"`

If your kernel doesn't support coverage collection (e.g. `arm32` without KCOV patches) set `"cover": false`.
如果您的内核不支持覆盖率收集(例如,没有 KCOV 补丁的 `arm32`),请设置 `"cover": false`

Turn off `battery_check` if your device doesn't have battery service, see the comment [here](/vm/adb/adb.go) for details.
如果您的设备没有电池服务,请关闭 `battery_check`,详情请参见[此处](/vm/adb/adb.go)的注释。

## Running syzkaller
## 运行 syzkaller

Run syzkaller manager:
运行 syzkaller 管理器:

``` bash
./bin/syz-manager -config=android.cfg
```

Now syzkaller should be running, you can check manager status with your web browser at `127.0.0.1:56741`.
现在 syzkaller 应该正在运行,您可以在 web 浏览器中输入 `127.0.0.1:56741` 检查管理器状态。

If you get issues after `syz-manager` starts, consider running it with the `-debug` flag.
如果在 `syz-manager` 启动后遇到问题,请考虑使用 `-debug` 标志运行。

Also see [this page](/docs/troubleshooting.md) for troubleshooting tips and [Building a Pixel kernel with KASAN+KCOV](https://source.android.com/devices/tech/debug/kasan-kcov) or [Building a PH-1 kernel with KASAN+KCOV](https://github.com/EssentialOpenSource/kernel-manifest/blob/master/README.md) for kernel build/boot instructions.
此外,查看[此页面](https://github.com/google/syzkaller/blob/master/docs/troubleshooting.md)获取故障排除提示,并查看[使用 KASAN+KCOV 构建 Pixel 内核](https://source.android.com/devices/tech/debug/kasan-kcov)[使用 KASAN+KCOV 构建 PH-1 内核](https://github.com/EssentialOpenSource/kernel-manifest/blob/master/README.md)以获取内核构建/启动说明。

0 comments on commit 9336b6c

Please sign in to comment.