Skip to content

The configure script doesn't allow running ASan with PyMalloc #136872

@disconnect3d

Description

@disconnect3d

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions