[ruby-core:111693] [Ruby master Bug#19316] YJIT crash in 3.2.0

Issue #19316 has been reported by jdashton (J Daniel Ashton). ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316 * Author: jdashton (J Daniel Ashton) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by noahgibbs (Noah Gibbs). Looks like a SIGABRT, address 0x38. This isn't one I've seen yet. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101148 * Author: jdashton (J Daniel Ashton) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by alanwu (Alan Wu). Thank you for the report and for providing a reliable repro -- it makes diagnosing the problem that much easier! We have a [fix](https://github.com/ruby/ruby/pull/7090) in the pipeline now. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101156 * Author: jdashton (J Daniel Ashton) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by k0kubun (Takashi Kokubun). Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED Updated the Backport field. Looking at the patch, we probably need to backport this to 3.1 as well. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101157 * Author: jdashton (J Daniel Ashton) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Assigned Assignee set to yjit ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101164 * Author: jdashton (J Daniel Ashton) * Status: Assigned * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by alanwu (Alan Wu). Here is a reproducer for 3.1.3: ```ruby def foo(_, a, b, c) a & b & ~c end n = 2 ** 64 args = [0, -n, n, n-1] GC.stress = true p foo(0, -n, n, n-1) p foo(0, -n, n, n-1) p foo(0, -n, n, n-1) __END__ $ ruby-3.1.3/bin/ruby test.rb 18446744073709551616 18446744073709551616 18446744073709551616 $ ruby-3.1.3/bin/ruby --yjit-call-threshold=1 test.rb 18446744073709551616 18446744073709551616 -18446744073709551616 ``` Patch: ```patch diff --git a/yjit_codegen.c b/yjit_codegen.c --- a/yjit_codegen.c +++ b/yjit_codegen.c @@ -3638,6 +3638,8 @@ gen_send_iseq(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const r if (leaf_builtin && !block && leaf_builtin->argc + 1 <= NUM_C_ARG_REGS) { ADD_COMMENT(cb, "inlined leaf builtin"); + jit_prepare_routine_call(jit, ctx, REG0); + // Call the builtin func (ec, recv, arg1, arg2, ...) mov(cb, C_ARG_REGS[0], REG_EC); ``` It passes `make check` for me locally when applied against the release tar ball. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101187 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by naruse (Yui NARUSE). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ruby_3_2 1fb5eb5740d4c4f1fc34a4a50bc0482eac27b545 merged revision(s) aeddc19340c7116d48fac3080553fbb823857d16. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-101355 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ruby_3_1 c660aaf439dcd609e4e23253372c8ec6d567ce10 merged revision(s) aeddc19340c7116d48fac3080553fbb823857d16. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-102482 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by nagachika (Tomoyuki Chikanaga). @alanwu Thank you for providing the patch for ruby_3_1. I have applied it at c660aaf439dcd609e4e23253372c8ec6d567ce10. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-102483 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE make test-alll on GitHub Actions with YJIT fails as follows. ``` 1) Failure: TestYJIT#test_bug_19316 [/home/runner/work/ruby/ruby/src/test/ruby/test_yjit.rb:691]: Expected no exits, but got {:opt_send_without_block=>1, :leave=>2, :opt_and=>1} Finished tests in 438.457308s, 49.5715 tests/s, 6283.6517 assertions/s. 21735 tests, 2755113 assertions, 1 failures, 0 errors, 101 skips ``` Should I apply some additional changes? I restore the Backport field for 3.1 to "REQUIRED". ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-102488 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by alanwu (Alan Wu). @nagachika You shouldn't need any other code changes. To fix CI, pass `exit: :any` in the test: ```ruby def test_bug_19316 - omit "skip this test for [Bug #19316] for a while." n = 2 ** 64 # foo's extra param and the splats are relevant - assert_compiles(<<~'RUBY', result: [[n, -n], [n, -n]]) + assert_compiles(<<~'RUBY', result: [[n, -n], [n, -n]], exits: :any) def foo(_, a, b, c) [a & b, ~c] end ``` We only care about getting the correct result in this case so don't mind exiting from YJIT. Keeping the `omit` is also probably fine. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-102501 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/

Issue #19316 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE @alanwu Thank you! I applied the patch you provided at 6ee749a52817fc463bbc2e93e5c3874a8c9aacf9. ---------------------------------------- Bug #19316: YJIT crash in 3.2.0 https://bugs.ruby-lang.org/issues/19316#change-102536 * Author: jdashton (J Daniel Ashton) * Status: Closed * Priority: Normal * Assignee: yjit * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-darwin22] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE ---------------------------------------- When I check out this commit from GitHub, https://github.com/jdashton/aoc2022-ruby/tree/5702dac483cd6e95f7be35bfebaf9d... , and run the following command, `RUBYOPT="-v --yjit" bin/rspec spec/aoc2022/puzzles/unstable_diffusion_spec.rb`, Ruby crashes. Crash Report log file attached. ---Files-------------------------------- ruby-2023-01-06-091855.ips (21.6 KB) -- https://bugs.ruby-lang.org/
participants (8)
-
alanwu (Alan Wu)
-
alanwu (Alan Wu)
-
hsbt (Hiroshi SHIBATA)
-
jdashton (J Daniel Ashton)
-
k0kubun (Takashi Kokubun)
-
nagachika (Tomoyuki Chikanaga)
-
naruse (Yui NARUSE)
-
noahgibbs (Noah Gibbs)