Detect C++ Memory Leaks with ALSan: Attachable Leak Sanitizer
summary
An attachable leak sanitizer built on eBPF uprobe and BCC hooks malloc/free in running Linux processes, saving allocation metadata in kernel space so processes do not need restarting. It runs periodic LSan-style reachability scans (can report every ~10s), reproduces original LSan traces when attached before the allocations, and finds real bugs in upstream projects like json. Limitations: needs root, requires kernel configs (works since ~Linux 5.4), cannot trace inlined/non-traceable functions, may miss register roots unless the process is suspended.
AI-written summary · about
chapters (9)
- 0:00C++ memory leaks
- 2:02Limitations of existing tools
- 5:51The attachable solution
- 12:41How attachable LSAN works
- 15:23Demo and Q&A
- 19:45Detection algorithms
- 29:06Testing with long cases
- 33:20Real world applications
- 37:03Build guide and conclusion
related talks
01mC++ On Sea 2024 Preview - Aleksei Veselovskii - LSAN and ASAN: tips, tricks and hacks
01h 02mSanitize your C++ code
59mSanitizing the Linux Kernel — On KASAN and other Dynamic Bug-finding Tools
01h 00mSanitize for your Sanity: Sanitizers tools for Modern C++
50mAddressSanitizer/ThreadSanitizer for Linux Kernel
49mTeaching Containers and Allocators How to Sanitize Addresses
59mBeyond Sanitizers...
40mAddressSanitizer, or How to Make C/C++ Programs More Reliable and Secure
