Generated by GPT-5-mini| MemorySanitizer | |
|---|---|
| Name | MemorySanitizer |
| Developer | |
| Released | 2013 |
| Language | C, C++ |
| Platform | Linux, FreeBSD |
| License | BSD license |
MemorySanitizer
MemorySanitizer is a dynamic analysis tool developed at Google to detect uninitialized memory reads in C and C++ programs. It operates as an instrumentation-based sanitizer that integrates with Clang and the LLVM toolchain to provide runtime diagnostics during testing and debugging. The project influenced sanitizer technology alongside tools created at Microsoft Research, LLVM Developers and in academic projects from Massachusetts Institute of Technology, Stanford University, and University of California, Berkeley.
MemorySanitizer is designed to find uses of uninitialized values in native code produced by Clang/LLVM toolchains maintained at Google and the LLVM Foundation. It annotates program memory with shadow metadata to indicate initialization state, reporting errors that arise in code paths exercised by test harnesses such as those used by Chromium and Android Open Source Project. The sanitizer complements runtime tools from AddressSanitizer, ThreadSanitizer, and sanitizers developed by teams at Facebook, Microsoft, and Apple by focusing on a class of bugs that can lead to undefined behavior and security vulnerabilities exploited in incidents analyzed by Project Zero and incident response teams at CERT/CC.
MemorySanitizer implements a shadow memory scheme inspired by prior research from Stanford University and the University of Maryland that tracks per-byte initialization metadata. Instrumentation is performed at the compiler IR level within LLVM passes maintained by Clang developers, inserting checks and metadata propagation for calls, loads, stores, and arithmetic. The design leverages concepts from static and dynamic analysis research at Carnegie Mellon University and from tools discussed at conferences such as USENIX Security Symposium, ACM SIGPLAN Conference on Programming Language Design and Implementation, and IEEE Symposium on Security and Privacy. The implementation interacts with linker behavior influenced by work at GNU Project and relies on runtime libraries and symbolization support used in projects hosted by GitHub and Chromium.
Developers integrate MemorySanitizer via compiler flags in build systems like Bazel, CMake, and GNU Make used by large projects at Google and contributors at Mozilla Foundation. Typical workflows combine MemorySanitizer with test frameworks from Google Test, continuous integration systems such as Kubernetes-backed runners, and fuzzing tools like those developed by OSS-Fuzz and researchers at University of Michigan. Integration requires linking with MSan runtime libraries and often pairing with symbolizers and crash reporters used by Crashpad, Breakpad, and monitoring stacks used at Facebook and Twitter.
MemorySanitizer imposes overheads similar to other dynamic instrumentation tools evaluated in benchmarks at SPEC and in academic evaluations from Princeton University and ETH Zurich. Instrumentation increases binary size and runtime memory due to shadow memory mappings, and execution slowdown varies across workloads studied by researchers at University of Cambridge and Imperial College London. The tool cannot detect initialized-ness for memory originating from kernel-level operations without special support and has platform limitations; primary supported platforms historically include Linux and FreeBSD with constraints noted by contributors from Google and LLVM. It also has incomplete support for certain language features and runtime environments analyzed in papers from University of Illinois at Urbana–Champaign and Yale University.
MemorySanitizer is often compared with AddressSanitizer and ThreadSanitizer from the LLVM project; AddressSanitizer targets spatial and temporal memory-safety bugs while ThreadSanitizer targets data races. Alternative uninitialized-value detectors include static analyzers developed by Coverity, dynamic tools from Valgrind (notably Memcheck), and research prototypes from Princeton University and University of Texas at Austin. Each approach trades off precision, coverage, and performance: tools like Valgrind provide broad emulation but high overhead, whereas compiler-integrated sanitizers from Clang offer lower overhead and better integration with modern build systems used by Google, Mozilla, and Microsoft.
MemorySanitizer has been adopted in testing workflows at Google projects including Chromium and Android, and by open-source projects hosted on GitHub and contributed to by organizations such as Mozilla Foundation and Intel Corporation. It has been referenced in security analyses by teams like Project Zero and used in university research at University of California, San Diego and Columbia University. Contributions and discussions around MemorySanitizer appear in repositories and issue trackers maintained by LLVM Developers, and it figures in talks at events like CppCon and Linux Plumbers Conference.
Category:Software testing tools