ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
@ 2021-01-26  8:55 yoshiokatsuneo
  2021-01-26  9:00 ` [ruby-core:102250] " yoshiokatsuneo
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: yoshiokatsuneo @ 2021-01-26  8:55 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been reported by yoshiokatsuneo (Tsuneo Yoshioka).

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.0
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
``` ruby
$ RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''  
```
Output:
```
root@158c25395b8b:/# RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000018
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-2232118 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:001ae0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9e79c88990 RBP: 0x00007ffce03464c0 RSP: 0x00007ffce03463e0
 RAX: 0x0000000000000000 RBX: 0x00007f9e79dde148 RCX: 0x0000000000000000
 RDX: 0x0000000001048020 RDI: 0x00000000010a03b0 RSI: 0x000000000000755b
  R8: 0x77f6cd17bb094f82  R9: 0x00000000010a3fc0 R10: 0x0000000000000006
 R11: 0x70df9a48ab1d93ce R12: 0x00000000010a03b0 R13: 0x0000000000000001
 R14: 0x000000000000755b R15: 0x0000000001048020 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9e79cbd33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9e79ae1d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9e79c16e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9e799c43c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_const_set+0x90) [0x7f9e79c88990] variable.c:3020
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(set_encoding_const+0xa1) [0x7f9e79acab21] encoding.c:1832
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_multi_ractor_p+0x0) [0x7f9e79acb6ad] encoding.c:591
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_lock_leave) ./vm_sync.h:93
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:614
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9e799fc731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9e79a36588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9e79ca6b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9e79b465ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9e79b46845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9e79cca3a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9e79c0f2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9e79aec862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00fe6000-01145000 rw-p 00000000 00:00 0                                  [heap]
7f9e72b18000-7f9e73baa000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9e73baa000-7f9e73d9a000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e73d9a000-7f9e7400e000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9e7400e000-7f9e74035000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e74035000-7f9e7480d000 rw-p 00000000 00:00 0 
7f9e7480d000-7f9e7508b000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e7508b000-7f9e7508e000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e7508e000-7f9e750a0000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a0000-7f9e750a4000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a4000-7f9e750a5000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a5000-7f9e750a6000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750b8000-7f9e750b9000 ---p 00000000 00:00 0 
7f9e750b9000-7f9e7515a000 rw-p 00000000 00:00 0 
7f9e7515a000-7f9e7515b000 ---p 00000000 00:00 0 
7f9e7515b000-7f9e751fc000 rw-p 00000000 00:00 0 
7f9e751fc000-7f9e751fd000 ---p 00000000 00:00 0 
7f9e751fd000-7f9e7529e000 rw-p 00000000 00:00 0 
7f9e7529e000-7f9e7529f000 ---p 00000000 00:00 0 
7f9e7529f000-7f9e75340000 rw-p 00000000 00:00 0 
7f9e75340000-7f9e75341000 ---p 00000000 00:00 0 
7f9e75341000-7f9e753e2000 rw-p 00000000 00:00 0 
7f9e753e2000-7f9e753e3000 ---p 00000000 00:00 0 
7f9e753e3000-7f9e75484000 rw-p 00000000 00:00 0 
7f9e75484000-7f9e75485000 ---p 00000000 00:00 0 
7f9e75485000-7f9e75526000 rw-p 00000000 00:00 0 
7f9e75526000-7f9e75527000 ---p 00000000 00:00 0 
7f9e75527000-7f9e755c8000 rw-p 00000000 00:00 0 
7f9e755c8000-7f9e755c9000 ---p 00000000 00:00 0 
7f9e755c9000-7f9e7566a000 rw-p 00000000 00:00 0 
7f9e7566a000-7f9e7566b000 ---p 00000000 00:00 0 
7f9e7566b000-7f9e7570c000 rw-p 00000000 00:00 0 
7f9e7570c000-7f9e7570d000 ---p 00000000 00:00 0 
7f9e7570d000-7f9e757ae000 rw-p 00000000 00:00 0 
7f9e757ae000-7f9e757af000 ---p 00000000 00:00 0 
7f9e757af000-7f9e75850000 rw-p 00000000 00:00 0 
7f9e75850000-7f9e75851000 ---p 00000000 00:00 0 
7f9e75851000-7f9e758f2000 rw-p 00000000 00:00 0 
7f9e758f2000-7f9e758f3000 ---p 00000000 00:00 0 
7f9e758f3000-7f9e75994000 rw-p 00000000 00:00 0 
7f9e75994000-7f9e75995000 ---p 00000000 00:00 0 
7f9e75995000-7f9e75a36000 rw-p 00000000 00:00 0 
7f9e75a36000-7f9e75a37000 ---p 00000000 00:00 0 
7f9e75a37000-7f9e75ad8000 rw-p 00000000 00:00 0 
7f9e75ad8000-7f9e75ad9000 ---p 00000000 00:00 0 
7f9e75ad9000-7f9e75b7a000 rw-p 00000000 00:00 0 
7f9e75b7a000-7f9e75b7b000 ---p 00000000 00:00 0 
7f9e75b7b000-7f9e75c1c000 rw-p 00000000 00:00 0 
7f9e75c1c000-7f9e75c1d000 ---p 00000000 00:00 0 
7f9e75c1d000-7f9e75cbe000 rw-p 00000000 00:00 0 
7f9e75cbe000-7f9e75cbf000 ---p 00000000 00:00 0 
7f9e75cbf000-7f9e75d60000 rw-p 00000000 00:00 0 
7f9e75d60000-7f9e75d61000 ---p 00000000 00:00 0 
7f9e75d61000-7f9e75e02000 rw-p 00000000 00:00 0 
7f9e75e02000-7f9e75e03000 ---p 00000000 00:00 0 
7f9e75e03000-7f9e75ea4000 rw-p 00000000 00:00 0 
7f9e75ea4000-7f9e75ea5000 ---p 00000000 00:00 0 
7f9e75ea5000-7f9e75f46000 rw-p 00000000 00:00 0 
7f9e75f46000-7f9e75f47000 ---p 00000000 00:00 0 
7f9e75f47000-7f9e75fe8000 rw-p 00000000 00:00 0 
7f9e75fe8000-7f9e75fe9000 ---p 00000000 00:00 0 
7f9e75fe9000-7f9e7608a000 rw-p 00000000 00:00 0 
7f9e7608a000-7f9e7608b000 ---p 00000000 00:00 0 
7f9e7608b000-7f9e7612c000 rw-p 00000000 00:00 0 
7f9e7612c000-7f9e7612d000 ---p 00000000 00:00 0 
7f9e7612d000-7f9e761ce000 rw-p 00000000 00:00 0 
7f9e761ce000-7f9e761cf000 ---p 00000000 00:00 0 
7f9e761cf000-7f9e76270000 rw-p 00000000 00:00 0 
7f9e76270000-7f9e76271000 ---p 00000000 00:00 0 
7f9e76271000-7f9e76312000 rw-p 00000000 00:00 0 
7f9e76312000-7f9e76313000 ---p 00000000 00:00 0 
7f9e76313000-7f9e763b4000 rw-p 00000000 00:00 0 
7f9e763b4000-7f9e763b5000 ---p 00000000 00:00 0 
7f9e763b5000-7f9e76456000 rw-p 00000000 00:00 0 
7f9e76456000-7f9e76457000 ---p 00000000 00:00 0 
7f9e76457000-7f9e7959c000 rw-p 00000000 00:00 0 
7f9e7959c000-7f9e795c1000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e795c1000-7f9e79739000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79739000-7f9e79783000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79783000-7f9e79784000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79784000-7f9e79787000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79787000-7f9e7978a000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e7978a000-7f9e7978e000 rw-p 00000000 00:00 0 
7f9e7978e000-7f9e7979d000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e7979d000-7f9e79844000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e79844000-7f9e798db000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798db000-7f9e798dc000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798dc000-7f9e798dd000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798dd000-7f9e798df000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e798df000-7f9e798f4000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e798f4000-7f9e7990e000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e7990e000-7f9e7990f000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e7990f000-7f9e79910000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e79910000-7f9e7991a000 rw-p 00000000 00:00 0 
7f9e7991a000-7f9e7991b000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991b000-7f9e7991d000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991d000-7f9e7991e000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991e000-7f9e7991f000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991f000-7f9e79920000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e79920000-7f9e7992a000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e7992a000-7f9e7998a000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e7998a000-7f9e799a1000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a1000-7f9e799a2000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a2000-7f9e799a3000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a3000-7f9e799a4000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a4000-7f9e799a7000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799a7000-7f9e799ab000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ab000-7f9e799ac000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ac000-7f9e799ad000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ad000-7f9e799ae000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ae000-7f9e799af000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799af000-7f9e799b6000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799b6000-7f9e799c7000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799c7000-7f9e799cc000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799cc000-7f9e799cd000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799cd000-7f9e799ce000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799ce000-7f9e799d2000 rw-p 00000000 00:00 0 
7f9e799d2000-7f9e799d4000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799d4000-7f9e799e5000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799e5000-7f9e799eb000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799eb000-7f9e799ec000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799ec000-7f9e799ed000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799ed000-7f9e799ee000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799f1000-7f9e799f6000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799f6000-7f9e799fb000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9e799fb000-7f9e799fc000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fc000-7f9e799fd000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fd000-7f9e799fe000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fe000-7f9e799ff000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799ff000-7f9e79a00000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e79a00000-7f9e79a31000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79a31000-7f9e79ccb000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79ccb000-7f9e79dc3000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dc3000-7f9e79dc4000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dc4000-7f9e79dcb000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dcb000-7f9e79dce000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dce000-7f9e79de1000 rw-p 00000000 00:00 0 
7f9e79de1000-7f9e79de2000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79de2000-7f9e79e05000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e05000-7f9e79e0d000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e0e000-7f9e79e0f000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e0f000-7f9e79e10000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e10000-7f9e79e11000 rw-p 00000000 00:00 0 
7ffca32bb000-7ffce034a000 rw-p 00000000 00:00 0                          [stack]
7ffce0356000-7ffce0359000 r--p 00000000 00:00 0                          [vvar]
7ffce0359000-7ffce035b000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102250] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
@ 2021-01-26  9:00 ` yoshiokatsuneo
  2021-01-26  9:04 ` [ruby-core:102251] " yoshiokatsuneo
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: yoshiokatsuneo @ 2021-01-26  9:00 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by yoshiokatsuneo (Tsuneo Yoshioka).


When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:

```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e '' 
```

Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-2766646 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:000c20 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007fc3de65d143 RBP: 0x0000000000000051 RSP: 0x00007ffdac426a98
 RAX: 0x0000000000000000 RBX: 0x00000000014b7f98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x00000000014b7f98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xf95d6d83628903f1 R10: 0x0000000000000000
 R11: 0x5187b4751a88ebbd R12: 0x00000000015231d0 R13: 0x0000000001453f00
 R14: 0x00000000014b7f98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7fc3de8a833f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7fc3de6ccd73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7fc3de801e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7fc3de5af3c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7fc3de65d143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7fc3de76d934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7fc3de6b59ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7fc3de6b6605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7fc3de5e7731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7fc3de621588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7fc3de891b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7fc3de7315ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7fc3de731845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7fc3de8b53a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7fc3de7fa2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7fc3de6d7862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
013fa000-01559000 rw-p 00000000 00:00 0                                  [heap]
7fc3d7703000-7fc3d8795000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7fc3d8795000-7fc3d8985000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3d8985000-7fc3d8bf9000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7fc3d8bf9000-7fc3d8c20000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3d8c20000-7fc3d93f8000 rw-p 00000000 00:00 0 
7fc3d93f8000-7fc3d9c76000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3d9c76000-7fc3d9c79000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c79000-7fc3d9c8b000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c8b000-7fc3d9c8f000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c8f000-7fc3d9c90000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c90000-7fc3d9c91000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9ca3000-7fc3d9ca4000 ---p 00000000 00:00 0 
7fc3d9ca4000-7fc3d9d45000 rw-p 00000000 00:00 0 
7fc3d9d45000-7fc3d9d46000 ---p 00000000 00:00 0 
7fc3d9d46000-7fc3d9de7000 rw-p 00000000 00:00 0 
7fc3d9de7000-7fc3d9de8000 ---p 00000000 00:00 0 
7fc3d9de8000-7fc3d9e89000 rw-p 00000000 00:00 0 
7fc3d9e89000-7fc3d9e8a000 ---p 00000000 00:00 0 
7fc3d9e8a000-7fc3d9f2b000 rw-p 00000000 00:00 0 
7fc3d9f2b000-7fc3d9f2c000 ---p 00000000 00:00 0 
7fc3d9f2c000-7fc3d9fcd000 rw-p 00000000 00:00 0 
7fc3d9fcd000-7fc3d9fce000 ---p 00000000 00:00 0 
7fc3d9fce000-7fc3da06f000 rw-p 00000000 00:00 0 
7fc3da06f000-7fc3da070000 ---p 00000000 00:00 0 
7fc3da070000-7fc3da111000 rw-p 00000000 00:00 0 
7fc3da111000-7fc3da112000 ---p 00000000 00:00 0 
7fc3da112000-7fc3da1b3000 rw-p 00000000 00:00 0 
7fc3da1b3000-7fc3da1b4000 ---p 00000000 00:00 0 
7fc3da1b4000-7fc3da255000 rw-p 00000000 00:00 0 
7fc3da255000-7fc3da256000 ---p 00000000 00:00 0 
7fc3da256000-7fc3da2f7000 rw-p 00000000 00:00 0 
7fc3da2f7000-7fc3da2f8000 ---p 00000000 00:00 0 
7fc3da2f8000-7fc3da399000 rw-p 00000000 00:00 0 
7fc3da399000-7fc3da39a000 ---p 00000000 00:00 0 
7fc3da39a000-7fc3da43b000 rw-p 00000000 00:00 0 
7fc3da43b000-7fc3da43c000 ---p 00000000 00:00 0 
7fc3da43c000-7fc3da4dd000 rw-p 00000000 00:00 0 
7fc3da4dd000-7fc3da4de000 ---p 00000000 00:00 0 
7fc3da4de000-7fc3da57f000 rw-p 00000000 00:00 0 
7fc3da57f000-7fc3da580000 ---p 00000000 00:00 0 
7fc3da580000-7fc3da621000 rw-p 00000000 00:00 0 
7fc3da621000-7fc3da622000 ---p 00000000 00:00 0 
7fc3da622000-7fc3da6c3000 rw-p 00000000 00:00 0 
7fc3da6c3000-7fc3da6c4000 ---p 00000000 00:00 0 
7fc3da6c4000-7fc3da765000 rw-p 00000000 00:00 0 
7fc3da765000-7fc3da766000 ---p 00000000 00:00 0 
7fc3da766000-7fc3da807000 rw-p 00000000 00:00 0 
7fc3da807000-7fc3da808000 ---p 00000000 00:00 0 
7fc3da808000-7fc3da8a9000 rw-p 00000000 00:00 0 
7fc3da8a9000-7fc3da8aa000 ---p 00000000 00:00 0 
7fc3da8aa000-7fc3da94b000 rw-p 00000000 00:00 0 
7fc3da94b000-7fc3da94c000 ---p 00000000 00:00 0 
7fc3da94c000-7fc3da9ed000 rw-p 00000000 00:00 0 
7fc3da9ed000-7fc3da9ee000 ---p 00000000 00:00 0 
7fc3da9ee000-7fc3daa8f000 rw-p 00000000 00:00 0 
7fc3daa8f000-7fc3daa90000 ---p 00000000 00:00 0 
7fc3daa90000-7fc3dab31000 rw-p 00000000 00:00 0 
7fc3dab31000-7fc3dab32000 ---p 00000000 00:00 0 
7fc3dab32000-7fc3dabd3000 rw-p 00000000 00:00 0 
7fc3dabd3000-7fc3dabd4000 ---p 00000000 00:00 0 
7fc3dabd4000-7fc3dac75000 rw-p 00000000 00:00 0 
7fc3dac75000-7fc3dac76000 ---p 00000000 00:00 0 
7fc3dac76000-7fc3dad17000 rw-p 00000000 00:00 0 
7fc3dad17000-7fc3dad18000 ---p 00000000 00:00 0 
7fc3dad18000-7fc3dadb9000 rw-p 00000000 00:00 0 
7fc3dadb9000-7fc3dadba000 ---p 00000000 00:00 0 
7fc3dadba000-7fc3dae5b000 rw-p 00000000 00:00 0 
7fc3dae5b000-7fc3dae5c000 ---p 00000000 00:00 0 
7fc3dae5c000-7fc3daefd000 rw-p 00000000 00:00 0 
7fc3daefd000-7fc3daefe000 ---p 00000000 00:00 0 
7fc3daefe000-7fc3daf9f000 rw-p 00000000 00:00 0 
7fc3daf9f000-7fc3dafa0000 ---p 00000000 00:00 0 
7fc3dafa0000-7fc3db041000 rw-p 00000000 00:00 0 
7fc3db041000-7fc3db042000 ---p 00000000 00:00 0 
7fc3db042000-7fc3de187000 rw-p 00000000 00:00 0 
7fc3de187000-7fc3de1ac000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de1ac000-7fc3de324000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de324000-7fc3de36e000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de36e000-7fc3de36f000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de36f000-7fc3de372000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de372000-7fc3de375000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de375000-7fc3de379000 rw-p 00000000 00:00 0 
7fc3de379000-7fc3de388000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de388000-7fc3de42f000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de42f000-7fc3de4c6000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c6000-7fc3de4c7000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c7000-7fc3de4c8000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c8000-7fc3de4ca000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4ca000-7fc3de4df000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4df000-7fc3de4f9000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4f9000-7fc3de4fa000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4fa000-7fc3de4fb000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4fb000-7fc3de505000 rw-p 00000000 00:00 0 
7fc3de505000-7fc3de506000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de506000-7fc3de508000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de508000-7fc3de509000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de509000-7fc3de50a000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de50a000-7fc3de50b000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de50b000-7fc3de515000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de515000-7fc3de575000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de575000-7fc3de58c000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58c000-7fc3de58d000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58d000-7fc3de58e000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58e000-7fc3de58f000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58f000-7fc3de592000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de592000-7fc3de596000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de596000-7fc3de597000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de597000-7fc3de598000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de598000-7fc3de599000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de599000-7fc3de59a000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de59a000-7fc3de5a1000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5a1000-7fc3de5b2000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b2000-7fc3de5b7000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b7000-7fc3de5b8000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b8000-7fc3de5b9000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b9000-7fc3de5bd000 rw-p 00000000 00:00 0 
7fc3de5bd000-7fc3de5bf000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5bf000-7fc3de5d0000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d0000-7fc3de5d6000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d6000-7fc3de5d7000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d7000-7fc3de5d8000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d8000-7fc3de5d9000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5dc000-7fc3de5e1000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e1000-7fc3de5e6000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7fc3de5e6000-7fc3de5e7000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e7000-7fc3de5e8000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e8000-7fc3de5e9000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e9000-7fc3de5ea000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5ea000-7fc3de5eb000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5eb000-7fc3de61c000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de61c000-7fc3de8b6000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de8b6000-7fc3de9ae000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9ae000-7fc3de9af000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9af000-7fc3de9b6000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9b6000-7fc3de9b9000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9b9000-7fc3de9cc000 rw-p 00000000 00:00 0 
7fc3de9cc000-7fc3de9cd000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9cd000-7fc3de9f0000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9f0000-7fc3de9f8000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9f9000-7fc3de9fa000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9fa000-7fc3de9fb000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9fb000-7fc3de9fc000 rw-p 00000000 00:00 0 
7ffd6f39a000-7ffdac429000 rw-p 00000000 00:00 0                          [stack]
7ffdac5ef000-7ffdac5f2000 r--p 00000000 00:00 0                          [vvar]
7ffdac5f2000-7ffdac5f4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted
root@158c25395b8b:/# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```

I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .



----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90102

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
``` ruby
$ RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''  
```
Output:
```
root@158c25395b8b:/# RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000018
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-2232118 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:001ae0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9e79c88990 RBP: 0x00007ffce03464c0 RSP: 0x00007ffce03463e0
 RAX: 0x0000000000000000 RBX: 0x00007f9e79dde148 RCX: 0x0000000000000000
 RDX: 0x0000000001048020 RDI: 0x00000000010a03b0 RSI: 0x000000000000755b
  R8: 0x77f6cd17bb094f82  R9: 0x00000000010a3fc0 R10: 0x0000000000000006
 R11: 0x70df9a48ab1d93ce R12: 0x00000000010a03b0 R13: 0x0000000000000001
 R14: 0x000000000000755b R15: 0x0000000001048020 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9e79cbd33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9e79ae1d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9e79c16e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9e799c43c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_const_set+0x90) [0x7f9e79c88990] variable.c:3020
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(set_encoding_const+0xa1) [0x7f9e79acab21] encoding.c:1832
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_multi_ractor_p+0x0) [0x7f9e79acb6ad] encoding.c:591
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_lock_leave) ./vm_sync.h:93
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:614
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9e799fc731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9e79a36588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9e79ca6b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9e79b465ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9e79b46845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9e79cca3a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9e79c0f2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9e79aec862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00fe6000-01145000 rw-p 00000000 00:00 0                                  [heap]
7f9e72b18000-7f9e73baa000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9e73baa000-7f9e73d9a000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e73d9a000-7f9e7400e000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9e7400e000-7f9e74035000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e74035000-7f9e7480d000 rw-p 00000000 00:00 0 
7f9e7480d000-7f9e7508b000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e7508b000-7f9e7508e000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e7508e000-7f9e750a0000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a0000-7f9e750a4000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a4000-7f9e750a5000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750a5000-7f9e750a6000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9e750b8000-7f9e750b9000 ---p 00000000 00:00 0 
7f9e750b9000-7f9e7515a000 rw-p 00000000 00:00 0 
7f9e7515a000-7f9e7515b000 ---p 00000000 00:00 0 
7f9e7515b000-7f9e751fc000 rw-p 00000000 00:00 0 
7f9e751fc000-7f9e751fd000 ---p 00000000 00:00 0 
7f9e751fd000-7f9e7529e000 rw-p 00000000 00:00 0 
7f9e7529e000-7f9e7529f000 ---p 00000000 00:00 0 
7f9e7529f000-7f9e75340000 rw-p 00000000 00:00 0 
7f9e75340000-7f9e75341000 ---p 00000000 00:00 0 
7f9e75341000-7f9e753e2000 rw-p 00000000 00:00 0 
7f9e753e2000-7f9e753e3000 ---p 00000000 00:00 0 
7f9e753e3000-7f9e75484000 rw-p 00000000 00:00 0 
7f9e75484000-7f9e75485000 ---p 00000000 00:00 0 
7f9e75485000-7f9e75526000 rw-p 00000000 00:00 0 
7f9e75526000-7f9e75527000 ---p 00000000 00:00 0 
7f9e75527000-7f9e755c8000 rw-p 00000000 00:00 0 
7f9e755c8000-7f9e755c9000 ---p 00000000 00:00 0 
7f9e755c9000-7f9e7566a000 rw-p 00000000 00:00 0 
7f9e7566a000-7f9e7566b000 ---p 00000000 00:00 0 
7f9e7566b000-7f9e7570c000 rw-p 00000000 00:00 0 
7f9e7570c000-7f9e7570d000 ---p 00000000 00:00 0 
7f9e7570d000-7f9e757ae000 rw-p 00000000 00:00 0 
7f9e757ae000-7f9e757af000 ---p 00000000 00:00 0 
7f9e757af000-7f9e75850000 rw-p 00000000 00:00 0 
7f9e75850000-7f9e75851000 ---p 00000000 00:00 0 
7f9e75851000-7f9e758f2000 rw-p 00000000 00:00 0 
7f9e758f2000-7f9e758f3000 ---p 00000000 00:00 0 
7f9e758f3000-7f9e75994000 rw-p 00000000 00:00 0 
7f9e75994000-7f9e75995000 ---p 00000000 00:00 0 
7f9e75995000-7f9e75a36000 rw-p 00000000 00:00 0 
7f9e75a36000-7f9e75a37000 ---p 00000000 00:00 0 
7f9e75a37000-7f9e75ad8000 rw-p 00000000 00:00 0 
7f9e75ad8000-7f9e75ad9000 ---p 00000000 00:00 0 
7f9e75ad9000-7f9e75b7a000 rw-p 00000000 00:00 0 
7f9e75b7a000-7f9e75b7b000 ---p 00000000 00:00 0 
7f9e75b7b000-7f9e75c1c000 rw-p 00000000 00:00 0 
7f9e75c1c000-7f9e75c1d000 ---p 00000000 00:00 0 
7f9e75c1d000-7f9e75cbe000 rw-p 00000000 00:00 0 
7f9e75cbe000-7f9e75cbf000 ---p 00000000 00:00 0 
7f9e75cbf000-7f9e75d60000 rw-p 00000000 00:00 0 
7f9e75d60000-7f9e75d61000 ---p 00000000 00:00 0 
7f9e75d61000-7f9e75e02000 rw-p 00000000 00:00 0 
7f9e75e02000-7f9e75e03000 ---p 00000000 00:00 0 
7f9e75e03000-7f9e75ea4000 rw-p 00000000 00:00 0 
7f9e75ea4000-7f9e75ea5000 ---p 00000000 00:00 0 
7f9e75ea5000-7f9e75f46000 rw-p 00000000 00:00 0 
7f9e75f46000-7f9e75f47000 ---p 00000000 00:00 0 
7f9e75f47000-7f9e75fe8000 rw-p 00000000 00:00 0 
7f9e75fe8000-7f9e75fe9000 ---p 00000000 00:00 0 
7f9e75fe9000-7f9e7608a000 rw-p 00000000 00:00 0 
7f9e7608a000-7f9e7608b000 ---p 00000000 00:00 0 
7f9e7608b000-7f9e7612c000 rw-p 00000000 00:00 0 
7f9e7612c000-7f9e7612d000 ---p 00000000 00:00 0 
7f9e7612d000-7f9e761ce000 rw-p 00000000 00:00 0 
7f9e761ce000-7f9e761cf000 ---p 00000000 00:00 0 
7f9e761cf000-7f9e76270000 rw-p 00000000 00:00 0 
7f9e76270000-7f9e76271000 ---p 00000000 00:00 0 
7f9e76271000-7f9e76312000 rw-p 00000000 00:00 0 
7f9e76312000-7f9e76313000 ---p 00000000 00:00 0 
7f9e76313000-7f9e763b4000 rw-p 00000000 00:00 0 
7f9e763b4000-7f9e763b5000 ---p 00000000 00:00 0 
7f9e763b5000-7f9e76456000 rw-p 00000000 00:00 0 
7f9e76456000-7f9e76457000 ---p 00000000 00:00 0 
7f9e76457000-7f9e7959c000 rw-p 00000000 00:00 0 
7f9e7959c000-7f9e795c1000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e795c1000-7f9e79739000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79739000-7f9e79783000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79783000-7f9e79784000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79784000-7f9e79787000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e79787000-7f9e7978a000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9e7978a000-7f9e7978e000 rw-p 00000000 00:00 0 
7f9e7978e000-7f9e7979d000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e7979d000-7f9e79844000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e79844000-7f9e798db000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798db000-7f9e798dc000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798dc000-7f9e798dd000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9e798dd000-7f9e798df000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e798df000-7f9e798f4000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e798f4000-7f9e7990e000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e7990e000-7f9e7990f000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e7990f000-7f9e79910000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9e79910000-7f9e7991a000 rw-p 00000000 00:00 0 
7f9e7991a000-7f9e7991b000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991b000-7f9e7991d000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991d000-7f9e7991e000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991e000-7f9e7991f000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e7991f000-7f9e79920000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9e79920000-7f9e7992a000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e7992a000-7f9e7998a000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e7998a000-7f9e799a1000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a1000-7f9e799a2000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a2000-7f9e799a3000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a3000-7f9e799a4000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9e799a4000-7f9e799a7000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799a7000-7f9e799ab000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ab000-7f9e799ac000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ac000-7f9e799ad000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ad000-7f9e799ae000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799ae000-7f9e799af000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9e799af000-7f9e799b6000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799b6000-7f9e799c7000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799c7000-7f9e799cc000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799cc000-7f9e799cd000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799cd000-7f9e799ce000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9e799ce000-7f9e799d2000 rw-p 00000000 00:00 0 
7f9e799d2000-7f9e799d4000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799d4000-7f9e799e5000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799e5000-7f9e799eb000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799eb000-7f9e799ec000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799ec000-7f9e799ed000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799ed000-7f9e799ee000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9e799f1000-7f9e799f6000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799f6000-7f9e799fb000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9e799fb000-7f9e799fc000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fc000-7f9e799fd000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fd000-7f9e799fe000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799fe000-7f9e799ff000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e799ff000-7f9e79a00000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9e79a00000-7f9e79a31000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79a31000-7f9e79ccb000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79ccb000-7f9e79dc3000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dc3000-7f9e79dc4000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dc4000-7f9e79dcb000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dcb000-7f9e79dce000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9e79dce000-7f9e79de1000 rw-p 00000000 00:00 0 
7f9e79de1000-7f9e79de2000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79de2000-7f9e79e05000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e05000-7f9e79e0d000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e0e000-7f9e79e0f000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e0f000-7f9e79e10000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9e79e10000-7f9e79e11000 rw-p 00000000 00:00 0 
7ffca32bb000-7ffce034a000 rw-p 00000000 00:00 0                          [stack]
7ffce0356000-7ffce0359000 r--p 00000000 00:00 0                          [vvar]
7ffce0359000-7ffce035b000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102251] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
  2021-01-26  9:00 ` [ruby-core:102250] " yoshiokatsuneo
@ 2021-01-26  9:04 ` yoshiokatsuneo
  2021-01-26 15:35 ` [ruby-core:102255] " nobu
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: yoshiokatsuneo @ 2021-01-26  9:04 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by yoshiokatsuneo (Tsuneo Yoshioka).

Description updated

When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:

```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e '' 
```

Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 RUBY_THREAD_MACHINE_STACK_SIZE=1000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-2766646 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:000c20 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007fc3de65d143 RBP: 0x0000000000000051 RSP: 0x00007ffdac426a98
 RAX: 0x0000000000000000 RBX: 0x00000000014b7f98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x00000000014b7f98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xf95d6d83628903f1 R10: 0x0000000000000000
 R11: 0x5187b4751a88ebbd R12: 0x00000000015231d0 R13: 0x0000000001453f00
 R14: 0x00000000014b7f98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7fc3de8a833f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7fc3de6ccd73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7fc3de801e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7fc3de5af3c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7fc3de65d143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7fc3de76d934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7fc3de6b59ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7fc3de6b6605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7fc3de5e7731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7fc3de621588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7fc3de891b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7fc3de7315ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7fc3de731845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7fc3de8b53a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7fc3de7fa2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7fc3de6d7862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
013fa000-01559000 rw-p 00000000 00:00 0                                  [heap]
7fc3d7703000-7fc3d8795000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7fc3d8795000-7fc3d8985000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3d8985000-7fc3d8bf9000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7fc3d8bf9000-7fc3d8c20000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3d8c20000-7fc3d93f8000 rw-p 00000000 00:00 0 
7fc3d93f8000-7fc3d9c76000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3d9c76000-7fc3d9c79000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c79000-7fc3d9c8b000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c8b000-7fc3d9c8f000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c8f000-7fc3d9c90000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9c90000-7fc3d9c91000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7fc3d9ca3000-7fc3d9ca4000 ---p 00000000 00:00 0 
7fc3d9ca4000-7fc3d9d45000 rw-p 00000000 00:00 0 
7fc3d9d45000-7fc3d9d46000 ---p 00000000 00:00 0 
7fc3d9d46000-7fc3d9de7000 rw-p 00000000 00:00 0 
7fc3d9de7000-7fc3d9de8000 ---p 00000000 00:00 0 
7fc3d9de8000-7fc3d9e89000 rw-p 00000000 00:00 0 
7fc3d9e89000-7fc3d9e8a000 ---p 00000000 00:00 0 
7fc3d9e8a000-7fc3d9f2b000 rw-p 00000000 00:00 0 
7fc3d9f2b000-7fc3d9f2c000 ---p 00000000 00:00 0 
7fc3d9f2c000-7fc3d9fcd000 rw-p 00000000 00:00 0 
7fc3d9fcd000-7fc3d9fce000 ---p 00000000 00:00 0 
7fc3d9fce000-7fc3da06f000 rw-p 00000000 00:00 0 
7fc3da06f000-7fc3da070000 ---p 00000000 00:00 0 
7fc3da070000-7fc3da111000 rw-p 00000000 00:00 0 
7fc3da111000-7fc3da112000 ---p 00000000 00:00 0 
7fc3da112000-7fc3da1b3000 rw-p 00000000 00:00 0 
7fc3da1b3000-7fc3da1b4000 ---p 00000000 00:00 0 
7fc3da1b4000-7fc3da255000 rw-p 00000000 00:00 0 
7fc3da255000-7fc3da256000 ---p 00000000 00:00 0 
7fc3da256000-7fc3da2f7000 rw-p 00000000 00:00 0 
7fc3da2f7000-7fc3da2f8000 ---p 00000000 00:00 0 
7fc3da2f8000-7fc3da399000 rw-p 00000000 00:00 0 
7fc3da399000-7fc3da39a000 ---p 00000000 00:00 0 
7fc3da39a000-7fc3da43b000 rw-p 00000000 00:00 0 
7fc3da43b000-7fc3da43c000 ---p 00000000 00:00 0 
7fc3da43c000-7fc3da4dd000 rw-p 00000000 00:00 0 
7fc3da4dd000-7fc3da4de000 ---p 00000000 00:00 0 
7fc3da4de000-7fc3da57f000 rw-p 00000000 00:00 0 
7fc3da57f000-7fc3da580000 ---p 00000000 00:00 0 
7fc3da580000-7fc3da621000 rw-p 00000000 00:00 0 
7fc3da621000-7fc3da622000 ---p 00000000 00:00 0 
7fc3da622000-7fc3da6c3000 rw-p 00000000 00:00 0 
7fc3da6c3000-7fc3da6c4000 ---p 00000000 00:00 0 
7fc3da6c4000-7fc3da765000 rw-p 00000000 00:00 0 
7fc3da765000-7fc3da766000 ---p 00000000 00:00 0 
7fc3da766000-7fc3da807000 rw-p 00000000 00:00 0 
7fc3da807000-7fc3da808000 ---p 00000000 00:00 0 
7fc3da808000-7fc3da8a9000 rw-p 00000000 00:00 0 
7fc3da8a9000-7fc3da8aa000 ---p 00000000 00:00 0 
7fc3da8aa000-7fc3da94b000 rw-p 00000000 00:00 0 
7fc3da94b000-7fc3da94c000 ---p 00000000 00:00 0 
7fc3da94c000-7fc3da9ed000 rw-p 00000000 00:00 0 
7fc3da9ed000-7fc3da9ee000 ---p 00000000 00:00 0 
7fc3da9ee000-7fc3daa8f000 rw-p 00000000 00:00 0 
7fc3daa8f000-7fc3daa90000 ---p 00000000 00:00 0 
7fc3daa90000-7fc3dab31000 rw-p 00000000 00:00 0 
7fc3dab31000-7fc3dab32000 ---p 00000000 00:00 0 
7fc3dab32000-7fc3dabd3000 rw-p 00000000 00:00 0 
7fc3dabd3000-7fc3dabd4000 ---p 00000000 00:00 0 
7fc3dabd4000-7fc3dac75000 rw-p 00000000 00:00 0 
7fc3dac75000-7fc3dac76000 ---p 00000000 00:00 0 
7fc3dac76000-7fc3dad17000 rw-p 00000000 00:00 0 
7fc3dad17000-7fc3dad18000 ---p 00000000 00:00 0 
7fc3dad18000-7fc3dadb9000 rw-p 00000000 00:00 0 
7fc3dadb9000-7fc3dadba000 ---p 00000000 00:00 0 
7fc3dadba000-7fc3dae5b000 rw-p 00000000 00:00 0 
7fc3dae5b000-7fc3dae5c000 ---p 00000000 00:00 0 
7fc3dae5c000-7fc3daefd000 rw-p 00000000 00:00 0 
7fc3daefd000-7fc3daefe000 ---p 00000000 00:00 0 
7fc3daefe000-7fc3daf9f000 rw-p 00000000 00:00 0 
7fc3daf9f000-7fc3dafa0000 ---p 00000000 00:00 0 
7fc3dafa0000-7fc3db041000 rw-p 00000000 00:00 0 
7fc3db041000-7fc3db042000 ---p 00000000 00:00 0 
7fc3db042000-7fc3de187000 rw-p 00000000 00:00 0 
7fc3de187000-7fc3de1ac000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de1ac000-7fc3de324000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de324000-7fc3de36e000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de36e000-7fc3de36f000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de36f000-7fc3de372000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de372000-7fc3de375000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7fc3de375000-7fc3de379000 rw-p 00000000 00:00 0 
7fc3de379000-7fc3de388000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de388000-7fc3de42f000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de42f000-7fc3de4c6000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c6000-7fc3de4c7000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c7000-7fc3de4c8000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7fc3de4c8000-7fc3de4ca000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4ca000-7fc3de4df000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4df000-7fc3de4f9000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4f9000-7fc3de4fa000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4fa000-7fc3de4fb000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fc3de4fb000-7fc3de505000 rw-p 00000000 00:00 0 
7fc3de505000-7fc3de506000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de506000-7fc3de508000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de508000-7fc3de509000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de509000-7fc3de50a000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de50a000-7fc3de50b000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7fc3de50b000-7fc3de515000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de515000-7fc3de575000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de575000-7fc3de58c000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58c000-7fc3de58d000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58d000-7fc3de58e000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58e000-7fc3de58f000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7fc3de58f000-7fc3de592000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de592000-7fc3de596000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de596000-7fc3de597000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de597000-7fc3de598000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de598000-7fc3de599000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de599000-7fc3de59a000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7fc3de59a000-7fc3de5a1000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5a1000-7fc3de5b2000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b2000-7fc3de5b7000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b7000-7fc3de5b8000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b8000-7fc3de5b9000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7fc3de5b9000-7fc3de5bd000 rw-p 00000000 00:00 0 
7fc3de5bd000-7fc3de5bf000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5bf000-7fc3de5d0000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d0000-7fc3de5d6000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d6000-7fc3de5d7000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d7000-7fc3de5d8000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5d8000-7fc3de5d9000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7fc3de5dc000-7fc3de5e1000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e1000-7fc3de5e6000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7fc3de5e6000-7fc3de5e7000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e7000-7fc3de5e8000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e8000-7fc3de5e9000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5e9000-7fc3de5ea000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5ea000-7fc3de5eb000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fc3de5eb000-7fc3de61c000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de61c000-7fc3de8b6000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de8b6000-7fc3de9ae000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9ae000-7fc3de9af000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9af000-7fc3de9b6000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9b6000-7fc3de9b9000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7fc3de9b9000-7fc3de9cc000 rw-p 00000000 00:00 0 
7fc3de9cc000-7fc3de9cd000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9cd000-7fc3de9f0000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9f0000-7fc3de9f8000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9f9000-7fc3de9fa000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9fa000-7fc3de9fb000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7fc3de9fb000-7fc3de9fc000 rw-p 00000000 00:00 0 
7ffd6f39a000-7ffdac429000 rw-p 00000000 00:00 0                          [stack]
7ffdac5ef000-7ffdac5f2000 r--p 00000000 00:00 0                          [vvar]
7ffdac5f2000-7ffdac5f4000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted
root@158c25395b8b:/# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```

I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .



----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90103

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
``` ruby
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102255] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
  2021-01-26  9:00 ` [ruby-core:102250] " yoshiokatsuneo
  2021-01-26  9:04 ` [ruby-core:102251] " yoshiokatsuneo
@ 2021-01-26 15:35 ` nobu
  2021-01-28 15:43 ` [ruby-core:102276] " xtkoba+ruby
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nobu @ 2021-01-26 15:35 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by nobu (Nobuyoshi Nakada).


Seems `mark_object_ary` broken?
This should be the array of arrays.

```
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
    frame #0: 0x00000001007698a9 miniruby`lookup_method_table(klass=108645493675760, id=3281) at vm_method.c:699:33
   696 	lookup_method_table(VALUE klass, ID id)
   697 	{
   698 	    st_data_t body;
-> 699 	    struct rb_id_table *m_tbl = RCLASS_M_TBL(klass);
   700 	
   701 	    if (rb_id_table_lookup(m_tbl, id, &body)) {
   702 		return (rb_method_entry_t *) body;
Target 0: (miniruby) stopped.
(lldb) p ruby_current_vm_ptr->mark_object_ary
(VALUE) $0 = 108645493686200
(lldb) rp ruby_current_vm_ptr->mark_object_ary
bits [     ]
T_ARRAY: len=1 (ownership) capa=128
(const VALUE *) $2 = 0x0000619000001e80 {
  (const VALUE) [0] = 0x000062d0000ebf68
}
(lldb) rp $2[0]
bits [     ]
T_STRING: (const char [73]) $4 = "  def self.verify_compaction_references(toward: nil, double_heap: false)\n"
```

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90109

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102276] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (2 preceding siblings ...)
  2021-01-26 15:35 ` [ruby-core:102255] " nobu
@ 2021-01-28 15:43 ` xtkoba+ruby
  2021-01-29 18:31 ` [ruby-core:102311] " ko1
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: xtkoba+ruby @ 2021-01-28 15:43 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by xtkoba (Tee KOBAYASHI).


The crash threshold of `RUBY_THREAD_VM_STACK_SIZE` seems to coincide with the default value of `GC_MALLOC_LIMIT_MIN` (which is 16MB).

I think something is messed up by GC in an early stage of initialization. In fact, the crash seems to disappear when the function `garbage_collect` is made to do nothing other than returning `TRUE`.

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90129

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102311] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (3 preceding siblings ...)
  2021-01-28 15:43 ` [ruby-core:102276] " xtkoba+ruby
@ 2021-01-29 18:31 ` ko1
  2021-03-02  9:18 ` [ruby-core:102703] " xtkoba+ruby
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ko1 @ 2021-01-29 18:31 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by ko1 (Koichi Sasada).

Assignee set to ko1 (Koichi Sasada)
Status changed from Open to Assigned

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90167

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102703] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (4 preceding siblings ...)
  2021-01-29 18:31 ` [ruby-core:102311] " ko1
@ 2021-03-02  9:18 ` xtkoba+ruby
  2021-03-09  9:10 ` [ruby-core:102789] " nobu
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: xtkoba+ruby @ 2021-03-02  9:18 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by xtkoba (Tee KOBAYASHI).


Bug #17668 seems to be a duplicate of this bug.

As I wrote in #note-5, this issue seems to be caused by running GC during initialization. If so, a straightforward workaround would be to suppress GC during init:
```
--- a/eval.c
+++ b/eval.c
@@ -99,6 +99,8 @@
     return state;
 }
 
+extern int suppress_garbage_collection;
+
 /*!
  * Calls ruby_setup() and check error.
  *
@@ -107,6 +109,7 @@
 void
 ruby_init(void)
 {
+    suppress_garbage_collection = 1;
     int state = ruby_setup();
     if (state) {
         if (RTEST(ruby_debug))
@@ -365,6 +368,7 @@
 int
 ruby_run_node(void *n)
 {
+    suppress_garbage_collection = 0;
     rb_execution_context_t *ec = GET_EC();
     int status;
     if (!ruby_executable_node(n, &status)) {
--- a/gc.c
+++ b/gc.c
@@ -8214,11 +8214,15 @@
 #endif
 }
 
+int suppress_garbage_collection;
+
 static int
 garbage_collect(rb_objspace_t *objspace, int reason)
 {
     int ret;
 
+    if (suppress_garbage_collection) return TRUE;
+
     RB_VM_LOCK_ENTER();
     {
 #if GC_PROFILE_MORE_DETAIL
```

An alternative workaround would be to set `GC_ENABLE_LAZY_SWEEP` to 0, but this is not good because it disables lazy sweeping throughout the entire lifecycle. It would be better if we could suppress lazy sweeping during initialization only.

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90697

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:102789] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (5 preceding siblings ...)
  2021-03-02  9:18 ` [ruby-core:102703] " xtkoba+ruby
@ 2021-03-09  9:10 ` nobu
  2021-04-28 23:52 ` [ruby-core:103648] " merch-redmine
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: nobu @ 2021-03-09  9:10 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by nobu (Nobuyoshi Nakada).


Does this work?
https://github.com/nobu/ruby/tree/disable-gc-while-VM-bootsrap

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-90809

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:103648] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (6 preceding siblings ...)
  2021-03-09  9:10 ` [ruby-core:102789] " nobu
@ 2021-04-28 23:52 ` merch-redmine
  2021-07-01 19:34 ` [ruby-core:104463] " merch-redmine
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: merch-redmine @ 2021-04-28 23:52 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by jeremyevans0 (Jeremy Evans).


nobu (Nobuyoshi Nakada) wrote in #note-9:
> Does this work?
> https://github.com/nobu/ruby/tree/disable-gc-while-VM-bootsrap

@nobu I tested it and it fixes the problem on OpenBSD/amd64.

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-91744

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:104463] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (7 preceding siblings ...)
  2021-04-28 23:52 ` [ruby-core:103648] " merch-redmine
@ 2021-07-01 19:34 ` merch-redmine
  2021-07-31  1:03 ` [ruby-core:104730] " cielartisan
  2022-11-24 11:02 ` [ruby-core:110874] " usa (Usaku NAKAMURA)
  10 siblings, 0 replies; 12+ messages in thread
From: merch-redmine @ 2021-07-01 19:34 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by jeremyevans0 (Jeremy Evans).


nobu (Nobuyoshi Nakada) wrote in #note-9:
> Does this work?
> https://github.com/nobu/ruby/tree/disable-gc-while-VM-bootsrap

Since it worked for me, I rebased this tree on master and submitted a pull request for it: https://github.com/ruby/ruby/pull/4617

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-92719

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:104730] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (8 preceding siblings ...)
  2021-07-01 19:34 ` [ruby-core:104463] " merch-redmine
@ 2021-07-31  1:03 ` cielartisan
  2022-11-24 11:02 ` [ruby-core:110874] " usa (Usaku NAKAMURA)
  10 siblings, 0 replies; 12+ messages in thread
From: cielartisan @ 2021-07-31  1:03 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by ciel (T Yamada).


Hi, could you backport this to Ruby 3.0?

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-93064

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Closed
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:110874] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
  2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
                   ` (9 preceding siblings ...)
  2021-07-31  1:03 ` [ruby-core:104730] " cielartisan
@ 2022-11-24 11:02 ` usa (Usaku NAKAMURA)
  10 siblings, 0 replies; 12+ messages in thread
From: usa (Usaku NAKAMURA) @ 2022-11-24 11:02 UTC (permalink / raw)
  To: ruby-core

Issue #17583 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: DONE

mergerd into ruby_3_0 at 5fb3cf4

----------------------------------------
Bug #17583: Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE)
https://bugs.ruby-lang.org/issues/17583#change-100233

* Author: yoshiokatsuneo (Tsuneo Yoshioka)
* Status: Closed
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: DONE
----------------------------------------
When I set large stack size like 100MB using RUBY_THREAD_VM_STACK_SIZE,
I get the segmentation fault.
The error looks happens when RUBY_THREAD_VM_STACK_SIZE is larger than around 17MB.

How to reproduce:
```
$ RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
```
Output:
```
# RUBY_THREAD_VM_STACK_SIZE=17000000 ruby -e ''  
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so: [BUG] Segmentation fault at 0x0000000000000048
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0002 p:-972860 s:0006 e:000005 TOP    [FINISH]
c:0001 p:0000 s:0003 E:0008e0 (none) [FINISH]


-- Machine register context ------------------------------------------------
 RIP: 0x00007f9a84541143 RBP: 0x0000000000000051 RSP: 0x00007ffca756efe8
 RAX: 0x0000000000000000 RBX: 0x000000000070bf98 RCX: 0x000000000000080c
 RDX: 0x0000000000000000 RDI: 0x000000000070bf98 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0xd0f4b751468f8b02 R10: 0x0000000000000000
 R11: 0x3f3c0feefeb77f71 R12: 0x0000000000773a00 R13: 0x00000000006cc8f0
 R14: 0x000000000070bf98 R15: 0x00000000000000f3 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_print_backtrace+0x14) [0x7f9a8478c33f] vm_dump.c:758
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(bug_report_end+0x0) [0x7f9a845b0d73] error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_bug_for_fatal_signal) error.c:786
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(sigsegv+0x51) [0x7f9a846e5e71] signal.c:960
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f9a844933c0] ../sysdeps/pthread/funlockfile.c:28
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_freeze_singleton_class+0x13) [0x7f9a84541143] class.c:1865
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze_inline+0x23) [0x7f9a84651934] ./include/ruby/internal/fl_type.h:466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_obj_freeze) object.c:1281
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rbimpl_fl_set_raw_raw+0x0) [0x7f9a845999ae] encoding.c:125
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(RB_FL_SET_RAW) ./include/ruby/internal/fl_type.h:298
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_new) encoding.c:126
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_list_update) encoding.c:137
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(enc_register_at) encoding.c:392
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate+0xc9bd8) [0x7f9a8459a605]
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_encdb_replicate) encoding.c:612
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb+0x5c1) [0x7f9a844cb731] ./encdb.h:101
/usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so(Init_encdb) (null):0
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(dln_load+0xf8) [0x7f9a84505588] dln.c:1374
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(rb_vm_call_cfunc+0x11a) [0x7f9a84775b6a] vm.c:2466
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(require_internal+0x3ae) [0x7f9a846155ee] load.c:1071
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_require_internal+0x45) [0x7f9a84615845] load.c:1133
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(Init_enc+0x12) [0x7f9a847993a2] dmyenc.c:7
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(process_options+0x20e59b) [0x7f9a846de2f6] ruby.c:1840
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_process_options) ruby.c:2571
/usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0(ruby_options+0x1a2) [0x7f9a845bb862] eval.c:138
/usr/local/rbenv/versions/3.0.0/bin/ruby(main+0x55) [0x4011e5] ./main.c:50

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

* Loaded script: ruby

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb

* Process memory map:

00400000-00401000 r--p 00000000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00401000-00402000 r-xp 00001000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00402000-00403000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00403000-00404000 r--p 00002000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
00404000-00405000 rw-p 00003000 fe:01 5111                               /usr/local/rbenv/versions/3.0.0/bin/ruby
0064b000-00790000 rw-p 00000000 00:00 0                                  [heap]
7f9a7d5e7000-7f9a7e679000 r--s 00000000 fe:01 942375                     /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e679000-7f9a7e869000 r--s 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a7e869000-7f9a7eadd000 r--s 00000000 fe:01 942368                     /usr/lib/debug/.build-id/4f/c5fc33f4429136a494c640b113d76f610e4abc.debug
7f9a7eadd000-7f9a7eb04000 r--s 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a7eb04000-7f9a7f2dc000 rw-p 00000000 00:00 0 
7f9a7f2dc000-7f9a7fb5a000 r--s 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a7fb5a000-7f9a7fb5d000 r--p 00000000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb5d000-7f9a7fb6f000 r-xp 00003000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb6f000-7f9a7fb73000 r--p 00015000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb73000-7f9a7fb74000 r--p 00018000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb74000-7f9a7fb75000 rw-p 00019000 fe:01 655755                     /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f9a7fb87000-7f9a7fb88000 ---p 00000000 00:00 0 
7f9a7fb88000-7f9a7fc29000 rw-p 00000000 00:00 0 
7f9a7fc29000-7f9a7fc2a000 ---p 00000000 00:00 0 
7f9a7fc2a000-7f9a7fccb000 rw-p 00000000 00:00 0 
7f9a7fccb000-7f9a7fccc000 ---p 00000000 00:00 0 
7f9a7fccc000-7f9a7fd6d000 rw-p 00000000 00:00 0 
7f9a7fd6d000-7f9a7fd6e000 ---p 00000000 00:00 0 
7f9a7fd6e000-7f9a7fe0f000 rw-p 00000000 00:00 0 
7f9a7fe0f000-7f9a7fe10000 ---p 00000000 00:00 0 
7f9a7fe10000-7f9a7feb1000 rw-p 00000000 00:00 0 
7f9a7feb1000-7f9a7feb2000 ---p 00000000 00:00 0 
7f9a7feb2000-7f9a7ff53000 rw-p 00000000 00:00 0 
7f9a7ff53000-7f9a7ff54000 ---p 00000000 00:00 0 
7f9a7ff54000-7f9a7fff5000 rw-p 00000000 00:00 0 
7f9a7fff5000-7f9a7fff6000 ---p 00000000 00:00 0 
7f9a7fff6000-7f9a80097000 rw-p 00000000 00:00 0 
7f9a80097000-7f9a80098000 ---p 00000000 00:00 0 
7f9a80098000-7f9a80139000 rw-p 00000000 00:00 0 
7f9a80139000-7f9a8013a000 ---p 00000000 00:00 0 
7f9a8013a000-7f9a801db000 rw-p 00000000 00:00 0 
7f9a801db000-7f9a801dc000 ---p 00000000 00:00 0 
7f9a801dc000-7f9a8027d000 rw-p 00000000 00:00 0 
7f9a8027d000-7f9a8027e000 ---p 00000000 00:00 0 
7f9a8027e000-7f9a8031f000 rw-p 00000000 00:00 0 
7f9a8031f000-7f9a80320000 ---p 00000000 00:00 0 
7f9a80320000-7f9a803c1000 rw-p 00000000 00:00 0 
7f9a803c1000-7f9a803c2000 ---p 00000000 00:00 0 
7f9a803c2000-7f9a80463000 rw-p 00000000 00:00 0 
7f9a80463000-7f9a80464000 ---p 00000000 00:00 0 
7f9a80464000-7f9a80505000 rw-p 00000000 00:00 0 
7f9a80505000-7f9a80506000 ---p 00000000 00:00 0 
7f9a80506000-7f9a805a7000 rw-p 00000000 00:00 0 
7f9a805a7000-7f9a805a8000 ---p 00000000 00:00 0 
7f9a805a8000-7f9a80649000 rw-p 00000000 00:00 0 
7f9a80649000-7f9a8064a000 ---p 00000000 00:00 0 
7f9a8064a000-7f9a806eb000 rw-p 00000000 00:00 0 
7f9a806eb000-7f9a806ec000 ---p 00000000 00:00 0 
7f9a806ec000-7f9a8078d000 rw-p 00000000 00:00 0 
7f9a8078d000-7f9a8078e000 ---p 00000000 00:00 0 
7f9a8078e000-7f9a8082f000 rw-p 00000000 00:00 0 
7f9a8082f000-7f9a80830000 ---p 00000000 00:00 0 
7f9a80830000-7f9a808d1000 rw-p 00000000 00:00 0 
7f9a808d1000-7f9a808d2000 ---p 00000000 00:00 0 
7f9a808d2000-7f9a80973000 rw-p 00000000 00:00 0 
7f9a80973000-7f9a80974000 ---p 00000000 00:00 0 
7f9a80974000-7f9a80a15000 rw-p 00000000 00:00 0 
7f9a80a15000-7f9a80a16000 ---p 00000000 00:00 0 
7f9a80a16000-7f9a80ab7000 rw-p 00000000 00:00 0 
7f9a80ab7000-7f9a80ab8000 ---p 00000000 00:00 0 
7f9a80ab8000-7f9a80b59000 rw-p 00000000 00:00 0 
7f9a80b59000-7f9a80b5a000 ---p 00000000 00:00 0 
7f9a80b5a000-7f9a80bfb000 rw-p 00000000 00:00 0 
7f9a80bfb000-7f9a80bfc000 ---p 00000000 00:00 0 
7f9a80bfc000-7f9a80c9d000 rw-p 00000000 00:00 0 
7f9a80c9d000-7f9a80c9e000 ---p 00000000 00:00 0 
7f9a80c9e000-7f9a80d3f000 rw-p 00000000 00:00 0 
7f9a80d3f000-7f9a80d40000 ---p 00000000 00:00 0 
7f9a80d40000-7f9a80de1000 rw-p 00000000 00:00 0 
7f9a80de1000-7f9a80de2000 ---p 00000000 00:00 0 
7f9a80de2000-7f9a80e83000 rw-p 00000000 00:00 0 
7f9a80e83000-7f9a80e84000 ---p 00000000 00:00 0 
7f9a80e84000-7f9a80f25000 rw-p 00000000 00:00 0 
7f9a80f25000-7f9a80f26000 ---p 00000000 00:00 0 
7f9a80f26000-7f9a8406b000 rw-p 00000000 00:00 0 
7f9a8406b000-7f9a84090000 r--p 00000000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84090000-7f9a84208000 r-xp 00025000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84208000-7f9a84252000 r--p 0019d000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84252000-7f9a84253000 ---p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84253000-7f9a84256000 r--p 001e7000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84256000-7f9a84259000 rw-p 001ea000 fe:01 3310011                    /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f9a84259000-7f9a8425d000 rw-p 00000000 00:00 0 
7f9a8425d000-7f9a8426c000 r--p 00000000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a8426c000-7f9a84313000 r-xp 0000f000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a84313000-7f9a843aa000 r--p 000b6000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843aa000-7f9a843ab000 r--p 0014c000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ab000-7f9a843ac000 rw-p 0014d000 fe:01 3310030                    /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f9a843ac000-7f9a843ae000 r--p 00000000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843ae000-7f9a843c3000 r-xp 00002000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843c3000-7f9a843dd000 r--p 00017000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843dd000-7f9a843de000 r--p 00030000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843de000-7f9a843df000 rw-p 00031000 fe:01 655737                     /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f9a843df000-7f9a843e9000 rw-p 00000000 00:00 0 
7f9a843e9000-7f9a843ea000 r--p 00000000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ea000-7f9a843ec000 r-xp 00001000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ec000-7f9a843ed000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ed000-7f9a843ee000 r--p 00003000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ee000-7f9a843ef000 rw-p 00004000 fe:01 3310016                    /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f9a843ef000-7f9a843f9000 r--p 00000000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a843f9000-7f9a84459000 r-xp 0000a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84459000-7f9a84470000 r--p 0006a000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84470000-7f9a84471000 ---p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84471000-7f9a84472000 r--p 00081000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84472000-7f9a84473000 rw-p 00082000 fe:01 3310021                    /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f9a84473000-7f9a84476000 r--p 00000000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a84476000-7f9a8447a000 r-xp 00003000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447a000-7f9a8447b000 r--p 00007000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447b000-7f9a8447c000 ---p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447c000-7f9a8447d000 r--p 00008000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447d000-7f9a8447e000 rw-p 00009000 fe:01 3310072                    /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f9a8447e000-7f9a84485000 r--p 00000000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84485000-7f9a84496000 r-xp 00007000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a84496000-7f9a8449b000 r--p 00018000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449b000-7f9a8449c000 r--p 0001c000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449c000-7f9a8449d000 rw-p 0001d000 fe:01 3310068                    /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f9a8449d000-7f9a844a1000 rw-p 00000000 00:00 0 
7f9a844a1000-7f9a844a3000 r--p 00000000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844a3000-7f9a844b4000 r-xp 00002000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844b4000-7f9a844ba000 r--p 00013000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844ba000-7f9a844bb000 ---p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bb000-7f9a844bc000 r--p 00019000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844bc000-7f9a844bd000 rw-p 0001a000 fe:01 655860                     /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f9a844c0000-7f9a844c5000 r--s 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844c5000-7f9a844ca000 r--s 00000000 fe:01 5111                       /usr/local/rbenv/versions/3.0.0/bin/ruby
7f9a844ca000-7f9a844cb000 r--p 00000000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cb000-7f9a844cc000 r-xp 00001000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cc000-7f9a844cd000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cd000-7f9a844ce000 r--p 00002000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844ce000-7f9a844cf000 rw-p 00003000 fe:01 18174                      /usr/local/rbenv/versions/3.0.0/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7f9a844cf000-7f9a84500000 r--p 00000000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84500000-7f9a8479a000 r-xp 00031000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8479a000-7f9a84892000 r--p 002cb000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84892000-7f9a84893000 ---p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a84893000-7f9a8489a000 r--p 003c3000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489a000-7f9a8489d000 rw-p 003ca000 fe:01 9797                       /usr/local/rbenv/versions/3.0.0/lib/libruby.so.3.0.0
7f9a8489d000-7f9a848b0000 rw-p 00000000 00:00 0 
7f9a848b0000-7f9a848b1000 r--p 00000000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848b1000-7f9a848d4000 r-xp 00001000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848d4000-7f9a848dc000 r--p 00024000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848dd000-7f9a848de000 r--p 0002c000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848de000-7f9a848df000 rw-p 0002d000 fe:01 3310000                    /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f9a848df000-7f9a848e0000 rw-p 00000000 00:00 0 
7ffc6a4e4000-7ffca7573000 rw-p 00000000 00:00 0                          [stack]
7ffca75e1000-7ffca75e4000 r--p 00000000 00:00 0                          [vvar]
7ffca75e4000-7ffca75e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

```


I confirmed that the problem happens on both Ubuntu 20.04 and macOS(Big Sur/11.1) .




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-24 11:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26  8:55 [ruby-core:102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) yoshiokatsuneo
2021-01-26  9:00 ` [ruby-core:102250] " yoshiokatsuneo
2021-01-26  9:04 ` [ruby-core:102251] " yoshiokatsuneo
2021-01-26 15:35 ` [ruby-core:102255] " nobu
2021-01-28 15:43 ` [ruby-core:102276] " xtkoba+ruby
2021-01-29 18:31 ` [ruby-core:102311] " ko1
2021-03-02  9:18 ` [ruby-core:102703] " xtkoba+ruby
2021-03-09  9:10 ` [ruby-core:102789] " nobu
2021-04-28 23:52 ` [ruby-core:103648] " merch-redmine
2021-07-01 19:34 ` [ruby-core:104463] " merch-redmine
2021-07-31  1:03 ` [ruby-core:104730] " cielartisan
2022-11-24 11:02 ` [ruby-core:110874] " usa (Usaku NAKAMURA)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).