Skip to content

Consider using ASAN-instrumented CPython build in CI #237

Description

@ngoldbaum

There is an asan test environment in the tox setup, but it looks like it's set up to use a "regular" build of CPython instead of one that has ASAN instrumentation. If you build CPython itself with address sanitizer, there is no need to use LD_PRELOAD or set PYTHONMALLOC, as long as the extension is built using the same ASAN runtime as CPython was.

An easy way to set that up in CI is to use the cpython_sanity docker images @nascheme as been working on:

https://github.com/nascheme/cpython_sanity

Here's an example of how NumPy uses the TSAN docker image in CI:

https://github.com/numpy/numpy/blob/d02611ad99488637b48f4be203f297ea7b29c95d/.github/workflows/compiler_sanitizers.yml#L74-L100

The CI image includes the compilers used to build CPython so it's usually straightforward to build extensions using the same compiler setup.

I still need to update NumPy's ASAN job to use the docker image instead of building python from-source in the CI job, but it should look more-or-less the same as the TSAN job.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions