* [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV
@ 2024-05-22 12:11 akr (Akira Tanaka) via ruby-core
2024-05-22 12:19 ` [ruby-core:117969] " akr (Akira Tanaka) via ruby-core
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: akr (Akira Tanaka) via ruby-core @ 2024-05-22 12:11 UTC (permalink / raw)
To: ruby-core; +Cc: akr (Akira Tanaka)
Issue #20501 has been reported by akr (Akira Tanaka).
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501
* Author: akr (Akira Tanaka)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:117969] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
@ 2024-05-22 12:19 ` akr (Akira Tanaka) via ruby-core
2024-05-23 2:18 ` [ruby-core:117971] " nobu (Nobuyoshi Nakada) via ruby-core
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: akr (Akira Tanaka) via ruby-core @ 2024-05-22 12:19 UTC (permalink / raw)
To: ruby-core; +Cc: akr (Akira Tanaka)
Issue #20501 has been updated by akr (Akira Tanaka).
`t.rb` is not minimized because the probability of SEGV is reduced when I make the file smaller.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-108387
* Author: akr (Akira Tanaka)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:117971] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
2024-05-22 12:19 ` [ruby-core:117969] " akr (Akira Tanaka) via ruby-core
@ 2024-05-23 2:18 ` nobu (Nobuyoshi Nakada) via ruby-core
2024-05-24 0:04 ` [ruby-core:117991] " akr (Akira Tanaka) via ruby-core
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-05-23 2:18 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
Issue #20501 has been updated by nobu (Nobuyoshi Nakada).
Although I can't reproduce it, it looks like that `catch_iseq` is broken, from the backtrace.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-108388
* Author: akr (Akira Tanaka)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:117991] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
2024-05-22 12:19 ` [ruby-core:117969] " akr (Akira Tanaka) via ruby-core
2024-05-23 2:18 ` [ruby-core:117971] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-05-24 0:04 ` akr (Akira Tanaka) via ruby-core
2024-07-30 6:37 ` [ruby-core:118731] " mame (Yusuke Endoh) via ruby-core
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: akr (Akira Tanaka) via ruby-core @ 2024-05-24 0:04 UTC (permalink / raw)
To: ruby-core; +Cc: akr (Akira Tanaka)
Issue #20501 has been updated by akr (Akira Tanaka).
File crash2.txt added
git bisect shows the problem is caused by the following commit.
```
% git bisect bad
84e4453436c3549b4fda6014cdd5fcc9e0b80755 is the first bad commit
commit 84e4453436c3549b4fda6014cdd5fcc9e0b80755
Author: Aaron Patterson <tenderlove@ruby-lang.org>
Date: Tue Feb 7 17:46:42 2023 -0800
Use a functional red-black tree for indexing the shapes
This is an experimental commit that uses a functional red-black tree to
create an index of the ancestor shapes. It uses an Okasaki style
functional red black tree:
https://www.cs.tufts.edu/comp/150FP/archive/chris-okasaki/redblack99.pdf
This tree is advantageous because:
* It offers O(n log n) insertions and O(n log n) lookups.
* It shares memory with previous "versions" of the tree
When we insert a node in the tree, only the parts of the tree that need
to be rebalanced are newly allocated. Parts of the tree that don't need
to be rebalanced are not reallocated, so "new trees" are able to share
memory with old trees. This is in contrast to a sorted set where we
would have to duplicate the set, and also resort the set on each
insertion.
I've added a new stat to RubyVM.stat so we can understand how the red
black tree increases.
benchmark/vm_ivar_ic_miss.yml | 20 +++
rjit_c.rb | 5 +
shape.c | 309 ++++++++++++++++++++++++++++++++++++++++--
shape.h | 15 ++
vm.c | 8 +-
5 files changed, 342 insertions(+), 15 deletions(-)
create mode 100644 benchmark/vm_ivar_ic_miss.yml
```
```
% ./miniruby -v
ruby 3.3.0dev (2023-10-24T17:52:06Z v3_3_0_preview3~561 84e4453436) [x86_64-linux]
% ./miniruby t.rb
t.rb:32593: [BUG] Segmentation fault at 0x00007f596f3e1098
ruby 3.3.0dev (2023-10-24T17:52:06Z v3_3_0_preview3~561 84e4453436) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:21907 s:4294967313 e:000018 METHOD t.rb:32593
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:001b90 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in `<main>'
t.rb:32593:in `create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x0000559323b21d31 RBP: 0x00007ffd7d3f5730 RSP: 0x00007ffd7d3f55e0
RAX: 0x00007f596f3e1098 RBX: 0x00007f51542a27c0 RCX: 0x00007f516f4e0f30
RDX: 0x00007f51542a27c0 RDI: 0x00007f516f3e10a0 RSI: 0x0000000000000080
R8: 0x00000000000005f5 R9: 0x0000559325ad6220 R10: 0x06c15729dbba7803
R11: 0x0000000000000090 R12: 0x00007f516f3e1040 R13: 0x0000000000000000
R14: 0x000055932591c490 R15: 0x00007f516f4e0f30 EFL: 0x0000000000010206
-- C level backtrace information -------------------------------------------
/home/ruby/t4/ruby/miniruby(rb_print_backtrace+0x20) [0x559323b2be67] /home/ruby/t4/ruby/vm_dump.c:812
/home/ruby/t4/ruby/miniruby(rb_vm_bugreport+0x28c) [0x559323b2c57e] /home/ruby/t4/ruby/vm_dump.c:1143
./miniruby(rb_bug_for_fatal_signal+0x143) [0x559323906dd1]
/home/ruby/t4/ruby/miniruby(sigsegv+0x75) [0x559323a70ced] /home/ruby/t4/ruby/signal.c:920
/home/ruby/t4/ruby/miniruby(sigill) (null):0
/lib/x86_64-linux-gnu/libc.so.6(0x7f516f641050) [0x7f516f641050]
/home/ruby/t4/ruby/miniruby(vm_exec_handle_exception+0xb18) [0x559323b21d31] /home/ruby/t4/ruby/vm.c:2687
...
```
The full crash log is attached as crash2.txt.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-108414
* Author: akr (Akira Tanaka)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:118731] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (2 preceding siblings ...)
2024-05-24 0:04 ` [ruby-core:117991] " akr (Akira Tanaka) via ruby-core
@ 2024-07-30 6:37 ` mame (Yusuke Endoh) via ruby-core
2024-09-04 22:13 ` [ruby-core:119049] " luke-gru (Luke Gruber) via ruby-core
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mame (Yusuke Endoh) via ruby-core @ 2024-07-30 6:37 UTC (permalink / raw)
To: ruby-core; +Cc: mame (Yusuke Endoh)
Issue #20501 has been updated by mame (Yusuke Endoh).
Status changed from Open to Assigned
Assignee set to tenderlovemaking (Aaron Patterson)
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109270
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119049] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (3 preceding siblings ...)
2024-07-30 6:37 ` [ruby-core:118731] " mame (Yusuke Endoh) via ruby-core
@ 2024-09-04 22:13 ` luke-gru (Luke Gruber) via ruby-core
2024-09-05 17:31 ` [ruby-core:119069] " luke-gru (Luke Gruber) via ruby-core
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-04 22:13 UTC (permalink / raw)
To: ruby-core; +Cc: luke-gru (Luke Gruber)
Issue #20501 has been updated by luke-gru (Luke Gruber).
It looks like it has to do with `defined?()` in an `if` expression and its catch table entries when the first part of the if expression has been eliminated and there is no then label to follow.
For example, this is a minimal reproduction:
```ruby
def my_method
ivar = nil # seems to be needed to reproduce the issue
if false && defined? File::TMPFILE
end
raise "woops"
end
my_method
```
I only tried this on ruby head, but I get a segfault.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109627
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119069] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (4 preceding siblings ...)
2024-09-04 22:13 ` [ruby-core:119049] " luke-gru (Luke Gruber) via ruby-core
@ 2024-09-05 17:31 ` luke-gru (Luke Gruber) via ruby-core
2024-09-06 2:20 ` [ruby-core:119076] " nobu (Nobuyoshi Nakada) via ruby-core
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-05 17:31 UTC (permalink / raw)
To: ruby-core; +Cc: luke-gru (Luke Gruber)
Issue #20501 has been updated by luke-gru (Luke Gruber).
I created a patch here: https://github.com/ruby/ruby/pull/11554. I'm new to the code in compile.c so perhaps someone could come up with a better solution.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109652
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119076] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (5 preceding siblings ...)
2024-09-05 17:31 ` [ruby-core:119069] " luke-gru (Luke Gruber) via ruby-core
@ 2024-09-06 2:20 ` nobu (Nobuyoshi Nakada) via ruby-core
2024-09-06 15:15 ` [ruby-core:119085] " luke-gru (Luke Gruber) via ruby-core
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2024-09-06 2:20 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
Issue #20501 has been updated by nobu (Nobuyoshi Nakada).
luke-gru (Luke Gruber) wrote in #note-5:
> For example, this is a minimal reproduction:
I can't reproduce it with master.
```ruby
def my_method
ivar = nil # seems to be needed to reproduce the issue
if false && defined? File::TMPFILE
end
raise "woops"
end
my_method
```
```shell-session
$ ./bin/ruby -v bug-20501.rb
ruby 3.4.0dev (2024-09-06T00:32:47Z master 81b74c9fad) [aarch64-linux]
bug-20501.rb:2: warning: assigned but unused variable - ivar
bug-20501.rb:5:in 'Object#my_method': woops (RuntimeError)
from bug-20501.rb:7:in '<main>'
```
```shell-session
$ ./ruby -v bug-20501.rb
ruby 3.4.0dev (2024-09-06T00:32:47Z master 81b74c9fad) [arm64-darwin23]
bug-20501.rb:2: warning: assigned but unused variable - ivar
bug-20501.rb:5:in 'Object#my_method': woops (RuntimeError)
from bug-20501.rb:7:in '<main>'
```
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109660
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119085] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (6 preceding siblings ...)
2024-09-06 2:20 ` [ruby-core:119076] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2024-09-06 15:15 ` luke-gru (Luke Gruber) via ruby-core
2024-09-06 16:45 ` [ruby-core:119087] " mdalessio (Mike Dalessio) via ruby-core
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-06 15:15 UTC (permalink / raw)
To: ruby-core; +Cc: luke-gru (Luke Gruber)
Issue #20501 has been updated by luke-gru (Luke Gruber).
I'm on linux like @akr so that might have to do with it. I'll investigate a bit more.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109673
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119087] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (7 preceding siblings ...)
2024-09-06 15:15 ` [ruby-core:119085] " luke-gru (Luke Gruber) via ruby-core
@ 2024-09-06 16:45 ` mdalessio (Mike Dalessio) via ruby-core
2024-09-06 17:24 ` [ruby-core:119088] " luke-gru (Luke Gruber) via ruby-core
2024-09-06 18:52 ` [ruby-core:119089] " luke-gru (Luke Gruber) via ruby-core
10 siblings, 0 replies; 12+ messages in thread
From: mdalessio (Mike Dalessio) via ruby-core @ 2024-09-06 16:45 UTC (permalink / raw)
To: ruby-core; +Cc: mdalessio (Mike Dalessio)
Issue #20501 has been updated by mdalessio (Mike Dalessio).
I'm not able to reproduce on Linux with this script using either master HEAD or 5613d6e95b.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109675
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119088] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (8 preceding siblings ...)
2024-09-06 16:45 ` [ruby-core:119087] " mdalessio (Mike Dalessio) via ruby-core
@ 2024-09-06 17:24 ` luke-gru (Luke Gruber) via ruby-core
2024-09-06 18:52 ` [ruby-core:119089] " luke-gru (Luke Gruber) via ruby-core
10 siblings, 0 replies; 12+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-06 17:24 UTC (permalink / raw)
To: ruby-core; +Cc: luke-gru (Luke Gruber)
Issue #20501 has been updated by luke-gru (Luke Gruber).
This is a weird way to reproduce, but you can see it on https://runruby.dev/ if you comment out the Gemfile and put this in main.rb:
```ruby
def my_method
var = nil
if false && defined? File::TMPFILE
end
raise "woops"
end
puts RubyVM::InstructionSequence.disasm(method(:my_method)) # you should see the invalid catch table entry in the disasm bytecode
my_method() # if this doesn't trigger an error, try running it multiple times.
```
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109676
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
* [ruby-core:119089] [Ruby master Bug#20501] ruby SEGV
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
` (9 preceding siblings ...)
2024-09-06 17:24 ` [ruby-core:119088] " luke-gru (Luke Gruber) via ruby-core
@ 2024-09-06 18:52 ` luke-gru (Luke Gruber) via ruby-core
10 siblings, 0 replies; 12+ messages in thread
From: luke-gru (Luke Gruber) via ruby-core @ 2024-09-06 18:52 UTC (permalink / raw)
To: ruby-core; +Cc: luke-gru (Luke Gruber)
Issue #20501 has been updated by luke-gru (Luke Gruber).
Okay, I figured out what's happening. In compile.c, new LABELs are allocated from an arena, and this is using xmalloc, so it's not zeroed. Labels have a `position` field that is not set in the `new_label_body()` function, so it could be zeroed or not depending on many things of course. When compiling the `defined` after a known compile-time false value, its labels are NOT added to the anchor, and so its position is not set during `iseq_set_sequence` in `iseq_setup`, but it is saved to the iseq's `catch_table_ary`. Then, during `iseq_set_exception_table`, the `iseq_catch_table_entry`'s `start` and `end` are set to the LABEL's `position` because the LABEL is inside the iseq's `catch_table_ary`. There is no check for garbage values, which would be negative in this case, as `position` is an int. The `iseq_catch_table_entry` takes this possibly garbage value and saves it as its `start` and `end`.
I've updated my PR and added some assertions to the code to make sure this doesn't happen elsewhere.
----------------------------------------
Bug #20501: ruby SEGV
https://bugs.ruby-lang.org/issues/20501#change-109677
* Author: akr (Akira Tanaka)
* Status: Assigned
* Assignee: tenderlovemaking (Aaron Patterson)
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
I encountered SEGV of ruby.
```
% ./ruby -v
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
% ./ruby t.rb
t.rb:33: [BUG] Segmentation fault at 0x00007fc243696098
ruby 3.4.0dev (2024-05-22T06:59:19Z master 5613d6e95b) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0000 s:4294967313 e:000018 METHOD t.rb:33
c:0002 p:0022 s:0006 e:000005 EVAL t.rb:52 [FINISH]
c:0001 p:0000 s:0003 E:000350 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
t.rb:52:in '<main>'
t.rb:33:in 'create_no_file'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- Machine register context ------------------------------------------------
RIP: 0x000055a1cdc8bb9c RBP: 0x000055a1cee844b0 RSP: 0x00007ffcde5cdae0
RAX: 0x00007fc2436960a0 RBX: 0x00007fba43795f68 RCX: 0x0000000000000000
RDX: 0x000055a1cf115cf0 RDI: 0x0000000000000009 RSI: 0x00007fba28526860
R8: 0x00007fba436960a1 R9: 0x0000000000000000 R10: 0x00007fba28526860
R11: 0x0000000000000003 R12: 0x0000000000000006 R13: 0x00007fba2853b698
R14: 0x0000000d00000009 R15: 0x0000000000000b21 EFL: 0x0000000000010246
-- C level backtrace information -------------------------------------------
/home/ruby/t2/ruby/ruby(rb_print_backtrace+0x14) [0x55a1cdcae243] /home/ruby/t2/ruby/vm_dump.c:820
/home/ruby/t2/ruby/ruby(rb_vm_bugreport) /home/ruby/t2/ruby/vm_dump.c:1151
/home/ruby/t2/ruby/ruby(rb_bug_for_fatal_signal+0xf8) [0x55a1cde5abe8] /home/ruby/t2/ruby/error.c:1108
/home/ruby/t2/ruby/ruby(sigsegv+0x44) [0x55a1cdbf7864] /home/ruby/t2/ruby/signal.c:929
/lib/x86_64-linux-gnu/libc.so.6(0x7fba438f8050) [0x7fba438f8050]
/home/ruby/t2/ruby/ruby(vm_exec_handle_exception+0x2ac) [0x55a1cdc8bb9c] /home/ruby/t2/ruby/vm.c:2782
...
```
`t.rb` and the full crash report are attached.
---Files--------------------------------
t.rb (1.27 KB)
crash.txt (15.8 KB)
crash2.txt (11.2 KB)
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-09-06 18:53 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-22 12:11 [ruby-core:117968] [Ruby master Bug#20501] ruby SEGV akr (Akira Tanaka) via ruby-core
2024-05-22 12:19 ` [ruby-core:117969] " akr (Akira Tanaka) via ruby-core
2024-05-23 2:18 ` [ruby-core:117971] " nobu (Nobuyoshi Nakada) via ruby-core
2024-05-24 0:04 ` [ruby-core:117991] " akr (Akira Tanaka) via ruby-core
2024-07-30 6:37 ` [ruby-core:118731] " mame (Yusuke Endoh) via ruby-core
2024-09-04 22:13 ` [ruby-core:119049] " luke-gru (Luke Gruber) via ruby-core
2024-09-05 17:31 ` [ruby-core:119069] " luke-gru (Luke Gruber) via ruby-core
2024-09-06 2:20 ` [ruby-core:119076] " nobu (Nobuyoshi Nakada) via ruby-core
2024-09-06 15:15 ` [ruby-core:119085] " luke-gru (Luke Gruber) via ruby-core
2024-09-06 16:45 ` [ruby-core:119087] " mdalessio (Mike Dalessio) via ruby-core
2024-09-06 17:24 ` [ruby-core:119088] " luke-gru (Luke Gruber) via ruby-core
2024-09-06 18:52 ` [ruby-core:119089] " luke-gru (Luke Gruber) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).