Skip to content

Should ASAN build use -shared-libsan? #155375

Open

Description

@lucascolley

@isuruf do I understand you correctly at scipy/scipy#24066 (comment) that you are suggesting the following diff for CPython?

diff --git a/configure.ac b/configure.ac
index 3a9841b1e7d..7b44be75623 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3520,7 +3520,7 @@ AC_ARG_WITH([address_sanitizer],
 [
 AC_MSG_RESULT([$withval])
 BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
-LDFLAGS="-fsanitize=address $LDFLAGS"
+LDFLAGS="-fsanitize=address -shared-libsan $LDFLAGS"
 # ASan works by controlling memory allocation, our own malloc interferes.
 with_pymalloc="no"
 ],

Also, is this only necessary on linux?

Linked PRs

Activity

  1. added
    type-feature
    build
    on Aug 8, 2026
  2. StanFromIreland commented on Aug 8, 2026

    @StanFromIreland
    Member

    This would break compiling with GCC, as it doesn’t support such a link option (see the documentation). And is this purely for downstream ASan testing of third-party extension modules?

  3. lucascolley commented on Aug 8, 2026

    @lucascolley
    ContributorAuthor

    This would break compiling with GCC, as it doesn’t support such a link option (see the documentation).

    Can we add it conditionally if the compiler is clang?

    And is this purely for downstream ASan testing of third-party extension modules?

    That is the current use-case I am working on.

  4. picnixz commented on Aug 9, 2026

    @picnixz
    Member

    For 3rd party ext they should build their own Python interpreter with the appropriate flags I guess? I do not know why Python should be responsible for this additonal flag. Otherwise what about UBSan/TSan?

  5. lucascolley commented on Aug 9, 2026

    @lucascolley
    ContributorAuthor
  6. picnixz commented on Aug 9, 2026

    @picnixz
    Member

    I think putting them in pixi is a relevant place (at least, AFAIU the purpose of Pixi).

  7. added 4 commits that reference this issue on Aug 29, 2026
  8. added 6 commits that reference this issue on Sep 13, 2026
  9. added 2 commits that reference this issue on Sep 24, 2026
  10. added 4 commits that reference this issue on Dec 3, 2026
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

    buildtype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions