From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id B5C131F8C7 for ; Wed, 18 Aug 2021 17:34:43 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 11006120A0A; Thu, 19 Aug 2021 02:33:22 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id C90D61209FF for ; Thu, 19 Aug 2021 02:33:19 +0900 (JST) Received: by filterdrecv-7489454b79-c6k4m with SMTP id filterdrecv-7489454b79-c6k4m-1-611D44A7-1C 2021-08-18 17:34:31.396618517 +0000 UTC m=+415819.411504523 Received: from herokuapp.com (unknown) by ismtpd0183p1mdw1.sendgrid.net (SG) with ESMTP id H4BJxM9lTau6ev1ryL1tdg for ; Wed, 18 Aug 2021 17:34:31.277 +0000 (UTC) Date: Wed, 18 Aug 2021 17:34:31 +0000 (UTC) From: "vo.x (Vit Ondruch)" Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17052 X-Redmine-Issue-Author: vo.x X-Redmine-Sender: vo.x X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 81117 X-SG-EID: =?us-ascii?Q?1BO5E1LXHcjbGn447qx9J3bLqJckwjkYxnet3qAAIKG0Q+gfRSAYCxFkjK=2FtB1?= =?us-ascii?Q?M2=2FIxYQQYM565yajRHmjHwlVzXPT0weZviveR4V?= =?us-ascii?Q?7xxaPWSEMuFeqJnETLIH32s=2FlXBz4nbhJZp+nOu?= =?us-ascii?Q?IhBJwbLn6YDfjN6UqlMKIf1gtki4hmiPxmytSZB?= =?us-ascii?Q?uJJ8B6ZGCOppYxNT7K33LFtwYrfklGHrAm0kRG9?= =?us-ascii?Q?3rwlY2aXtMCi8mu6VZESrvaiP4Zqp=2FbeVgzQirH?= =?us-ascii?Q?E4=2FiVljrgt7Azg8TmwbLg=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 104973 Subject: [ruby-core:104973] [Ruby master Bug#17052] Ruby with LTO enabled has issues with SIGSEGV handler X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17052 has been updated by vo.x (Vit Ondruch). The result with the latest patch is significantly different: ~~~ $ gdb --args ./miniruby -e'Process.kill("SIGSEGV",$$)' GNU gdb (GDB) Fedora 10.2-6.fc35 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "ppc64le-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./miniruby... warning: File "/builddir/build/BUILD/ruby-3.0.2/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". To enable execution of this file add add-auto-load-safe-path /builddir/build/BUILD/ruby-3.0.2/.gdbinit line to your configuration file "/builddir/.gdbinit". To completely disable this security protection add set auto-load safe-path / line to your configuration file "/builddir/.gdbinit". For more information about this security protection see the "Auto-loading safe path" section in the GDB manual. E.g., run from the shell: info "(gdb)Auto-loading safe path" (gdb) r Starting program: /builddir/build/BUILD/ruby-3.0.2/miniruby -eProcess.kill\(\"SIGSEGV\",\$\$\) Download failed: No route to host. Continuing without debug info for /lib64/libz.so.1. Download failed: No route to host. Continuing without debug info for /lib64/libgmp.so.10. Download failed: No route to host. Continuing without debug info for /lib64/libcrypt.so.2. Download failed: No route to host. Continuing without debug info for /lib64/libm.so.6. Download failed: No route to host. Continuing without debug info for /lib64/libc.so.6. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7aa8810 in kill () from /lib64/libc.so.6 Missing separate debuginfos, use: dnf debuginfo-install glibc-2.34-1.fc35.ppc64le gmp-6.2.0-7.fc35.ppc64le libxcrypt-4.4.25-1.fc35.ppc64le zlib-1.2.11-30.fc35.ppc64le (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 ------------------------------------------- 1267: 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:1268 #4 di_find_abbrev (abbrev_number=106, reader=0x100598660) at addr2line.c:1279 #5 di_read_die (reader=0x100598660, die=0x100598570) at addr2line.c:1349 #6 0x0000000100337a3c in debug_info_read (traces=, offset=, lines=, num_traces=, reader=) at addr2line.c:1658 #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=0, offset@entry=-1, traces=) at addr2line.c:1915 #8 0x0000000100338d9c in rb_dump_backtrace_with_lines.constprop.0 (num_traces=, traces=) at addr2line.c:2314 #9 0x000000010031e04c in rb_print_backtrace () at vm_dump.c:760 #10 0x00000001003353d8 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=0x100383b18 "Segmentation fault at %p") at error.c:786 #12 0x00000001002563c8 in sigsegv (sig=, info=0x10059a330, ctx=0x1005995b0) at signal.c:960 #13 #14 0x00007ffff7aa8810 in kill () from /lib64/libc.so.6 #15 0x000000010025adb0 in rb_f_kill (argc=, argv=0x7ffff78e0050) at signal.c:439 #16 0x00000001001fb488 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) ~~~ But probably still not the right output though. I'd still expect some backtrace reported. ---------------------------------------- Bug #17052: Ruby with LTO enabled has issues with SIGSEGV handler https://bugs.ruby-lang.org/issues/17052#change-93340 * 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) -- https://bugs.ruby-lang.org/