How google/syzkaller works
Project’s Main Components
• Core Fuzzer Engine:
– The program generation layer (found in the “prog” directory) builds the test programs.
– The “pkg/fuzzer” package includes the logic that interprets coverage feedback and schedules tests.
• Executor and Runtime Environment:
– The “executor” folder contains the executor code that runs the generated tests on the target kernel.
– The “vm” directory shows virtualization and isolated execution components (for QEMU, GCE, etc.).
• API & Communication Layers:
– The “dashboard” package (with “dashboard/api” and “dashboard/app”) and related syz-hub, syz-manager, and syz-cluster modules provide interfaces for job management, reporting, and user interactions.
– “pkg/rpcserver” and “pkg/rpctype” reveal the RPC mechanisms that allow different services to communicate.
• Data Storage & Coverage Databases:
– Modules such as “pkg/coveragedb”, “pkg/cover”, “pkg/covermerger”, and “pkg/db” handle storage, merging of coverage data, and repository management.
• Auxiliary & Supporting Tools:
– The “tools” directory contains various utilities for building, debugging, formatting, triaging, and analyzing outputs.
– There are CI/CD configurations (in .github/workflows) and syz-ci components that support continuous integration.
– The “sys” tree provides system call descriptions and OS-specific definitions for different targets.
Relationships and Interactions
• How the Engine communicates with the Executor: the Executor receives generated test cases and returns execution results (coverage data, crashes, etc.) back to the Engine.
• A flow where the Executor is hosted within a virtual machine or container (as shown in the “vm” directories), making use of platform-specific code.
• That the API and dashboard components (“dashboard”, “syz-hub”, “syz-manager”, “syz-cluster”) interact with the core engine: they display job statuses, statistics and reporting information that is collected from the fuzzer and executor.
• Auxiliary tools to the main system as having roles in artifact creation (e.g., syz-build, syz-testbed) and quality checks (like syz-fmt and syz-linter).
Architectural Patterns and Design Principles
• Microservice-style Components: In the syz-cluster module, for example, you see separate services (dashboard, controller, DB management, reporter, workflow) that communicate via APIs and configurations. Indicate these as individual sub-components with clearly defined interfaces.
• Multi-OS and Multi-Platform Support: Include a note that the “sys” and “pkg” directories provide OS-specific modules (Linux, FreeBSD, Windows, etc.), suggesting a plug-in style architecture for kernel-specific adaptations.
Relevant Technologies, Frameworks, and Libraries
• Go is the primary language for most components, as seen from the .go files.
• The system uses RPC (over HTTP or custom protocols) for communication between components.
• Virtualization modules and container orchestration are seen in directories like “vm”, “syz-cluster”, and CI configurations.
• External tools (such as Docker, Kubernetes manifests from the syz-cluster overlays and workflows) are integral to how syzkaller is deployed and scaled.