Skip to content

Cpython build failure: _bootstrap_python segfault #127545

Closed

Description

@fthain

Bug report

Bug description:

When building dev-lang/python-3.13.0 on Gentoo/m68k, the following crash is observed.

./_bootstrap_python ./Programs/_freeze_module.py abc ./Lib/abc.py Python/frozen_modules/abc.h
gc: collecting generation 0...
make: *** [Makefile:1697: Python/frozen_modules/abc.h] Segmentation fault

A patch is available to resolve this issue. A pull request will follow shortly.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Dec 3, 2024
  2. fthain commented on Jun 1, 2025

    @fthain
    ContributorAuthor

    Debian has a bug report for this issue.
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1105110

  3. added
    buildThe build process and cross-build
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    and removed
    buildThe build process and cross-build
    on Jun 1, 2025
  4. added
    buildThe build process and cross-build
    type-crashA hard crash of the interpreter, possibly with a core dump
    3.13only security fixes
    3.14bugs and security fixes
    3.15bugs and security fixes
    and removed
    type-bugAn unexpected behavior, bug, or error
    on Jun 2, 2025
  5. AA-Turner commented on Jun 2, 2025

    @AA-Turner
    Member

    Note m86k is not a supported platform per PEP 11.

  6. ZeroIntensity commented on Jun 3, 2025

    @ZeroIntensity
    Member

    Reading the Debian reports, it seems like the plan is for m86k to switch to 4-byte alignment anyway. Do we need to fix this?

  7. fthain commented on Jun 4, 2025

    @fthain
    ContributorAuthor

    Reading the Debian reports, it seems like the plan is for m86k to switch to 4-byte alignment anyway. Do we need to fix this?

    @ZeroIntensity, there is no alternative ABI for Linux/m68k. That's why Debian picked up this patch.

    No kernel and toolchain patches have been posted that would constitute a new ABI and no effort has been made to design a new ABI to meet the needs of everyone in the Linux/m68k community for the foreseeable future.

    Distro maintainers are primarily concerned with their own software and its users, which is understandable.

    Regardless, I think the patch stands on its merits because, IMO, the patch improves the python source code by improving correctness, readability, portability and reusability.

  8. 6 remaining items

  9. zooba commented on Jun 4, 2025

    @zooba
    Member

    Python already requires C11 in its headers

    It shouldn't, the headers are compatible with C++. _Py_ALIGN_AS is designed to be okay anywhere it's needed, but we'll find out very quickly indeed if it isn't sufficient once it appears in PyObject.

    @encukou Thoughts here?

  10. encukou commented on Jun 4, 2025

    @encukou
    Member

    Thoughts here?

    If we want to introduce _Py_ALIGN_AS in the regular builds, this looks like the perfect issue to do it.

    It is exactly the use case for _Py_ALIGN_AS.

    If there are any issues with PyObject, we'll know quickly. If it turns out that we do need to revert, we “only” lose compatibility with an unsupported platform -- we'd be back to the drawing board on this issue.

    I'd hold the 3.13 backport though; and maybe even 3.14 just to be safe.
    People building for m68k can backport the patch downstream; in GCC-only land there shouldn't be much to worry about.

    I think we should definitely get sign-off from the C API WG before requiring _Py_ALIGN_AS to build the core

    The sign-off is done. Judging by the vote, the WG prefers _Py_ALIGN_AS being in both builds. It just wasn't needed, and thus tested, in the regular one yet.

    We also don't test this [...] this is an unsupported platform.

    Read “unsupported” more as “not in our CI” and less as “we won't spend time on this”.

    We wouldn't magically add support for m68k with the patch; it's still on Gentoo/m68k & other maintainers to build, test, and report issues/PRs that we might merge.
    The important thing for us is that supported platforms don't break.


    Thank you for supporting Python on platforms we can't test here!

  11. removed
    pendingThe issue will be closed if no feedback is provided
    on Jun 4, 2025
  12. added a commit that references this issue on Jun 11, 2025
  13. encukou commented on Jun 11, 2025

    @encukou
    Member

    Now merged in main.
    Generally, we don't backport fixes for unsupported architectures -- that would implicitly promise some support, and we can't test on m64k. Please patch locally for Debian & Gentoo. Does that sound fair?
    Python 3.14 & below shouldn't change much any more, but if things break, we can help.

    For GCC (and presumably clang), I'd recommend going with @fthain's simpler patch (using Py_ALIGNED(1 << _PyObject_ALIGNMENT_SHIFT)).

  14. fthain commented on Jun 12, 2025

    @fthain
    ContributorAuthor

    Now merged in main. Generally, we don't backport fixes for unsupported architectures -- that would implicitly promise some support, and we can't test on m64k. Please patch locally for Debian & Gentoo. Does that sound fair? Python 3.14 & below shouldn't change much any more, but if things break, we can help.

    For GCC (and presumably clang), I'd recommend going with @fthain's simpler patch (using Py_ALIGNED(1 << _PyObject_ALIGNMENT_SHIFT)).

    Thanks for your help in fixing this, @encukou.
    For Debian, Gentoo, buildroot et al. I have now backported this fix on the gc_crash-3.13 branch. The gc_crash branch is suitable for python 3.14.

  15. thesamesam commented on Jun 12, 2025

    @thesamesam
    Contributor

    Thanks all. @fthain can you file a bug on the Gentoo side for backporting please?

  16. added a commit that references this issue on Jun 19, 2025
  17. added a commit that references this issue on Jul 12, 2025
  18. added a commit that references this issue on Aug 4, 2025
  19. added a commit that references this issue on Aug 19, 2025
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

    3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesOS-linuxOS-unsupportedbuildThe build process and cross-buildinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions