How google/sanitizers works
Main Components
• Core Sanitizer Documentation & Helper Code: Represented by the README and linked wiki/issue resources. This is the “heart” that explains what each sanitizer does.
• Android Application: Under the “android” folder you have a complete Android app project. This includes both native (C/C++ via CMakeLists.txt and native-lib.cpp) and Kotlin code (MainActivity.kt) and prebuilt APKs. It acts as a client/demo for at least one sanitizer (or multiple combinations) in action.
• Buildbot System: The “buildbot” directory contains scripts (install_deps.sh, start_script.sh) that likely serve continuous integration or build automation tasks. This component is responsible for setting up dependencies and scripting builds/tests.
• Dashboard Service: Found in the “dashboard” directory, this Go-based component (dashboard.go, go.mod, go.sum) is probably used for visualizing build, test, or sanitizer results.
• Research and Experimentation: Two distinct educational/research modules exist:
○ GWP-ASAN: Provides research artifacts such as papers, Makefiles, LaTeX source (for icse2024 papers) and presentation slides. This component demonstrates academic/research work around gating or sampling in AddressSanitizer.
○ HWAddress-Sanitizer and MemorySanitizer: These include experimental or demonstration code (scripts like create_qemu_image.sh, check_registers, sample source code in C/C++ and Python) and supplemental documentation (PDFs, markdown guides). The “mte-dynamic-carveout” directory also indicates a specialized case study for memory tagging extensions.
Relationships and Interactions
• Central Documentation & Helper Code (README and wiki-linked docs) provide context for all the components.
• The Android app both uses and demonstrates sanitization techniques (leveraging aspects of the sanitizers) and might serve as a testbed for applying sanitizers in mobile environments.
• The Buildbot scripts serve as an orchestrator, automating builds/tests that might involve compiling the Android app and running other builds/sanitizer checks.
• Dashboard connects with build/test systems, offering a visual presentation of sanitizer results, metrics, or diagnostics.
• Research components (GWP-ASAN, HWASAN, MemorySanitizer, mte-dynamic-carveout) are more loosely coupled but are essential for understanding implementation nuances and experimental validation. They may feed back insights into future sanitizer improvements.
Architectural Patterns & Design Principles
• Modular Organization: Each directory represents an individual module or micro-project with a well-defined purpose, from demo apps to build automation, and research documents.
• Separation of Concerns: The project obviously segregates components by their role: client demos (android), automation (buildbot), monitoring (dashboard), and research (gwp-asan, hwaddress-sanitizer).
Technologies & Frameworks
• Android Development (Java/Kotlin, Gradle, CMake for native code).
• Go for the Dashboard component.
• Shell scripting for build automation.
• LaTeX/Makefiles for academic papers in the GWP-ASAN component.
• C/C++ example code and Python scripts in experimental modules.
• Integration references to LLVM and its sanitizers.