Skip to content

The JIT's patch_aarch64_33rx relocation isn't safe #146128

Closed

Description

@brandtbucher

We can't just combine patch_aarch64_21r and patch_aarch64_12 into one relaxed relocation without a deeper understanding of the control flow, unfortunately. The issue is that the code can can jump into the middle of the two instructions involved in the relocation, and the combined relaxation changes the meaning of that.

This happens with _IS_NONE on debug 3.13 builds for AArch64 Linux, so it's a legitimate concern. We just dodged the bullet because _IS_NONE is never actually emitted (we turn it into a guard).

I think the best course of action is to remove the patch_aarch64_33rx from 3.13, 3.14, and main. Something like this probably belongs in the textual assembly optimization pass, since we actually reason about control flow there.

I'll open the PRs to remove the bug first. If somebody (perhaps from Arm @diegorusso @markshannon?) can prove this relaxation is valuable and wants to add it back on main in that earlier pass, then feel free to do so.

Linked PRs

Activity

  1. self-assigned this
    on Mar 18, 2026
  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    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
    on Mar 18, 2026
  3. added 5 commits that reference this issue on Apr 7, 2026
  4. removed
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Apr 7, 2026
  5. markshannon commented on Apr 7, 2026

    @markshannon
    Member

    For clarity, and before any more backports:
    This is a potential bug, and it can only become a bug with significant changes to bytecodes.c.

    It should be fixed for 3.15, as it makes development harder as benign changes might trigger it, which would be hard to diagnose and fix, and the proper fix should also give us a small performance improvement.

    I think the risk of a backport introducing much the same problem due to missing relocations means that we should leave 3.13 and 3.14 be.

  6. added a commit that references this issue on Apr 7, 2026
  7. added a commit that references this issue on Apr 16, 2026
  8. added 2 commits that reference this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.13only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-JITtype-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions