syzkaller Documentation

repository·master·Indexed 27 days ago

https://github.com/google/syzkaller

An unsupervised coverage-guided kernel fuzzer used to discover vulnerabilities in operating system kernels including Linux, Windows, and FreeBSD. Documentation covers the syzkaller dashboard (a Go application for syzbot), Linux kernel configuration generation via the syz-kconf utility, and the process for building and installing XNU kernels optimized for fuzzing on macOS.

Tokens
94.6K
Snippets
226
Records
467
Agent score
90%

What's inside syzkaller

  1. Overview of Hafnium support in syzkaller

    master
    Hafnium is a hypervisor supported by syzkaller. Note that this support is currently a work-in-progress. For detailed instructions on building and running Hafnium, you must refer to the external Hafnium project documentation. For protocol descriptions related to the AF_HF protocol, refer to the documentation provided by the Hafnium Linux driver.
  2. Overview of syz-cluster architecture

    master

    syz-cluster is a distributed patch series fuzzing system built on top of syzkaller. It is designed to be deployed on a Kubernetes (K8S) cluster.

    Core Services

    • dashboard: A read-only web interface.
    • controller: Manages system state, schedules fuzzing sessions, and provides an API for other components.
    • series-tracker: Polls LKML git archives for new series.
    • reporter-server: Generates new reports and provides an API for reporter implementations.
    • email-reporter: Sends reports via email and handles incoming email commands.

    Patch Processing Workflow

    Patch processing is orchestrated by Argo Workflows using the following steps (defined in pkg/workflow/template.yaml):

    1. workflow/triage
    2. workflow/build
    3. workflow/boot
    4. workflow/fuzz

    Note: Triage and build steps require kernel checkouts. The base kernel repository is hosted on a shared network disk and updated via kernel-disk scripts.

    Deployment and Configuration

    The system uses Kustomize to support multiple environments:

    • overlays/local/minikube: Local development environment.
    • overlays/gke/staging: Staging production environment.
    • overlays/gke/prod: Production environment (deployed at https://ci.syzbot.org).

    global-config.yaml is the primary configuration file used to determine mailing lists to poll, resource usage, and reporting settings.

  3. Overview of syzkaller kernel fuzzer

    master

    syzkaller is an unsupervised coverage-guided kernel fuzzer. It is designed to find bugs in various operating system kernels by providing coverage-guided fuzzing capabilities.

    Supported Operating Systems:

    • FreeBSD
    • Fuchsia
    • gVisor
    • Linux
    • NetBSD
    • OpenBSD
    • Windows
  4. Understand the syzlang syscall description language

    master

    Syzkaller uses a pseudo-formal grammar called syzlang to describe system calls. A syscall description follows this general syntax:

    syscallname "(" [arg ["," arg]*] ")" [type] "(" attribute* ")"

    Where:

    • arg is defined as argname type.
    • type is a typename optionally followed by type-options in brackets [].
    • attribute refers to call attributes (like timeout or no_generate).

    Basic components include:

    • Arguments: Named identifiers followed by a type.
    • Types: Includes primitives like intN, ptr, string, array, and complex types like vma or proc.
    • Type Options: Specific modifiers for types, such as opt for optional parameters, or range constraints for integers.
    syscallname "(" [arg ["," arg]*] ")" [type] "(" attribute* ")"
    arg = argname type
    argname = identifier
    type = typename ["[" type-options "]"]
    typename = "const" | "intN" | "intptr" | "flags" | "array" | "ptr" |
    	   "string" | "strconst" | "filename" | "glob" | "len" |
    	   "bytesize" | "bytesizeN" | "bitsize" | "vma" | "proc" |
    	   "compressed_image"
    type-options = [type-opt ["," type-opt]]
  5. Understand the Syzkaller WiFi fuzzing approach

    master

    Syzkaller fuzzes the Linux 802.11 (WiFi) subsystem by targeting two main areas:

    1. Configuration and management functionality: Exposed via the nl80211 interface.
    2. Incoming wireless frame processing: Achieved by injecting 802.11 frames (currently under development).

    Syzkaller uses the mac80211_hwsim module to emulate WiFi devices. By default, when the wifi feature is enabled, the executor performs the following during initialization:

    • Creates two virtual WiFi devices with predefined MAC addresses (08:02:11:00:00:00 and 08:02:11:00:00:01).
    • Sets these devices to IBSS mode.
    • Forms an operable IBSS network with predefined parameters: BSSID (50:50:50:50:50:50), SSID (\x10\x10\x10\x10\x10\x10), and channel (2412 MHz).
  6. Understand the syzkaller process structure

    master

    Syzkaller operates using a distributed architecture consisting of a manager and multiple executors:

    • syz-manager: Runs on a stable host kernel. It is responsible for VM lifecycle management (starting/restarting/monitoring), the fuzzing engine (input generation, mutation, minimization), and managing the persistent corpus and crash storage.
    • syz-executor: Runs inside each target VM. It communicates with syz-manager via RPC to receive syscall programs and report results (errors, coverage). It executes programs by spawning transient C++ subprocesses that use shared memory for communication.
  7. Understand Linux kernel config generation with syz-kconf

    master

    Linux kernel configurations used by syzbot are auto-generated using the syz-kconf utility. The process uses a central declaration file main.yml and various configuration fragments located in the bits/ directory.

    Core Concepts

    • Instances: Defined in main.yml, these represent target configuration files. Each instance has a list of features (e.g., x86_64, gcc, upstream).
    • Fragments: Files in bits/ that contain configuration logic. A fragment is included in an instance if all its constraints are met and no negative constraints (prefixed with -) are present in the instance's features.
    • Includes: The includes section in main.yml defines the order and conditions for applying fragments to instances.

    Fragment Capabilities

    Fragments can specify:

    • Kernel Repository: The git URL and tag/revision to use.
    • Shell Commands: Kernel make commands (e.g., make x86_64_defconfig) to create base configs. Commands can have constraints (e.g., make defconfig: [-nodefconfig]).
    • Verbatim Text: Strings appended to the end of the resulting config.
    • Config Options: Specific kernel options to enable (CONFIG_FOO), disable (CONFIG_FOO: n), or set to specific values (CONFIG_FOO: 10 or CONFIG_FOO: "string").
  8. Explore research work based on syzkaller

    master

    The docs/research.md file maintains a curated list of academic papers, source code repositories, and tools that build upon or extend the syzkaller kernel fuzzer. This includes research on:

    • Syscall Generation & Description: Tools like SyzDescribe and SyzGen for automated syscall specification.
    • Exploit Generation: Research into automating the generation of Proof-of-Concept (PoC) exploits (e.g., SemFuzz, KOOBE).
    • Concurrency & Race Detection: Methods for finding kernel data races and concurrency bugs (e.g., RAZZER, Snowboard).
    • Specialized Fuzzing: Research targeting specific subsystems like macOS drivers, Android drivers, or RTOS (e.g., Rtkaller).
    • Efficiency & Optimization: Techniques for improving fuzzing speed and configuration selection (e.g., FastSyzkaller, MoonShine).

    For a comprehensive list, refer to the full bibliography in the repository's documentation.

  9. Understand Fuchsia system call definitions in syzkaller

    master
    Syzkaller uses .txt files to describe Fuchsia's Zircon kernel system calls using the syzlang language. These definitions are mapped to the .fidl files found in the Zircon vDSO directory. Currently, these definitions are updated manually. If you are contributing or working with Fuchsia syscalls, ensure that for every FIDL file, there is a corresponding .txt file in this directory that follows the syzlang syntax.
  10. Explore other kernel fuzzing work

    master

    Beyond syzkaller-specific research, the documentation provides links to broader kernel fuzzing frameworks and methodologies, such as:

    • File System Fuzzing: Frameworks like Hydra and Janus.
    • Hardware-Assisted Fuzzing: Tools bridging AFL with Intel PT (e.g., kAFL).
    • AFL/KCOV Integration: Projects like kernel-fuzzing and guides on bridging AFL with KCOV.
    • Android & Mobile: Coverage-guided fuzzing for Android drivers (e.g., CoLaFUZE).
  11. Understand the AI-Driven Reproducer Generation Workflow

    master

    The aflow framework provides an AI agent workflow (implemented in pkg/aflow/flow/repro/repro.go) designed to automatically convert kernel crash reports and execution logs into reliable syzkaller reproducers (.syz files).

    The Agent Loop follows these steps:

    1. Context Initialization: Ingests kernel crash logs, stack traces, target kernel info (.config, kernel repo, commit), and execution logs (using a Bug ID from the syzbot dashboard).
    2. Subsystem Analysis: Identifies the vulnerable subsystem (e.g., io_uring, bpf) from the stack trace.
    3. Syzlang Contextualization: Uses the read-description tool to look up relevant syscall signatures, structs, and flags from sys/linux/*.txt.
    4. Draft Generation: The LLM generates a candidate .syz program.
    5. Execution & Verification: The reproduce-crash tool compiles and runs the program in an instrumented VM. The agent verifies if the resulting crash is "very close" to the original (e.g., same function/root cause).
    6. Iterative Refinement: If compilation fails or the crash doesn't reproduce, the agent analyzes the error and retries until a limit is reached.
  12. Understand Covermerger coverage reporting logic

    master

    Covermerger reports coverage based on lines rather than pure basic blocks. A line is marked as 'covered' if at least one basic block attributed to that line was executed.

    Because a single line of code can contain multiple basic blocks, the coverage percentage shown on the dashboard represents the percentage of lines with coverage signals where at least one basic block was hit. Consequently, dashboard coverage values will always be greater than or equal to pure basic block coverage.