Fork/gperftools

Fork更新于 2026/07/24

gperftools GWP-ASan

在 gperftools tcmalloc 中集成 GWP-ASan guarded sampling,用低采样开销捕获生产环境堆错误。

这个 fork 把 gwp-asan 的 guarded allocation 能力接入 gperftools tcmalloc,使分配器可以按采样率将少量对象放入受保护页,并在 use-after-free 或 heap-buffer-overflow 触发时输出诊断信息。

接入范围

  • 在 tcmalloc 分配与释放路径中加入 guarded sampling 和 pointer ownership 判断。
  • 增加 guarded page allocator、SIGSEGV handler 与运行时静态状态。
  • 通过 malloc extension C/C++ 接口暴露必要的控制和状态能力。
  • 为 allocator、崩溃处理与 extension 接口增加测试。
  • 在 Linux 同步维护 Bazel、CMake 和 Autotools 构建定义。
  • 调整公开头文件,使未启用 guarded allocator 的 MSVC 构建仍能通过编译。

该分支用于验证 sampled heap protection 与现有 tcmalloc 的结合方式,不能视为完整 AddressSanitizer 的替代品。

相关阅读

Memo移除 ZooKeeperServer not running 日志Memo修正 ZFS 主机的 Node Exporter 内存告警Memo修复 Zig TSan 找不到 linux/scc.h