Bug #19464
closedYJIT miscompiles `BasicObject#__send__` to alias methods of `send`
Description
Symptoms first experienced and reported by users of the kt-paperclip
gem.
Reproducer:
klass = Class.new do
class << self
alias_method :my_send, :send
def bar = :ok
def foo = bar
end
end
with_break = -> { break klass.send(:my_send, :foo) }
wo_break = -> { klass.send(:my_send, :foo) }
31.times { with_break[]; wo_break[] }
Updated by alanwu (Alan Wu) almost 2 years ago
- Status changed from Open to Closed
Applied in changeset git|0eb634ae73cb327ede833b72492f912792a4a9d5.
YJIT: Detect and reject send(:alias_for_send, :foo)
Previously, YJIT failed to put the stack into the correct shape when
BasicObject#send
calls an alias method for the send method itself.
This can manifest as strange NoMethodError
s in the final non-send
receiver, as seen with the kt-paperclip gem. I also found a case
where it makes YJIT fail the stack size assertion while compiling
leave
.
YJIT's BasicObject#__send__
implementation already rejects sends to
send
, but didn't detect sends to aliases of send
. Adjust the
detection and reject these cases.
Fixes [Bug #19464]
Updated by alanwu (Alan Wu) almost 2 years ago
- Subject changed from YJIT miscompiles `BasicObject#send` to alias methods of `send` to YJIT miscompiles `BasicObject#__send__` to alias methods of `send`
Updated by naruse (Yui NARUSE) almost 2 years ago
- Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE
ruby_3_2 b73a07359758a9034996752e981e09ddaffe8d87 merged revision(s) 0eb634ae73cb327ede833b72492f912792a4a9d5.