python / python/cpython

The configure script doesn't allow running ASan with PyMalloc

Offen
#136,872 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

build type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Untersuchung des configure-Skripts um Zeile 13352 sowie der zugehörigen Behandlung von --with-address-sanitizer und --with-pymalloc. Baue CPython mit beiden Optionen, prüfe _testcapi.WITH_PYMALLOC und verifiziere das resultierende ASan-Verhalten unter Berücksichtigung der dokumentierten detect_leaks-Einstellung sowie des verlinkten devguide und der Speicherdokumentation.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, shell
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.