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=-3.6 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, 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 1CFC81F8C6 for ; Thu, 12 Aug 2021 15:59:23 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 61701120BC5; Fri, 13 Aug 2021 00:58:02 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id CD7A5120BB8 for ; Fri, 13 Aug 2021 00:57:58 +0900 (JST) Received: by filterdrecv-765fd4f9f8-gkbfr with SMTP id filterdrecv-765fd4f9f8-gkbfr-1-61154552-6C 2021-08-12 15:59:14.976108024 +0000 UTC m=+693601.194364414 Received: from herokuapp.com (unknown) by ismtpd0174p1iad2.sendgrid.net (SG) with ESMTP id QrslUwSQSYWuNkWILYc1-Q for ; Thu, 12 Aug 2021 15:59:14.869 +0000 (UTC) Date: Thu, 12 Aug 2021 15:59:15 +0000 (UTC) From: v.ondruch@tiscali.cz 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: 81039 X-SG-EID: =?us-ascii?Q?mWhqNvD1xlBozk4zn6CTHlnSPHlTKkyHJdiOH=2FzC52hc0464oYKuh4ki5Ic8m9?= =?us-ascii?Q?G+WDx1yKz5Uklp7qbboTk0vw8173y6B4kvE8ybJ?= =?us-ascii?Q?mgOwLwVIjRu3h+6XvN97z3kyqlR+=2F4biv03RHwu?= =?us-ascii?Q?TAtMxy05Z19h+EJJAWK19NLq1wyN30byNG0gboN?= =?us-ascii?Q?kKvV4UIjL0WDC+a5+3U4LtmW1r3hNipoONQ=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 104900 Subject: [ruby-core:104900] [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). Status changed from Third Party's Issue to Open Changing state back to open, because this is unresolved and I am repeatedly hitting this issue in various reincarnations. So this is the debug session on PPC64LE: ~~~ $ 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.24-1.fc35.ppc64le zlib-1.2.11-30.fc35.ppc64le (gdb) c Continuing. -e:1: [BUG] Segmentation fault at 0x590fb15c0000001f 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 ------------------------------------------- Program received signal SIGSEGV, Segmentation fault. 0x000000010031fa44 in uleb128 (p=0x1005986a0) at addr2line.c:200 200 unsigned char b = *(unsigned char *)(*p)++; (gdb) bt #0 0x000000010031fa44 in uleb128 (p=0x1005986a0) at addr2line.c:200 #1 di_read_die (reader=0x100598668, die=0x100598588) at addr2line.c:1335 #2 0x0000000100337d4c in read_abstract_origin (line=0x1005985f8, abstract_origin=760312297580551, reader=0x100598668) at addr2line.c:1604 #3 debug_info_read (traces=, offset=, lines=, num_traces=, reader=) at addr2line.c:1668 #4 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:1888 #5 0x0000000100338d1c in rb_dump_backtrace_with_lines.constprop.0 (num_traces=, traces=) at addr2line.c:2287 #6 0x000000010031dfec in rb_print_backtrace () at vm_dump.c:760 #7 0x00000001003356a8 in rb_vm_bugreport.constprop.0 (ctx=) at vm_dump.c:998 #8 0x00000001000cd8c4 in rb_bug_for_fatal_signal (default_sighandler=0x0, sig=, ctx=, fmt=0x100383a98 "Segmentation fault at %p") at error.c:786 #9 0x0000000100256388 in sigsegv (sig=, info=0x10059a330, ctx=0x1005995b0) at signal.c:960 #10 #11 0x00007ffff7aa8810 in kill () from /lib64/libc.so.6 #12 0x000000010025ad70 in rb_f_kill (argc=, argv=0x7ffff78e0050) at signal.c:439 #13 0x00000001001fb448 in proc_rb_f_kill (c=, v=, _=) at process.c:8605 #14 0x00000001002e92d8 in ractor_safe_call_cfunc_m1 (recv=, argc=, argv=, func=) at vm_insnhelper.c:2739 #15 0x00000001002f2120 in vm_call_cfunc_with_frame (ec=0x100491ac0, reg_cfp=0x7fffffffe170, calling=) at vm_insnhelper.c:2929 #16 0x00000001002f4f34 in vm_sendish (ec=0x100491ac0, reg_cfp=0x7ffff79dffa0, cd=0x1005c2eb0, block_handler=, method_explorer=) at vm_insnhelper.c:4530 #17 0x00000001002fa2ac in vm_exec_core (ec=0x100491ac0, initial=) at insns.def:789 #18 0x0000000100315200 in rb_vm_exec (ec=0x100491ac0, mjit_enable_p=) at vm.c:2172 #19 0x0000000100317040 in rb_iseq_eval_main (iseq=0x1004a9fb0) at vm.c:2420 #20 0x00000001000d7c8c in rb_ec_exec_node (ec=ec@entry=0x100491ac0, n=n@entry=0x1004a9fb0) at eval.c:317 #21 0x00000001000d7df4 in ruby_run_node (n=0x1004a9fb0) at eval.c:375 #22 0x000000010002afb8 in main (argc=, argv=) at ./main.c:50 (gdb) ~~~ ---------------------------------------- Bug #17052: Ruby with LTO enabled has issues with SIGSEGV handler https://bugs.ruby-lang.org/issues/17052#change-93260 * 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/ -- https://bugs.ruby-lang.org/