syzkaller Documentation
repository·master·Indexed 27 days ago
https://github.com/google/syzkallerAn 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.
What's inside syzkaller
- 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.
Overview of syz-cluster architecture
mastersyz-clusteris a distributed patch series fuzzing system built on top ofsyzkaller. 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):workflow/triageworkflow/buildworkflow/bootworkflow/fuzz
Note: Triage and build steps require kernel checkouts. The base kernel repository is hosted on a shared network disk and updated via
kernel-diskscripts.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.yamlis the primary configuration file used to determine mailing lists to poll, resource usage, and reporting settings.Overview of syzkaller kernel fuzzer
mastersyzkaller 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
Understand the syzlang syscall description language
masterSyzkaller uses a pseudo-formal grammar called
syzlangto describe system calls. A syscall description follows this general syntax:syscallname "(" [arg ["," arg]*] ")" [type] "(" attribute* ")"Where:
argis defined asargname type.typeis atypenameoptionally followed bytype-optionsin brackets[].attributerefers to call attributes (liketimeoutorno_generate).
Basic components include:
- Arguments: Named identifiers followed by a type.
- Types: Includes primitives like
intN,ptr,string,array, and complex types likevmaorproc. - Type Options: Specific modifiers for types, such as
optfor 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]]Understand the Syzkaller WiFi fuzzing approach
masterSyzkaller fuzzes the Linux 802.11 (WiFi) subsystem by targeting two main areas:
- Configuration and management functionality: Exposed via the
nl80211interface. - Incoming wireless frame processing: Achieved by injecting 802.11 frames (currently under development).
Syzkaller uses the
mac80211_hwsimmodule to emulate WiFi devices. By default, when thewififeature is enabled, the executor performs the following during initialization:- Creates two virtual WiFi devices with predefined MAC addresses (
08:02:11:00:00:00and08:02:11:00:00:01). - Sets these devices to
IBSSmode. - 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).
- Configuration and management functionality: Exposed via the
Understand the syzkaller process structure
masterSyzkaller 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 withsyz-managervia RPC to receive syscall programs and report results (errors, coverage). It executes programs by spawning transient C++ subprocesses that use shared memory for communication.
Understand Linux kernel config generation with syz-kconf
masterLinux kernel configurations used by syzbot are auto-generated using the
syz-kconfutility. The process uses a central declaration filemain.ymland various configuration fragments located in thebits/directory.Core Concepts
- Instances: Defined in
main.yml, these represent target configuration files. Each instance has a list offeatures(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
includessection inmain.ymldefines 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
makecommands (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: 10orCONFIG_FOO: "string").
- Instances: Defined in
Explore research work based on syzkaller
masterThe
docs/research.mdfile 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
SyzDescribeandSyzGenfor 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.
- Syscall Generation & Description: Tools like
Understand Fuchsia system call definitions in syzkaller
masterSyzkaller uses.txtfiles to describe Fuchsia's Zircon kernel system calls using thesyzlanglanguage. These definitions are mapped to the.fidlfiles 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.txtfile in this directory that follows the syzlang syntax.Explore other kernel fuzzing work
masterBeyond syzkaller-specific research, the documentation provides links to broader kernel fuzzing frameworks and methodologies, such as:
- File System Fuzzing: Frameworks like
HydraandJanus. - Hardware-Assisted Fuzzing: Tools bridging AFL with Intel PT (e.g.,
kAFL). - AFL/KCOV Integration: Projects like
kernel-fuzzingand guides on bridging AFL with KCOV. - Android & Mobile: Coverage-guided fuzzing for Android drivers (e.g.,
CoLaFUZE).
- File System Fuzzing: Frameworks like
Understand the AI-Driven Reproducer Generation Workflow
masterThe
aflowframework provides an AI agent workflow (implemented inpkg/aflow/flow/repro/repro.go) designed to automatically convert kernel crash reports and execution logs into reliable syzkaller reproducers (.syzfiles).The Agent Loop follows these steps:
- 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). - Subsystem Analysis: Identifies the vulnerable subsystem (e.g.,
io_uring,bpf) from the stack trace. - Syzlang Contextualization: Uses the
read-descriptiontool to look up relevant syscall signatures, structs, and flags fromsys/linux/*.txt. - Draft Generation: The LLM generates a candidate
.syzprogram. - Execution & Verification: The
reproduce-crashtool 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). - Iterative Refinement: If compilation fails or the crash doesn't reproduce, the agent analyzes the error and retries until a limit is reached.
- Context Initialization: Ingests kernel crash logs, stack traces, target kernel info (
Understand Covermerger coverage reporting logic
masterCovermerger 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.