Skip to content

JIT: REX.W prefix jmp [abs32] form used for tailcalls - #136845

Merged
jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-129071
Nov 4, 2026
Merged

jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-129071

Conversation

@jakobbotsch

@jakobbotsch jakobbotsch commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Like other instructions emitted in the epilog this one must be rex.w prefixed for the unwinder to recognize it as being part of an epilog.

Fix #129071

I did have Copilot validate based on the instructions in #129071 (comment), and it did see corruptions with the baseline JIT but not with the fixed JIT. No test added since it is very difficult to force the JIT to emit this form of epilog jump.

Like other instructions emitted in the epilog this one must be rex.w
prefixed for the unwinder to recognize it as being part of an epilog.

Also avoid using APX registers for the target register; encoding those
will require prefixes that also are not recognized by the unwinder.

Fix dotnet#129071
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 2, 2026
@azure-pipelines

azure-pipelines Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@jkotas

jkotas commented Nov 2, 2026

Copy link
Copy Markdown
Member

APX registers

APX will require UnwindInfo v3. UnwindInfo v3 does not disassemble the epilogs, and thus it does not have restrictions around instructions encodings.

@jakobbotsch

Copy link
Copy Markdown
Member Author

APX registers

APX will require UnwindInfo v3. UnwindInfo v3 does not disassemble the epilogs, and thus it does not have restrictions around instructions encodings.

Good point! Undid that.

@jakobbotsch

Copy link
Copy Markdown
Member Author

cc @dotnet/jit-contrib PTAL @adamperlin

No diffs

@JulieLeeMSFT JulieLeeMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Both the size-computation path (emitxarch.cpp:11229-11234) and the encoding path (emitxarch.cpp:18511-18516) are consistent with how the existing addressing mode form already handles this at emitxarch.cpp:11171-11176 -- the reserved size and emitted bytes stay in sync.
The fix is scoped tightly to INS_tail_i_jmp only.

@jakobbotsch
jakobbotsch merged commit 4c50c3e into dotnet:main Nov 4, 2026
130 checks passed
@jakobbotsch
jakobbotsch deleted the fix-129071 branch November 4, 2026 07:37
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExecutionEngineException fail-fast in GC thread-suspension / return-address hijack (invalid tailcall epilog)

3 participants