Teaching Containers and Allocators How to Sanitize Addresses
summary
Explains how AddressSanitizer’s runtime API lets containers and allocators mark unused bytes so ASAN catches out-of-bounds and use-after-free that plain allocation misses. Shows a hand-rolled vector that calls asan_poison_memory_region and asan_unpoison_memory_region, uses annotate_contiguous_container for nicer diagnostics, and adds checks via asan_region_is_poisoned in unit tests. Covers shadow-memory layout, 8-byte alignment rules, quarantine reuse, allocator gotchas, and performance costs (roughly 2× to 8× slowdown); the integration works when tested.
AI-written summary · about
chapters (6)
- 0:00Introduction to Asan
- 3:45How Address Sanitizer works
- 10:11Implementing custom containers
- 23:22Advanced container techniques
- 34:54Container annotation API
- 40:00Limitations and best practices
related talks
40mAddressSanitizer, or How to Make C/C++ Programs More Reliable and Secure
50mAddressSanitizer/ThreadSanitizer for Linux Kernel
06mLightning Talk: You Should Use AddressSanitizer
01h 29mAddressSanitizer on Windows
44mDebugging memory corruptions in C++
01h 00mSanitize for your Sanity: Sanitizers tools for Modern C++
41mDetect C++ Memory Leaks with ALSan: Attachable Leak Sanitizer
01h 02mSanitize your C++ code
