Bug #17949
closed[SOLARIS11, SPARC, SEGFAULT] generating encdb.h
Description
The same latest Solaris 11 and ruby, next crash while compiling:
$ gmake ... ... compiling time.c compiling version.c compiling vm.c compiling vm_trace.c compiling coroutine/ucontext/Context.c compiling enc/trans/newline.c linking miniruby ./revision.h unchanged generating encdb.h /export/home/cddr/ruby/lib/cgi/util.rb:61: [BUG] Segmentation fault at 0x0000000000000000 ruby 3.1.0dev (2021-06-11) [sparc-solaris2.11] -- Control frame information ----------------------------------------------- c:0008 p:---- s:0042 e:000041 CFUNC :require c:0007 p:0031 s:0037 e:000036 CLASS /export/home/cddr/ruby/lib/cgi/util.rb:61 c:0006 p:0022 s:0034 e:000033 TOP /export/home/cddr/ruby/lib/cgi/util.rb:7 [FINISH] c:0005 p:---- s:0031 e:000030 CFUNC :require c:0004 p:0005 s:0026 e:000025 TOP /export/home/cddr/ruby/lib/erb.rb:15 [FINISH] c:0003 p:---- s:0023 e:000022 CFUNC :require c:0002 p:0005 s:0018 E:000e10 EVAL ./tool/generic_erb.rb:6 [FINISH] c:0001 p:0000 s:0003 E:002700 (none) [FINISH] -- Ruby level backtrace information ---------------------------------------- ./tool/generic_erb.rb:6:in `<main>' ./tool/generic_erb.rb:6:in `require' /export/home/cddr/ruby/lib/erb.rb:15:in `<top (required)>' /export/home/cddr/ruby/lib/erb.rb:15:in `require' /export/home/cddr/ruby/lib/cgi/util.rb:7:in `<top (required)>' /export/home/cddr/ruby/lib/cgi/util.rb:61:in `<module:Util>' /export/home/cddr/ruby/lib/cgi/util.rb:61:in `require' -- C level backtrace information ------------------------------------------- /export/home/cddr/ruby/miniruby'rb_vm_bugreport+0x154 [0x10045c97c] /export/home/cddr/ruby/miniruby'rb_bug_for_fatal_signal+0x1a8 [0x1001c78b4] /export/home/cddr/ruby/miniruby'sigsegv+0x58 [0x10037f6e0] /lib/sparcv9/libc.so.1'__sighndlr+0xc [0xffffffff7f0dcdac] /lib/sparcv9/libc.so.1'call_user_handler+0x354 [0xffffffff7f0cf79c] /lib/sparcv9/libc.so.1'sigacthandler+0x54 [0xffffffff7f0cfaf4] /export/home/cddr/ruby/miniruby'exc_setup_message+0x88 [0x1001db3cc] /export/home/cddr/ruby/miniruby'rb_longjmp+0x2c [0x1001db32c] /export/home/cddr/ruby/miniruby'rb_exc_exception+0xe8 [0x1001d7a48] /export/home/cddr/ruby/miniruby'rb_exc_raise+0xc [0x1001d7958] /export/home/cddr/ruby/miniruby'raise_loaderror+0x48 [0x1001cd67c] /export/home/cddr/ruby/miniruby'rb_load_fail+0x40 [0x1001ce2c0] /export/home/cddr/ruby/miniruby'load_failed+0x20 [0x10025343c] /export/home/cddr/ruby/miniruby'rb_f_require+0x70 [0x1002538e0] /export/home/cddr/ruby/miniruby'ractor_safe_call_cfunc_1+0x8 [0x100451da8] /export/home/cddr/ruby/miniruby'vm_call_cfunc_with_frame+0x118 [0x10044f760] /export/home/cddr/ruby/miniruby'vm_call_method_each_type+0x3f4 [0x100449218] /export/home/cddr/ruby/miniruby'vm_call_method+0x230 [0x100448da4] /export/home/cddr/ruby/miniruby'vm_call_general+0xc [0x100431fa8] /export/home/cddr/ruby/miniruby'vm_sendish+0x938 [0x100446350] /export/home/cddr/ruby/miniruby'vm_exec_core+0x4830 [0x1004211e0] /export/home/cddr/ruby/miniruby'rb_vm_exec+0xc10 [0x10043fc40] /export/home/cddr/ruby/miniruby'rb_iseq_eval+0x1b4 [0x10043fe80] /export/home/cddr/ruby/miniruby'load_iseq_eval+0xdc [0x100255aa4] /export/home/cddr/ruby/miniruby'require_internal+0x3d8 [0x1002546a0] /export/home/cddr/ruby/miniruby'rb_f_require+0x34 [0x1002538a4] /export/home/cddr/ruby/miniruby'ractor_safe_call_cfunc_1+0x8 [0x100451da8] /export/home/cddr/ruby/miniruby'vm_call_cfunc_with_frame+0x118 [0x10044f760] /export/home/cddr/ruby/miniruby'vm_sendish+0x938 [0x100446350] /export/home/cddr/ruby/miniruby'vm_exec_core+0x4830 [0x1004211e0] /export/home/cddr/ruby/miniruby'rb_vm_exec+0xc10 [0x10043fc40] /export/home/cddr/ruby/miniruby'rb_iseq_eval+0x1b4 [0x10043fe80] /export/home/cddr/ruby/miniruby'load_iseq_eval+0xdc [0x100255aa4] /export/home/cddr/ruby/miniruby'require_internal+0x3d8 [0x1002546a0] /export/home/cddr/ruby/miniruby'rb_f_require+0x34 [0x1002538a4] /export/home/cddr/ruby/miniruby'ractor_safe_call_cfunc_1+0x8 [0x100451da8] /export/home/cddr/ruby/miniruby'vm_call_cfunc_with_frame+0x118 [0x10044f760] /export/home/cddr/ruby/miniruby'vm_call_method_each_type+0x3f4 [0x100449218] /export/home/cddr/ruby/miniruby'vm_call_method+0x230 [0x100448da4] /export/home/cddr/ruby/miniruby'vm_call_general+0xc [0x100431fa8] /export/home/cddr/ruby/miniruby'vm_sendish+0x938 [0x100446350] /export/home/cddr/ruby/miniruby'vm_exec_core+0x4830 [0x1004211e0] /export/home/cddr/ruby/miniruby'rb_vm_exec+0xc10 [0x10043fc40] /export/home/cddr/ruby/miniruby'rb_iseq_eval_main+0x278 [0x100440134] /export/home/cddr/ruby/miniruby'rb_ec_exec_node+0x170 [0x1001d7340] /export/home/cddr/ruby/miniruby'ruby_run_node+0x94 [0x1001d7168] /export/home/cddr/ruby/miniruby'main+0x84 [0x1000f28f8] /export/home/cddr/ruby/miniruby'_start+0x64 [0x1000f26a4] -- Other runtime information ----------------------------------------------- * Loaded script: ./tool/generic_erb.rb * Loaded features: 0 enumerator.so 1 thread.rb 2 fiber.so 3 rational.so 4 complex.so 5 ruby2_keywords.rb gmake: *** [Makefile:1789: encdb.h] Abort (core dumped) $ Files
Updated by tankf33der (Mike P) over 4 years ago
The simplest way to crash miniruby is exec and press Ctrl-D inside it as input.
Updated by xtkoba (Tee KOBAYASHI) over 4 years ago
From #17947 I guess that Clang/LLVM is used as the compiler. There are some possible workarounds that I can think of, from my experience with Clang/LLVM and setjmp/longjmp.
-
__builtin_setjmpis enabled forsparc-sun-solaristarget by default. It can be sometimes troublesome (#14480#note-15). Tell the configure script not to use it:./configure ac_cv_func___builtin_setjmp=no -
It is known that older versions of Clang/LLVM sometimes produces buggy codes around (non-builtin)
setjmpwhen optimizations are enabled. See https://reviews.llvm.org/D77767 for example. Check whether./configure optflags=-O0 ac_cv_func___builtin_setjmp=noworks. -
To workaround the previous bug and simultaneously enable optimizations, add the statement
VAR_FROM_MEMORY(var);for each local variablevarof which the value is read after the second return (bylongjmp) ofsetjmp. This statement must be placed after the second return ofsetjmpand before read. A sample patch is attached for that. Then see if./configure ac_cv_func___builtin_setjmp=noworks.
Updated by tankf33der (Mike P) over 4 years ago
You were right, this is llvm's issue.
Ruby successfully passed all tests under GCC on Solaris SPARC.
... ... PASS all 1488 tests exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./bootstraptest/runner.rb" --ruby="ruby --disable-gems" ./KNOWNBUGS.rb 2021-06-13 09:29:28 +0300 Driver is ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [sparc-solaris2.11] Target is ruby 3.1.0dev (2021-06-10T23:31:51Z master 9210f8df7f) [sparc-solaris2.11] KNOWNBUGS.rb PASS 0 No tests, no problem test succeeded $
Updated by tankf33der (Mike P) over 4 years ago
Please disable default clang-llvm selection by default on Solaris.
All tests above passed with CC=gcc ./configure --enable-shared --disable-rpath.
Updated by tankf33der (Mike P) over 4 years ago
I believe this issue could be closed.
Fix already in the tree:
https://github.com/ruby/ruby/commit/90cad6e14745d812f042df61a6455db022be7389
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
- Status changed from Open to Closed
Updated by xtkoba (Tee KOBAYASHI) about 4 years ago
Just FTR, Clang/LLVM __builtin_longjmp is broken for Sparc targets: https://bugs.llvm.org/show_bug.cgi?id=51489