summaryrefslogtreecommitdiff
path: root/test/ruby/test_lambda.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2023-09-11 14:11:46 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2023-09-15 09:01:02 -0700
commita1dc1a3de9683daf5a543d6f618e17aabfcb8708 (patch)
tree4929f01ae37c5d1fd81ae11d5ddcde8a9300bcbc /test/ruby/test_lambda.rb
parentefe2822708d62bfe3ba858da526e6ef7d4724959 (diff)
Return line 0 for JIT frames
Frames pushed by YJIT have an unreliable PC. The PC could be garbage, and if we try to read the line number with a garbage PC, then the program can crash. This commit returns line 0 for programs where there is a `jit_return` function. If `jit_return` has been set then this frame was pushed by the JIT, and we cannot trust the PC. Here is a debugger session for a program that crashed due to a broken PC: ``` (lldb) p ruby_current_vm_ptr->ractor.main_thread->ec->cfp->iseq->body->iseq_encoded (VALUE *) $0 = 0x0000000118a30e00 (lldb) p/x ruby_current_vm_ptr->ractor.main_thread->ec->cfp->pc (const VALUE *) $1 = 0x0000600000b02d00 (lldb) p/x ruby_current_vm_ptr->ractor.main_thread->ec->cfp->jit_return (void *) $2 = 0x000000010622942c ``` You can see the PC is completely out of range, but there is a `jit_return` pointer so we can avoid this crash.
Diffstat (limited to 'test/ruby/test_lambda.rb')
0 files changed, 0 insertions, 0 deletions