[#122258] [Ruby Misc#21367] Remove link to ruby-doc.org from www.ruby-lang.org/en/documentation/ — "p8 (Petrik de Heus) via ruby-core" <ruby-core@...>
Issue #21367 has been reported by p8 (Petrik de Heus).
11 messages
2025/05/23
[ruby-core:122183] [Ruby Bug#21257] YJIT can generate infinite loop when OOM
From:
"nagachika (Tomoyuki Chikanaga) via ruby-core" <ruby-core@...>
Date:
2025-05-18 07:25:48 UTC
List:
ruby-core #122183
Issue #21257 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 3.2: DONTNEED, 3.3: REQUIRED, 3.4: DONE to 3.2: DONTNEED, 3.3: DONE, 3.4: DONE
ruby_3_3 commit:f57dd4470b9ba1e2e0007e814f94e8bb4fd2ab6f merged revision(s) commit:80a1a1bb8ae8435b916ae4f66a483e91ad31356a.
----------------------------------------
Bug #21257: YJIT can generate infinite loop when OOM
https://bugs.ruby-lang.org/issues/21257#change-113330
* Author: rianmcguire (Rian McGuire)
* Status: Closed
* Assignee: jit
* Backport: 3.2: DONTNEED, 3.3: DONE, 3.4: DONE
----------------------------------------
We've found an edge case where YJIT can generate an infinite loop (jump to the same address) when it's out-of-memory.
Reproduction:
```ruby
def first
second
end
def second
::File
end
# Make `second` side exit on its first instruction
trace = TracePoint.new(:line) { }
trace.enable(target: method(:second))
32.times do |i|
puts i
first
if i == 29
# We've JITed the methods now - trigger the bug
# Trigger a constant cache miss in rb_vm_opt_getconstant_path (in `second`) next time it's called
module InvalidateConstantCache
File = nil
end
# nb. this only works in yjit dev mode
RubyVM::YJIT.simulate_oom!
end
end
```
This hangs indefinitely when run with YJIT (`./configure --enable-yjit=dev` is required for simulate_oom).
If we attach a debugger to the Ruby process at this point, it's stuck in an infinite loop:
```
$ lldb -p 9753
(lldb) process attach --pid 9753
Process 9753 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x0000000104b202b8
-> 0x104b202b8: b 0x104b202b8
0x104b202bc: nop
0x104b202c0: nop
0x104b202c4: nop
Target 0: (ruby) stopped.
Executable module set to "/Users/rian/opt/ruby/bin/ruby".
Architecture set to: arm64-apple-macosx-.
```
We've reproduced this on:
```
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux]
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin23]
ruby 3.5.0dev (2025-04-08T06:46:45Z master b68fe530f1) +PRISM [arm64-darwin23]
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- [email protected]
To unsubscribe send an email to [email protected]
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/