python / python/cpython

The configure script doesn't allow running ASan with PyMalloc

未关闭
#136,872 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

build type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Bug report

Bug description:

The --with-address-sanitizer configure option overrides whatever pymalloc option one provides which it should not.

We should either allow it to work with --with-pymalloc, or, delete the line that disables pymalloc. I discussed it a bit during EP2025 sprint with @encukou .

This is done due to the line here:
https://github.com/python/cpython/blame/4a151cae3317ce133bdf0792fb1064c5030e588c/configure#L13352

I believe that CPython works fine with ASan + PyMalloc. I have tested it by removing the line above. Then the import _testcapi; _testcapi.WITH_PYMALLOC is True and there doesn't seem to be ASan crashes. However, there are leaks being detected, even when building Python, so I did all this with export ASAN_OPTIONS=detect_leaks=0.

It is also worth noting that we:

  1. List the --without-pymalloc flag in the devguide when showing how to run ASan.
  2. We mention there, that the flag is not necessary, but it makes ASan more effective.
  3. We mention in CPython docs that it makes sense to disable PyMalloc when running ASan here
CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查第 13352 行附近的 configure 脚本,以及对 --with-address-sanitizer 和 --with-pymalloc 的相关处理。使用这两个选项构建 CPython,检查 _testcapi.WITH_PYMALLOC,并在考虑文档中说明的 detect_leaks 设置以及链接的 devguide 和内存文档的情况下,验证生成的 ASan 行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, shell
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。