Project

General

Profile

Actions

Bug #20099

closed

Ruby 3.3.0 segfaults on s390x musl libc (Alpine Linux) when built with -O3 (default optflags)

Added by jirutka (Jakub Jirutka) 11 months ago. Updated 5 months ago.

Status:
Feedback
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
[ruby-core:115937]
Tags:

Description

It does not segfault when I override optflags to -O2 (default is -O3).

Configuration summary for ruby version 3.3.0

   * Installation prefix: /usr
   * exec prefix:         ${prefix}
   * arch:                s390x-linux-musl
   * site arch:           ${arch}
   * RUBY_BASE_NAME:      ruby
   * enable shared:       yes
   * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
   * site libraries path: ${rubylibprefix}/${sitearch}
   * vendor path:         ${rubylibprefix}/vendor_ruby
   * target OS:           linux-musl
   * compiler:            gcc
   * with thread:         pthread
   * with coroutine:      ucontext
   * enable shared libs:  yes
   * dynamic library ext: so
   * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -Wl,--as-needed,-O1,--sort-common \
                          -fstack-protector-strong -rdynamic \
                          -Wl,-export-dynamic -Wl,--no-as-needed
   * DLDFLAGS:            -Wl,--as-needed,-O1,--sort-common \
                          -Wl,--compress-debug-sections=zlib
   * optflags:            -O3 -fno-fast-math
   * debugflags:          -ggdb3
   * warnflags:           -Wall -Wextra -Wdeprecated-declarations \
                          -Wdiv-by-zero -Wduplicated-cond \
                          -Wimplicit-function-declaration -Wimplicit-int \
                          -Wpointer-arith -Wwrite-strings \
                          -Wold-style-definition -Wimplicit-fallthrough=0 \
                          -Wmissing-noreturn -Wno-cast-function-type \
                          -Wno-constant-logical-operand -Wno-long-long \
                          -Wno-missing-field-initializers \
                          -Wno-overlength-strings \
                          -Wno-packed-bitfield-compat \
                          -Wno-parentheses-equality -Wno-self-assign \
                          -Wno-tautological-compare -Wno-unused-parameter \
                          -Wno-unused-value -Wsuggest-attribute=format \
                          -Wsuggest-attribute=noreturn -Wunused-variable \
                          -Wmisleading-indentation -Wundef
   * strip command:       strip -S -x
   * install doc:         rdoc
   * YJIT support:        no
   * RJIT support:        no
   * man page type:       man
   * search path:         /usr/lib/site_ruby/$(ruby_ver)/s390x-linux

---
        BASERUBY = ./tool/missing-baseruby.bat
        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O2 -fstack-clash-protection -Wformat -Werror=format-security -g -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
        XCFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/s390x-linux-musl -I./include -I. -I./prism -I./enc/unicode/15.0.0
        CPPFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing
        DLDFLAGS = -Wl,--as-needed,-O1,--sort-common -Wl,--compress-debug-sections=zlib -Wl,-soname,libruby.so.3.3  -fstack-protector-strong
        SOLIBS = -lz -lrt -lrt -lgmp -ldl -lcrypt -lm -lpthread -lucontext
        LANG =
        LC_ALL =
        LC_CTYPE =
        MFLAGS = -j8 --jobserver-auth=fifo:/tmp/GMfifo7323
        RUSTC = no
        YJIT_RUSTC_ARGS = --crate-name=yjit --crate-type=staticlib --edition=2021 -g -C lto=thin -C opt-level=3 -C overflow-checks=on '--out-dir=/builds/alpine/aports/main/ruby/src/ruby-3.3.0/yjit/target/release/' ./yjit/src/lib.rs
2023-12-26 20:45:17 +0000
Driver is ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
Target is ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]

 ..............................................................................
 ..............................................................................
 ..............................................................................
 ..............................................................................
 ................................................................EA core file is found. Saving it at: "/tmp/bootstraptest-core.2023-12-26T20:45:18Z"
["gdb", "/builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby -I/builds/alpine/aports/main/ruby/src/ruby-3.3.0/lib --disable-gems", "-c", "/tmp/bootstraptest-core.2023-12-26T20:45:18Z", "-ex", "bt", "-batch"]
...EA core file is found. Saving it at: "/tmp/bootstraptest-core.2023-12-26T20:45:19Z"
["gdb", "/builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby -I/builds/alpine/aports/main/ruby/src/ruby-3.3.0/lib --disable-gems", "-c", "/tmp/bootstraptest-core.2023-12-26T20:45:19Z", "-ex", "bt", "-batch"]
.....Fstderr output is not empty
   [BUG] Segmentation fault at 0x000007fece67a000
   ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]

   -- Control frame information -----------------------------------------------
   c:0001 p:---- s:0003 e:000002 DUMMY  [FINISH]


   -- Threading information ---------------------------------------------------
   Total ractor count: 2
   Ruby thread count for this ractor: 1

   -- Other runtime information -----------------------------------------------

   * Loaded script: bootstraptest.test_ractor.rb_244_1238.rb

   * Loaded features:

       0 enumerator.so
       1 thread.rb
       2 fiber.so
       3 rational.so
       4 complex.so
       5 ruby2_keywords.rb
       6 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
       7 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so

   * Process memory map:

   2aa25e00000-2aa25e01000 r-xp 00000000 fe:00 2520910                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
   2aa25e01000-2aa25e02000 r--p 00000000 fe:00 2520910                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
   2aa25e02000-2aa25e03000 rw-p 00001000 fe:00 2520910                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
   2aa2765d000-2aa2765e000 ---p 00000000 00:00 0                            [heap]
   2aa2765e000-2aa27664000 rw-p 00000000 00:00 0                            [heap]
   3ff572a8000-3ff572aa000 ---p 00000000 00:00 0
   3ff572aa000-3ff572d0000 rw-p 00000000 00:00 0
   3ff572d0000-3ff572d2000 ---p 00000000 00:00 0
   3ff572d2000-3ff573f9000 rw-p 00000000 00:00 0
   3ff573f9000-3ff573fa000 ---p 00000000 00:00 0
   3ff573fa000-3ff5751a000 rw-p 00000000 00:00 0
   3ff5751a000-3ff5751b000 ---p 00000000 00:00 0
   3ff5751b000-3ff77300000 rw-p 00000000 00:00 0
   3ff77300000-3ff77302000 r-xp 00000000 fe:00 2520334                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
   3ff77302000-3ff77303000 r--p 00002000 fe:00 2520334                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
   3ff77303000-3ff77304000 rw-p 00003000 fe:00 2520334                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
   3ff77307000-3ff77309000 rw-p 00000000 00:00 0
   3ff7730b000-3ff7730e000 rw-p 00000000 00:00 0
   3ff77310000-3ff77330000 rw-p 00000000 00:00 0
   3ff77332000-3ff77337000 rw-p 00000000 00:00 0
   3ff77339000-3ff7733a000 rw-p 00000000 00:00 0
   3ff7733b000-3ff7733e000 rw-p 00000000 00:00 0
   3ff77340000-3ff77380000 rw-p 00000000 00:00 0
   3ff77380000-3ff77382000 r-xp 00000000 fe:00 2520245                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
   3ff77382000-3ff77383000 r--p 00001000 fe:00 2520245                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
   3ff77383000-3ff77384000 rw-p 00002000 fe:00 2520245                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
   3ff77384000-3ff7739c000 rw-p 00000000 00:00 0
   3ff7739c000-3ff7739d000 ---p 00000000 00:00 0
   3ff7739d000-3ff773de000 rw-p 00000000 00:00 0
   3ff773de000-3ff773df000 ---p 00000000 00:00 0
   3ff773df000-3ff77420000 rw-p 00000000 00:00 0
   3ff77420000-3ff77421000 ---p 00000000 00:00 0
   3ff77421000-3ff77462000 rw-p 00000000 00:00 0
   3ff77462000-3ff77463000 ---p 00000000 00:00 0
   3ff77463000-3ff774a4000 rw-p 00000000 00:00 0
   3ff774a4000-3ff774a5000 ---p 00000000 00:00 0
   3ff774a5000-3ff774e6000 rw-p 00000000 00:00 0
   3ff774e6000-3ff774e7000 ---p 00000000 00:00 0
   3ff774e7000-3ff77528000 rw-p 00000000 00:00 0
   3ff77528000-3ff77529000 ---p 00000000 00:00 0
   3ff77529000-3ff7756a000 rw-p 00000000 00:00 0
   3ff7756a000-3ff7756b000 ---p 00000000 00:00 0
   3ff7756b000-3ff775ac000 rw-p 00000000 00:00 0
   3ff775ac000-3ff775ad000 ---p 00000000 00:00 0
   3ff775ad000-3ff775ee000 rw-p 00000000 00:00 0
   3ff775ee000-3ff775ef000 ---p 00000000 00:00 0
   3ff775ef000-3ff77630000 rw-p 00000000 00:00 0
   3ff77630000-3ff77631000 ---p 00000000 00:00 0
   3ff77631000-3ff77672000 rw-p 00000000 00:00 0
   3ff77672000-3ff77673000 ---p 00000000 00:00 0
   3ff77673000-3ff776b4000 rw-p 00000000 00:00 0
   3ff776b4000-3ff776b5000 ---p 00000000 00:00 0
   3ff776b5000-3ff776f6000 rw-p 00000000 00:00 0
   3ff776f6000-3ff776f7000 ---p 00000000 00:00 0
   3ff776f7000-3ff77738000 rw-p 00000000 00:00 0
   3ff77738000-3ff77739000 ---p 00000000 00:00 0
   3ff77739000-3ff7777a000 rw-p 00000000 00:00 0
   3ff7777a000-3ff7777b000 ---p 00000000 00:00 0
   3ff7777b000-3ff777bc000 rw-p 00000000 00:00 0
   3ff777bc000-3ff777bd000 ---p 00000000 00:00 0
   3ff777bd000-3ff777fe000 rw-p 00000000 00:00 0
   3ff777fe000-3ff777ff000 ---p 00000000 00:00 0
   3ff777ff000-3ff77840000 rw-p 00000000 00:00 0
   3ff77840000-3ff77841000 ---p 00000000 00:00 0
   3ff77841000-3ff77882000 rw-p 00000000 00:00 0
   3ff77882000-3ff77883000 ---p 00000000 00:00 0
   3ff77883000-3ff778c4000 rw-p 00000000 00:00 0
   3ff778c4000-3ff778c5000 ---p 00000000 00:00 0
   3ff778c5000-3ff77906000 rw-p 00000000 00:00 0
   3ff77906000-3ff77907000 ---p 00000000 00:00 0
   3ff77907000-3ff77948000 rw-p 00000000 00:00 0
   3ff77948000-3ff77949000 ---p 00000000 00:00 0
   3ff77949000-3ff7798a000 rw-p 00000000 00:00 0
   3ff7798a000-3ff7798b000 ---p 00000000 00:00 0
   3ff7798b000-3ff779cc000 rw-p 00000000 00:00 0
   3ff779cc000-3ff779cd000 ---p 00000000 00:00 0
   3ff779cd000-3ff77a0e000 rw-p 00000000 00:00 0
   3ff77a0e000-3ff77a0f000 ---p 00000000 00:00 0
   3ff77a0f000-3ff77a50000 rw-p 00000000 00:00 0
   3ff77a50000-3ff77a51000 ---p 00000000 00:00 0
   3ff77a51000-3ff77a92000 rw-p 00000000 00:00 0
   3ff77a92000-3ff77a93000 ---p 00000000 00:00 0
   3ff77a93000-3ff77ad4000 rw-p 00000000 00:00 0
   3ff77ad4000-3ff77ad5000 ---p 00000000 00:00 0
   3ff77ad5000-3ff77b16000 rw-p 00000000 00:00 0
   3ff77b16000-3ff77b17000 ---p 00000000 00:00 0
   3ff77b17000-3ff77b58000 rw-p 00000000 00:00 0
   3ff77b58000-3ff77b59000 ---p 00000000 00:00 0
   3ff77b59000-3ff77b9a000 rw-p 00000000 00:00 0
   3ff77b9a000-3ff77b9b000 ---p 00000000 00:00 0
   3ff77b9b000-3ff77bdc000 rw-p 00000000 00:00 0
   3ff77bdc000-3ff77bde000 ---p 00000000 00:00 0
   3ff77bde000-3ff91100000 rw-p 00000000 00:00 0
   3ff91100000-3ff91101000 r-xp 00000000 fe:00 2758431                      /lib/libucontext.so.1
   3ff91101000-3ff91102000 r--p 00000000 fe:00 2758431                      /lib/libucontext.so.1
   3ff91102000-3ff91103000 rw-p 00001000 fe:00 2758431                      /lib/libucontext.so.1
   3ff91103000-3ff9114b000 rw-p 00000000 00:00 0
   3ff9114f000-3ff91153000 rw-p 00000000 00:00 0
   3ff91155000-3ff91180000 rw-p 00000000 00:00 0
   3ff91180000-3ff911fd000 r-xp 00000000 fe:00 2755903                      /usr/lib/libgmp.so.10.5.0
   3ff911fd000-3ff911ff000 r--p 0007c000 fe:00 2755903                      /usr/lib/libgmp.so.10.5.0
   3ff911ff000-3ff91200000 rw-p 0007e000 fe:00 2755903                      /usr/lib/libgmp.so.10.5.0
   3ff91200000-3ff91219000 r-xp 00000000 fe:00 2754145                      /lib/libz.so.1.3
   3ff91219000-3ff9121a000 r--p 00018000 fe:00 2754145                      /lib/libz.so.1.3
   3ff9121a000-3ff9121b000 rw-p 00019000 fe:00 2754145                      /lib/libz.so.1.3
   3ff9121b000-3ff91280000 rw-p 00000000 00:00 0
   3ff91280000-3ff91700000 r-xp 00000000 fe:00 2519847                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
   3ff91700000-3ff9170c000 r--p 00480000 fe:00 2519847                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
   3ff9170c000-3ff9170d000 rw-p 0048c000 fe:00 2519847                      /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
   3ff9170d000-3ff9171f000 rw-p 00000000 00:00 0
   3ff9171f000-3ff91780000 rw-p 00000000 00:00 0
   3ff91780000-3ff91830000 r-xp 00000000 fe:00 2758095                      /lib/ld-musl-s390x.so.1
   3ff91830000-3ff91831000 r--p 000b0000 fe:00 2758095                      /lib/ld-musl-s390x.so.1
   3ff91831000-3ff91832000 rw-p 000b1000 fe:00 2758095                      /lib/ld-musl-s390x.so.1
   3ff91832000-3ff91835000 rw-p 00000000 00:00 0
   3ff91835000-3ff9187c000 rw-p 00000000 00:00 0
   3ff9187c000-3ff9187e000 r--p 00000000 00:00 0                            [vvar]
   3ff9187e000-3ff91880000 r-xp 00000000 00:00 0                            [vdso]
   3ffe2381000-3ffe2b80000 rw-p 00000000 00:00 0                            [stack]

…and many more tests fail like this.

Build script: APKBUILD

Environment:


Files

ruby-3.3.0-s390x.log (281 KB) ruby-3.3.0-s390x.log full log jirutka (Jakub Jirutka), 12/27/2023 04:26 PM
Actions #1

Updated by jirutka (Jakub Jirutka) 11 months ago

  • ruby -v changed from 3.3.0 to ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
Actions #2

Updated by jirutka (Jakub Jirutka) 11 months ago

  • Description updated (diff)
Actions #3

Updated by jirutka (Jakub Jirutka) 11 months ago

  • Description updated (diff)
Actions #4

Updated by jirutka (Jakub Jirutka) 11 months ago

  • Subject changed from Ruby 3.3.0 segfaults on s390x musl libc (Alpine Linux) to Ruby 3.3.0 segfaults on s390x musl libc (Alpine Linux) when built with -O3 (default optflags)
  • Description updated (diff)
Actions #5

Updated by hsbt (Hiroshi SHIBATA) 8 months ago

  • Tags set to musl, alpine

Updated by hsbt (Hiroshi SHIBATA) 8 months ago

  • Status changed from Open to Closed

Unfortunately, there is no active maintainer for musl or alpine platform.

I tagged them to musl. We welcome patch for them.

Actions #7

Updated by mame (Yusuke Endoh) 8 months ago

  • Status changed from Closed to Feedback

Updated by haukot (Dmitry Davydov) 5 months ago · Edited

I've tried to reproduce the bug on Linux One s390x machine(using docker image alpinelinux/alpine-gitlab-ci with ruby 3.3.0 and 3.3.3) and tests succeeded without fault.

The build with -O3 succeed also(https://gitlab.alpinelinux.org/haukot/aports/-/jobs/1438816). Seems the bug is fixed now.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0