python / python/cpython

The configure script doesn't allow running ASan with PyMalloc

オープン
#136,872 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、13352行目付近の configure スクリプトと、関連する --with-address-sanitizer および --with-pymalloc の処理を調べます。両方のオプションを指定して CPython をビルドし、_testcapi.WITH_PYMALLOC を確認したうえで、リンクされている devguide とメモリドキュメント、および文書化された detect_leaks 設定を考慮しながら、結果として得られる ASan の動作を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, shell
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。