From: v.ondruch@... Date: 2021-08-05T08:11:16+00:00 Subject: [ruby-core:104782] [Ruby master Bug#18062] Ruby with enabled LTO segfaults during build Issue #18062 has been updated by vo.x (Vit Ondruch). GDB output: ~~~ $ gdb ./miniruby 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 "x86_64-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... (gdb) r -I./lib -I. -I.ext/common ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc Starting program: /builddir/build/BUILD/ruby-3.0.2/miniruby -I./lib -I. -I.ext/common ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc Download failed: No route to host. Continuing without debug info for /builddir/build/BUILD/ruby-3.0.2/system-supplied DSO at 0x7ffff7fc9000. 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. vm_ccs_push.part.0.lto_priv.0 (klass=93824996623120, ccs=0x0, ci=0x22f100140003, cc=0x55555595ddf0) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1579 1579 if (UNLIKELY(ccs->len == ccs->capa)) { Missing separate debuginfos, use: dnf debuginfo-install glibc-2.34-1.fc35.x86_64 gmp-6.2.0-7.fc35.x86_64 libxcrypt-4.4.23-2.fc35.x86_64 zlib-1.2.11-30.fc35.x86_64 (gdb) where #0 vm_ccs_push.part.0.lto_priv.0 (klass=93824996623120, ccs=0x0, ci=0x22f100140003, cc=0x55555595ddf0) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1579 #1 0x000055555579eb7e in vm_ccs_push (cc=0x55555595ddf0, ci=0x22f100140003, ccs=, klass=93824996623120) at ./include/ruby/internal/fl_type.h:237 #2 vm_search_cc (klass=klass@entry=93824996623120, ci=0x22f100140003) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1718 #3 0x000055555579ed30 in rb_vm_search_method_slowpath (klass=93824996623120, ci=) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1736 #4 vm_search_method_slowpath0 (cd_owner=93824996467240, cd=cd@entry=0x555555a358f0, klass=93824996623120) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1758 #5 0x00005555557a5ff4 in vm_search_method_fastpath (klass=, cd=0x555555a358f0, cd_owner=) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:1824 #6 vm_sendish (ec=0x555555909c80, reg_cfp=0x7ffff7b84f68, cd=0x555555a358f0, block_handler=, method_explorer=) at /builddir/build/BUILD/ruby-3.0.2/vm_insnhelper.c:4526 #7 0x00005555557a95b8 in vm_exec_core (ec=0x555555909c80, initial=0) at /builddir/build/BUILD/ruby-3.0.2/insns.def:789 #8 0x00005555557c0ea0 in rb_vm_exec (ec=0x555555909c80, mjit_enable_p=) at /builddir/build/BUILD/ruby-3.0.2/vm.c:2172 #9 0x000055555572c5af in rb_load_with_builtin_functions (table=0x5555558f0240 , feature_name=0x55555588e0c3 "gc") at /builddir/build/BUILD/ruby-3.0.2/mini_builtin.c:48 #10 Init_builtin_gc () at /builddir/build/BUILD/ruby-3.0.2/gc.rbinc:212 #11 rb_call_builtin_inits () at /builddir/build/BUILD/ruby-3.0.2/inits.c:88 #12 ruby_opt_init (opt=0x7fffffffdfb0) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:1520 #13 ruby_opt_init (opt=opt@entry=0x7fffffffdfb0) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:1506 #14 0x000055555572e6e2 in load_file_internal (argp_v=140737488309936) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:2181 #15 0x00005555556045a6 in rb_ensure (b_proc=0x55555572e230 , data1=140737488309936, e_proc=, data2=) at /builddir/build/BUILD/ruby-3.0.2/eval.c:1162 #16 0x0000555555730a65 in load_file (opt=0x7fffffffdfb0, script=1, f=, fname=, parser=93824996498920) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:2323 #17 process_options (argc=6, argv=0x7fffffffe350, opt=0x7fffffffdfb0) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:1960 #18 0x0000555555731551 in ruby_process_options (argc=11, argv=0x7fffffffe328) at /builddir/build/BUILD/ruby-3.0.2/ruby.c:230 #19 0x0000555555609de9 in ruby_options (argc=11, argv=0x7fffffffe328) at /builddir/build/BUILD/ruby-3.0.2/eval.c:138 #20 0x00005555555811e7 in main (argc=, argv=) at ./main.c:50 (gdb) list 1574 } 1575 else if (! vm_ci_markable(ci)) { 1576 return; 1577 } 1578 1579 if (UNLIKELY(ccs->len == ccs->capa)) { 1580 if (ccs->capa == 0) { 1581 ccs->capa = 1; 1582 ccs->entries = ALLOC_N(struct rb_class_cc_entries_entry, ccs->capa); 1583 } (gdb) 1584 else { 1585 ccs->capa *= 2; 1586 REALLOC_N(ccs->entries, struct rb_class_cc_entries_entry, ccs->capa); 1587 } 1588 } 1589 VM_ASSERT(ccs->len < ccs->capa); 1590 1591 const int pos = ccs->len++; 1592 RB_OBJ_WRITE(klass, &ccs->entries[pos].ci, ci); 1593 RB_OBJ_WRITE(klass, &ccs->entries[pos].cc, cc); (gdb) ~~~ ---------------------------------------- Bug #18062: Ruby with enabled LTO segfaults during build https://bugs.ruby-lang.org/issues/18062#change-93118 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- After a while, I am trying to enable LTO for Ruby in Fedora. Previously I hit #17052, but now I observe issues much earlier during compliation already: ~~~ ./miniruby -I./lib -I. -I.ext/common ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc :240: [BUG] Segmentation fault at 0x0000000000000004 ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux] -- Control frame information ----------------------------------------------- c:0003 p:0008 s:0011 e:000008 CLASS :240 c:0002 p:0015 s:0006 e:000005 TOP :235 [FINISH] c:0001 p:0000 s:0003 E:000230 (none) [FINISH] -- Ruby level backtrace information ---------------------------------------- :235:in `' :240:in `' -- Machine register context ------------------------------------------------ RIP: 0x00005585da1c832a RBP: 0x000022f100140003 RSP: 0x00007ffd6460a6a0 RAX: 0x0000000000000001 RBX: 0x00000000000022f1 RCX: 0x00005585dade5d90 RDX: 0x000022f100140003 RDI: 0x00005585dae0c2d8 RSI: 0x0000000000000000 R8: 0x0000000000000000 R9: 0x00007ffd6460a6e0 R10: 0x00005585daebbe50 R11: 0x00007f00a785baa0 R12: 0x0000000000000000 R13: 0x00005585dade5d90 R14: 0x00005585dae0c2d8 R15: 0x00005585dade5d90 EFL: 0x0000000000010202 -- C level backtrace information ------------------------------------------- ./miniruby(rb_print_backtrace+0x19) [0x5585da1cdba9] ./miniruby(rb_vm_bugreport+0x215) [0x5585da1d1a05] ./miniruby(rb_bug_for_fatal_signal+0xf4) [0x5585da004fc4] ./miniruby(sigsegv+0x4d) [0x5585da13709d] [0x7f00a76a4760] ./miniruby(vm_ccs_push.part.0.lto_priv.0+0x2a) [0x5585da1c832a] ./miniruby(vm_search_cc+0xfe) [0x5585da1a7b7e] ./miniruby(vm_search_method_slowpath0.lto_priv.0+0x40) [0x5585da1a7d30] ./miniruby(vm_sendish.lto_priv.0+0x6e4) [0x5585da1aeff4] ./miniruby(vm_exec_core.lto_priv.0+0xa8) [0x5585da1b25b8] ./miniruby(rb_vm_exec+0x110) [0x5585da1c9ea0] ./miniruby(ruby_opt_init+0x6f) [0x5585da1355af] ./miniruby(load_file_internal+0x4b2) [0x5585da1376e2] ./miniruby(rb_ensure+0x106) [0x5585da00d5a6] ./miniruby(process_options+0x19e5) [0x5585da139a65] ./miniruby(ruby_process_options+0x151) [0x5585da13a551] ./miniruby(ruby_options+0x119) [0x5585da012de9] ./miniruby(main+0x57) [0x5585d9f8a1e7] -- Other runtime information ----------------------------------------------- * Loaded script: ./miniruby * Loaded features: 0 enumerator.so 1 thread.rb 2 rational.so 3 complex.so 4 ruby2_keywords.rb * Process memory map: 5585d9f5d000-5585d9f85000 r--p 00000000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 5585d9f85000-5585da1f2000 r-xp 00028000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 5585da1f2000-5585da2f6000 r--p 00295000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 5585da2f6000-5585da2fd000 r--p 00398000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 5585da2fd000-5585da2fe000 rw-p 0039f000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 5585da2fe000-5585da30e000 rw-p 00000000 00:00 0 5585dad8d000-5585daed3000 rw-p 00000000 00:00 0 [heap] 7f00a28ae000-7f00a409b000 r--s 00000000 fc:05 137001366 /builddir/build/BUILD/ruby-3.0.2/miniruby 7f00a409b000-7f00a409e000 r--p 00000000 fc:05 270435464 /usr/lib64/libgcc_s-11-20210728.so.1 7f00a409e000-7f00a40b0000 r-xp 00003000 fc:05 270435464 /usr/lib64/libgcc_s-11-20210728.so.1 7f00a40b0000-7f00a40b3000 r--p 00015000 fc:05 270435464 /usr/lib64/libgcc_s-11-20210728.so.1 7f00a40b3000-7f00a40b4000 r--p 00017000 fc:05 270435464 /usr/lib64/libgcc_s-11-20210728.so.1 7f00a40b4000-7f00a40b5000 rw-p 00018000 fc:05 270435464 /usr/lib64/libgcc_s-11-20210728.so.1 7f00a40b5000-7f00a40b6000 ---p 00000000 00:00 0 7f00a40b6000-7f00a4157000 rw-p 00000000 00:00 0 7f00a4157000-7f00a4158000 ---p 00000000 00:00 0 7f00a4158000-7f00a41f9000 rw-p 00000000 00:00 0 7f00a41f9000-7f00a41fa000 ---p 00000000 00:00 0 7f00a41fa000-7f00a429b000 rw-p 00000000 00:00 0 7f00a429b000-7f00a429c000 ---p 00000000 00:00 0 7f00a429c000-7f00a433d000 rw-p 00000000 00:00 0 7f00a433d000-7f00a433e000 ---p 00000000 00:00 0 7f00a433e000-7f00a43df000 rw-p 00000000 00:00 0 7f00a43df000-7f00a43e0000 ---p 00000000 00:00 0 7f00a43e0000-7f00a4481000 rw-p 00000000 00:00 0 7f00a4481000-7f00a4482000 ---p 00000000 00:00 0 7f00a4482000-7f00a4523000 rw-p 00000000 00:00 0 7f00a4523000-7f00a4524000 ---p 00000000 00:00 0 7f00a4524000-7f00a45c5000 rw-p 00000000 00:00 0 7f00a45c5000-7f00a45c6000 ---p 00000000 00:00 0 7f00a45c6000-7f00a4667000 rw-p 00000000 00:00 0 7f00a4667000-7f00a4668000 ---p 00000000 00:00 0 7f00a4668000-7f00a4709000 rw-p 00000000 00:00 0 7f00a4709000-7f00a470a000 ---p 00000000 00:00 0 7f00a470a000-7f00a47ab000 rw-p 00000000 00:00 0 7f00a47ab000-7f00a47ac000 ---p 00000000 00:00 0 7f00a47ac000-7f00a484d000 rw-p 00000000 00:00 0 7f00a484d000-7f00a484e000 ---p 00000000 00:00 0 7f00a484e000-7f00a48ef000 rw-p 00000000 00:00 0 7f00a48ef000-7f00a48f0000 ---p 00000000 00:00 0 7f00a48f0000-7f00a4991000 rw-p 00000000 00:00 0 7f00a4991000-7f00a4992000 ---p 00000000 00:00 0 7f00a4992000-7f00a4a33000 rw-p 00000000 00:00 0 7f00a4a33000-7f00a4a34000 ---p 00000000 00:00 0 7f00a4a34000-7f00a4ad5000 rw-p 00000000 00:00 0 7f00a4ad5000-7f00a4ad6000 ---p 00000000 00:00 0 7f00a4ad6000-7f00a4b77000 rw-p 00000000 00:00 0 7f00a4b77000-7f00a4b78000 ---p 00000000 00:00 0 7f00a4b78000-7f00a4c19000 rw-p 00000000 00:00 0 7f00a4c19000-7f00a4c1a000 ---p 00000000 00:00 0 7f00a4c1a000-7f00a4cbb000 rw-p 00000000 00:00 0 7f00a4cbb000-7f00a4cbc000 ---p 00000000 00:00 0 7f00a4cbc000-7f00a4d5d000 rw-p 00000000 00:00 0 7f00a4d5d000-7f00a4d5e000 ---p 00000000 00:00 0 7f00a4d5e000-7f00a4dff000 rw-p 00000000 00:00 0 7f00a4dff000-7f00a4e00000 ---p 00000000 00:00 0 7f00a4e00000-7f00a4ea1000 rw-p 00000000 00:00 0 7f00a4ea1000-7f00a4ea2000 ---p 00000000 00:00 0 7f00a4ea2000-7f00a4f43000 rw-p 00000000 00:00 0 7f00a4f43000-7f00a4f44000 ---p 00000000 00:00 0 7f00a4f44000-7f00a4fe5000 rw-p 00000000 00:00 0 7f00a4fe5000-7f00a4fe6000 ---p 00000000 00:00 0 7f00a4fe6000-7f00a5087000 rw-p 00000000 00:00 0 7f00a5087000-7f00a5088000 ---p 00000000 00:00 0 7f00a5088000-7f00a5129000 rw-p 00000000 00:00 0 7f00a5129000-7f00a512a000 ---p 00000000 00:00 0 7f00a512a000-7f00a51cb000 rw-p 00000000 00:00 0 7f00a51cb000-7f00a51cc000 ---p 00000000 00:00 0 7f00a51cc000-7f00a526d000 rw-p 00000000 00:00 0 7f00a526d000-7f00a526e000 ---p 00000000 00:00 0 7f00a526e000-7f00a530f000 rw-p 00000000 00:00 0 7f00a530f000-7f00a5310000 ---p 00000000 00:00 0 7f00a5310000-7f00a53b1000 rw-p 00000000 00:00 0 7f00a53b1000-7f00a53b2000 ---p 00000000 00:00 0 7f00a53b2000-7f00a5453000 rw-p 00000000 00:00 0 7f00a5453000-7f00a5454000 ---p 00000000 00:00 0 7f00a5454000-7f00a7662000 rw-p 00000000 00:00 0 7f00a7662000-7f00a768e000 r--p 00000000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a768e000-7f00a7803000 r-xp 0002c000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a7803000-7f00a7857000 r--p 001a1000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a7857000-7f00a7858000 ---p 001f5000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a7858000-7f00a785b000 r--p 001f5000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a785b000-7f00a785e000 rw-p 001f8000 fc:05 270939738 /usr/lib64/libc.so.6 7f00a785e000-7f00a786b000 rw-p 00000000 00:00 0 7f00a786b000-7f00a787a000 r--p 00000000 fc:05 270939741 /usr/lib64/libm.so.6 7f00a787a000-7f00a78eb000 r-xp 0000f000 fc:05 270939741 /usr/lib64/libm.so.6 7f00a78eb000-7f00a7945000 r--p 00080000 fc:05 270939741 /usr/lib64/libm.so.6 7f00a7945000-7f00a7946000 r--p 000d9000 fc:05 270939741 /usr/lib64/libm.so.6 7f00a7946000-7f00a7947000 rw-p 000da000 fc:05 270939741 /usr/lib64/libm.so.6 7f00a7947000-7f00a7949000 r--p 00000000 fc:05 271023995 /usr/lib64/libcrypt.so.2.0.0 7f00a7949000-7f00a795d000 r-xp 00002000 fc:05 271023995 /usr/lib64/libcrypt.so.2.0.0 7f00a795d000-7f00a7976000 r--p 00016000 fc:05 271023995 /usr/lib64/libcrypt.so.2.0.0 7f00a7976000-7f00a7977000 ---p 0002f000 fc:05 271023995 /usr/lib64/libcrypt.so.2.0.0 7f00a7977000-7f00a7978000 r--p 0002f000 fc:05 271023995 /usr/lib64/libcrypt.so.2.0.0 7f00a7978000-7f00a7981000 rw-p 00000000 00:00 0 7f00a7981000-7f00a7992000 r--p 00000000 fc:05 271068897 /usr/lib64/libgmp.so.10.4.0 7f00a7992000-7f00a7a0a000 r-xp 00011000 fc:05 271068897 /usr/lib64/libgmp.so.10.4.0 7f00a7a0a000-7f00a7a21000 r--p 00089000 fc:05 271068897 /usr/lib64/libgmp.so.10.4.0 7f00a7a21000-7f00a7a23000 r--p 0009f000 fc:05 271068897 /usr/lib64/libgmp.so.10.4.0 7f00a7a23000-7f00a7a24000 rw-p 000a1000 fc:05 271068897 /usr/lib64/libgmp.so.10.4.0 7f00a7a24000-7f00a7a27000 r--p 00000000 fc:05 271023970 /usr/lib64/libz.so.1.2.11 7f00a7a27000-7f00a7a35000 r-xp 00003000 fc:05 271023970 /usr/lib64/libz.so.1.2.11 7f00a7a35000-7f00a7a3b000 r--p 00011000 fc:05 271023970 /usr/lib64/libz.so.1.2.11 7f00a7a3b000-7f00a7a3c000 ---p 00017000 fc:05 271023970 /usr/lib64/libz.so.1.2.11 7f00a7a3c000-7f00a7a3d000 r--p 00017000 fc:05 271023970 /usr/lib64/libz.so.1.2.11 7f00a7a3d000-7f00a7a3e000 rw-p 00000000 00:00 0 7f00a7a41000-7f00a7a43000 rw-p 00000000 00:00 0 7f00a7a43000-7f00a7a44000 r--p 00000000 fc:05 270939734 /usr/lib64/ld-linux-x86-64.so.2 7f00a7a44000-7f00a7a69000 r-xp 00001000 fc:05 270939734 /usr/lib64/ld-linux-x86-64.so.2 7f00a7a69000-7f00a7a73000 r--p 00026000 fc:05 270939734 /usr/lib64/ld-linux-x86-64.so.2 7f00a7a73000-7f00a7a75000 r--p 0002f000 fc:05 270939734 /usr/lib64/ld-linux-x86-64.so.2 7f00a7a75000-7f00a7a77000 rw-p 00031000 fc:05 270939734 /usr/lib64/ld-linux-x86-64.so.2 7ffd63e17000-7ffd64616000 rw-p 00000000 00:00 0 [stack] 7ffd64762000-7ffd64766000 r--p 00000000 00:00 0 [vvar] 7ffd64766000-7ffd64768000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] make: *** [uncommon.mk:1096: encdb.h] Aborted (core dumped) ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: