From: "vo.x (Vit Ondruch)" Date: 2021-08-23T13:55:35+00:00 Subject: [ruby-core:105049] [Ruby master Bug#17052] Ruby with LTO enabled has issues with SIGSEGV handler Issue #17052 has been updated by vo.x (Vit Ondruch). ~~~ (gdb) c Continuing. -e:1: [BUG] Segmentation fault at 0x590fb15c00000020 ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [powerpc64le-linux] -- Control frame information ----------------------------------------------- c:0003 p:---- s:0012 e:000011 CFUNC :kill c:0002 p:0015 s:0006 e:000005 EVAL -e:1 [FINISH] c:0001 p:0000 s:0003 E:0013f0 (none) [FINISH] -- Ruby level backtrace information ---------------------------------------- -e:1:in `
' -e:1:in `kill' -- C level backtrace information ------------------------------------------- 1273: debug_info 0x54 Abbrev Number 106 not found Program received signal SIGABRT, Aborted. 0x00007ffff7b09864 in __pthread_kill_internal () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff7b09864 in __pthread_kill_internal () from /lib64/libc.so.6 #1 0x00007ffff7aa848c in raise () from /lib64/libc.so.6 #2 0x00007ffff7a81404 in abort () from /lib64/libc.so.6 #3 0x000000010031fe70 in di_abbrev_table (abbrev_number=106, reader=0x100598660) at addr2line.c:1274 #4 di_find_abbrev (abbrev_number=106, reader=0x100598660) at addr2line.c:1285 #5 di_read_die (reader=0x100598660, die=0x100598570) at addr2line.c:1355 #6 0x00000001003370cc in debug_info_read (traces=, offset=, lines=, num_traces=, reader=) at addr2line.c:1664 #7 fill_lines (num_traces=num_traces@entry=19, check_debuglink=check_debuglink@entry=1, objp=0x100599010, objp@entry=0x1005990a0, lines=lines@entry=0x1005e2c50, offset=, offset@entry=-1, traces=) at addr2line.c:1929 #8 0x0000000100338dec in rb_dump_backtrace_with_lines.constprop.0 (num_traces=, traces=) at addr2line.c:2328 #9 0x000000010031e04c in rb_print_backtrace () at vm_dump.c:760 #10 0x0000000100335418 in rb_vm_bugreport.constprop.0 (ctx=) at vm_dump.c:998 #11 0x00000001000cd884 in rb_bug_for_fatal_signal (default_sighandler=0x0, sig=, ctx=, fmt=0x100383b58 "Segmentation fault at %p") at error.c:786 #12 0x0000000100256408 in sigsegv (sig=, info=0x10059a330, ctx=0x1005995b0) at signal.c:960 #13 #14 0x00007ffff7aa8810 in kill () from /lib64/libc.so.6 #15 0x000000010025adf0 in rb_f_kill (argc=, argv=0x7ffff78e0050) at signal.c:439 #16 0x00000001001fb4c8 in proc_rb_f_kill (c=, v=, _=) at process.c:8605 #17 0x00000001002e9358 in ractor_safe_call_cfunc_m1 (recv=, argc=, argv=, func=) at vm_insnhelper.c:2739 #18 0x00000001002f21a0 in vm_call_cfunc_with_frame (ec=0x100491ac0, reg_cfp=0x7fffffffe170, calling=) at vm_insnhelper.c:2929 #19 0x00000001002f4fb4 in vm_sendish (ec=0x100491ac0, reg_cfp=0x7ffff79dffa0, cd=0x1005c2eb0, block_handler=, method_explorer=) at vm_insnhelper.c:4530 #20 0x00000001002fa32c in vm_exec_core (ec=0x100491ac0, initial=) at insns.def:789 #21 0x0000000100315260 in rb_vm_exec (ec=0x100491ac0, mjit_enable_p=) at vm.c:2172 #22 0x00000001003170a0 in rb_iseq_eval_main (iseq=0x1004a9fb0) at vm.c:2420 #23 0x00000001000d7c4c in rb_ec_exec_node (ec=ec@entry=0x100491ac0, n=n@entry=0x1004a9fb0) at eval.c:317 #24 0x00000001000d7db4 in ruby_run_node (n=0x1004a9fb0) at eval.c:375 #25 0x000000010002afb8 in main (argc=, argv=) at ./main.c:50 (gdb) f 3 #3 0x000000010031fe70 in di_abbrev_table (abbrev_number=106, reader=0x100598660) at addr2line.c:1274 1274 abort(); (gdb) l 1269 while (a) { 1270 len++; 1271 a >>= 7; 1272 } 1273 fprintf(stderr,"%d: debug_info 0x%"PRIxPTR" Abbrev Number %"PRId64" not found\n",__LINE__, reader->p - reader->obj->debug_info.ptr - len, abbrev_number); 1274 abort(); 1275 } 1276 return p; 1277 } 1278 (gdb) ~~~ ---------------------------------------- Bug #17052: Ruby with LTO enabled has issues with SIGSEGV handler https://bugs.ruby-lang.org/issues/17052#change-93459 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- Fedora aims to enable link time optimization (LTO) of packages in next release. The specific changes in configuration options are available here [1]. Since that time, I observe following errors [2] at least on {aarch64,ppc64le} (and possibly also other architectures): ~~~ 1) Failure: TestBugReporter#test_bug_reporter_add [/builddir/build/BUILD/ruby-2.7.1/test/-ext-/bug_reporter/test_bug_reporter.rb:22]: pid 32395 killed by SIGSEGV (signal 11) (core dumped) | -:1: [BUG] Segmentation fault at 0x000003e800007e8b | ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] | | -- Control frame information ----------------------------------------------- | c:0003 p:---- s:0012 e:000011 CFUNC :kill | c:0002 p:0021 s:0006 e:000005 EVAL -:1 [FINISH] | c:0001 p:0000 s:0003 E:000f80 (none) [FINISH] | | -- Ruby level backtrace information ---------------------------------------- | -:1:in `
' | -:1:in `kill' | | -- C level backtrace information ------------------------------------------- .. 1. [2/2] Assertion for "stderr" | Expected /Sample bug reporter: 12345/ | to match | "-- Control frame information -----------------------------------------------\n"+ | "c:0003 p:---- s:0012 e:000011 CFUNC :kill\n"+ | "c:0002 p:0021 s:0006 e:000005 EVAL -:1 [FINISH]\n"+ | "c:0001 p:0000 s:0003 E:000f80 (none) [FINISH]\n\n"+ | "-- Ruby level backtrace information ----------------------------------------\n"+ | "-:1:in `
'\n"+ | "-:1:in `kill'\n\n"+ | "-- C level backtrace information -------------------------------------------\n" | after 4 patterns with 120 characters. 2) Failure: TestRubyOptions#test_segv_loaded_features [/builddir/build/BUILD/ruby-2.7.1/test/ruby/test_rubyoptions.rb:735]: pid 38444 killed by SIGSEGV (signal 11) (core dumped) | -e:1: [BUG] Segmentation fault at 0x000003e80000962c | ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] | | -- Control frame information ----------------------------------------------- | c:0003 p:---- s:0012 e:000011 CFUNC :kill | c:0002 p:0016 s:0006 e:000005 BLOCK -e:1 [FINISH] | c:0001 p:0000 s:0003 E:002460 (none) [FINISH] | | -- Ruby level backtrace information ---------------------------------------- | -e:1:in `block in
' | -e:1:in `kill' | | -- C level backtrace information ------------------------------------------- .. 1. [2/2] Assertion for "stderr" | <""> expected but was | <"-- C level backtrace information -------------------------------------------\n">. 3) Failure: TestRubyOptions#test_segv_setproctitle [/builddir/build/BUILD/ruby-2.7.1/test/ruby/test_rubyoptions.rb:749]: pid 38451 killed by SIGSEGV (signal 11) (core dumped) | -e:1: [BUG] Segmentation fault at 0x000003e800009633 | ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] | | -- Control frame information ----------------------------------------------- | c:0003 p:---- s:0012 e:000011 CFUNC :kill | c:0002 p:0029 s:0006 e:000005 EVAL -e:1 [FINISH] | c:0001 p:0000 s:0003 E:000480 (none) [FINISH] | | -- Ruby level backtrace information ---------------------------------------- | -e:1:in `
' | -e:1:in `kill' | | -- C level backtrace information ------------------------------------------- .. 1. [2/2] Assertion for "stderr" | <""> expected but was | <"-- C level backtrace information -------------------------------------------\n">. 4) Failure: TestRubyOptions#test_segv_test [/builddir/build/BUILD/ruby-2.7.1/test/ruby/test_rubyoptions.rb:729]: pid 38460 killed by SIGSEGV (signal 11) (core dumped) | -e:1: [BUG] Segmentation fault at 0x000003e80000963c | ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] | | -- Control frame information ----------------------------------------------- | c:0003 p:---- s:0012 e:000011 CFUNC :kill | c:0002 p:0015 s:0006 e:000005 EVAL -e:1 [FINISH] | c:0001 p:0000 s:0003 E:0006a0 (none) [FINISH] | | -- Ruby level backtrace information ---------------------------------------- | -e:1:in `
' | -e:1:in `kill' | | -- C level backtrace information ------------------------------------------- .. 1. [2/2] Assertion for "stderr" | <""> expected but was | <"-- C level backtrace information -------------------------------------------\n">. Finished tests in 840.600443s, 25.0047 tests/s, 3238.9681 assertions/s. 21019 tests, 2722678 assertions, 4 failures, 0 errors, 70 skips ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [powerpc64le-linux] ~~~ When I raised the issue on fedora-devel ML [3], there was suggestion that it might happen when signal handler modifies any global variable. Now I am not sure if that is the case. Can somebody confirm? Or investigate/fix this, please? [1]: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/5baaf4a99cc77572d3496a7000674098bef7ed68?branch=master [2]: https://koschei.fedoraproject.org/package/ruby [3]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/D6YUXPU5C2RWIQMNHLT4HBYXUGVKKPOW/ ---Files-------------------------------- ruby-addr2line-DW_FORM_ref_addr.patch (651 Bytes) ruby-addr2line-read_abstract_origin.patch (1.37 KB) ruby-addr2line-abbrev_table.patch (1.49 KB) ruby-addr2line-abbrev_table-r1.patch (2.81 KB) ruby-addr2line-debug_info_read-debug-code-0001.patch (1.11 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: