Skip to content

Comments

[pull] master from ruby:master#795

Merged
pull[bot] merged 2 commits intoturkdevops:masterfrom
ruby:master
Feb 20, 2026
Merged

[pull] master from ruby:master#795
pull[bot] merged 2 commits intoturkdevops:masterfrom
ruby:master

Conversation

@pull
Copy link

@pull pull bot commented Feb 20, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

XrXr and others added 2 commits February 20, 2026 11:04
It was passing options to the test harness rather than ruby(1).
Multiple YJIT functions created overlapping `&'static mut IseqPayload`
references by calling `get_iseq_payload()` multiple times for the same
iseq. Overlapping &mut is UB in rust's aliasing model, and as consequence,
we trigered use-after-free on the `version_map` Vec header due to false
claims of LLVM `noalias`.

This manifested as crashes in various YJIT operations (block lookup,
GC marking, block removal) that dereference the stale pointer.

Fix by moving `delayed_deallocation` and `get_or_create_version_list`
from free functions (which each call `get_iseq_payload()` internally)
to methods on `IseqPayload` that operate through `&mut self`. This
lets callers obtain a single payload reference and use it for all
operations without creating overlapping mutable borrows.

The three fixed call sites:

1. `rb_yjit_tracing_invalidate_all` (invariants.rs): The loop called
   `delayed_deallocation()` which internally called `get_iseq_payload()`,
   creating a second `&mut` overlapping with the outer `payload` reference.
   Fix: call `payload.delayed_deallocation()` method instead.

2. `add_block_version` (core.rs): Called `get_or_create_version_list()`
   then later `get_iseq_payload()` for pages, creating two references.
   Fix: use a single `get_or_create_iseq_payload()` call then call the
   `get_or_create_version_list()` method on it for both version_map and
   pages access.

Also adds regression tests exercising tracing invalidation with
on-stack methods and suspended fibers.

[alan: edited commit message]
Reviewed-by: Alan Wu <alanwu@ruby-lang.org>
@pull pull bot locked and limited conversation to collaborators Feb 20, 2026
@pull pull bot added the ⤵️ pull label Feb 20, 2026
@pull pull bot merged commit e730ac4 into turkdevops:master Feb 20, 2026
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants