Issue #11514 has been updated by Tony Reix.


Nobuyoshi Nakada wrote:
> If `dbx` can't handle `sigaltstack`, try `configure` with `--enable-debug-env` option and run with environment variable `RUBY_DEBUG=core`.

I've tried to reproduce the issue before I've got your note:

 - first, I forgot to set: LDR_CNTRL=MAXDATA=0x80000000 , thus I got (see below for full trace):
      /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/**store.rb**:893: [BUG] Segmentation fault at 0x000004
      c:0024 p:---- s:0120 e:000119 CFUNC  **:byteslice**
   which seems to be a characteristics when LDR_CNTRL=... is missing.
   It is not exactly the same crash that I got at first:
      /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/**parser.rb**:331: [BUG] **Segmentation fault** at 0x000004
      c:0025 p:---- s:0126 e:000125 CFUNC  **:byteslice**
   but it also deals with :byteslice .
   So, probably that there is some missing test that does not prevent the process to be corrupted and crash in :byteslice .

 - second, I set: LDR_CNTRL=MAXDATA=0x80000000 , and... then I got NO crash !
      ...
        Total:      15495 (3725 undocumented)
        75.96% documented
        Elapsed: 872.7s
      ...
   So, maybe that this **:write** crash is random ?!

---------------------------------------------------------------------------------

**Details of  :byteslice  crash:**

Parsing sources...
100% [967/967]  vsnprintf.c                                                                   

Generating RI format into /opt/freeware/src/packages/BUILD/ruby-2.2.3/.ext/rdoc...
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:327: [BUG] Segmentation fault at 0x000004
ruby 2.2.3p173 (2015-08-18 revision 51636) [powerpc-aix6.1.0.0]

-- Control frame information -----------------------------------------------
c:0024 p:---- s:0120 e:000119 CFUNC  :byteslice
c:0023 p:0019 s:0115 e:000114 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:327
c:0022 p:0228 s:0110 e:000108 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:473
c:0021 p:0017 s:0099 e:000098 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:60
c:0020 p:0019 s:0093 e:000092 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup.rb:748
c:0019 p:0112 s:0088 e:000087 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/text.rb:143
c:0018 p:0029 s:0083 e:000082 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/comment.rb:181
c:0017 p:0055 s:0080 e:000079 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/text.rb:137
c:0016 p:0010 s:0075 e:000074 BLOCK  /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:590 [FINISH]
c:0015 p:---- s:0070 e:000069 CFUNC  :map
c:0014 p:0102 s:0067 e:000066 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:589
c:0013 p:0048 s:0061 e:000056 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:322 [FINISH]
c:0012 p:---- s:0052 e:000051 CFUNC  :dump
c:0011 p:0450 s:0048 e:000047 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:865
c:0010 p:0009 s:0033 e:000032 BLOCK  /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:749 [FINISH]
c:0009 p:---- s:0030 e:000029 CFUNC  :each
c:0008 p:0015 s:0027 e:000026 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:748
c:0007 p:0009 s:0024 e:000023 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/generator/ri.rb:26
c:0006 p:0057 s:0021 e:000020 BLOCK  /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:530 [FINISH]
c:0005 p:---- s:0019 e:000018 CFUNC  :chdir
c:0004 p:0018 s:0015 e:000014 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:525
c:0003 p:0369 s:0012 e:000011 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:508
c:0002 p:0049 s:0006 E:000354 EVAL   ./bin/rdoc:20 [FINISH]
c:0001 p:0000 s:0002 E:00007c TOP    [FINISH]

-- Ruby level backtrace information ----------------------------------------
./bin/rdoc:20:in `<main>'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:508:in `document'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:525:in `generate'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:525:in `chdir'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/rdoc.rb:530:in `block in generate'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/generator/ri.rb:26:in `generate'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:748:in `save'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:748:in `each'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:749:in `block in save'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:865:in `save_class'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/store.rb:865:in `dump'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:322:in `marshal_dump'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:589:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:589:in `map'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/class_module.rb:590:in `block in parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/text.rb:137:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/comment.rb:181:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/text.rb:143:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup.rb:748:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:60:in `parse'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:473:in `tokenize'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:327:in `char_pos'
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:327:in `byteslice

----------------------------------------
Bug #11514: AIX6.1 - Ruby 2.2.3 - Segmentation fault in :byteslice
https://bugs.ruby-lang.org/issues/11514#change-54222

* Author: Tony Reix
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ?? ruby 2.1.1p76 (2014-02-24 revision 45161) [powerpc-aix6.1.0.0]
* Backport: 
----------------------------------------
Testing Ruby 2.2.3 on AIX6.1 built with xlc (same with gcc) leads to a reproducible crash.
See complete trace in attached file.
Ruby version is: RUBY_PROGRAM_VERSION=2.2.3 .

~~~
# gmake V=1 test-all
...
objcopy -w -L 'Init_*' -L '*_threadptr_*' libruby.so.2.2.0
:
/usr/vac/bin/xlc_r  -g -qinfo=por   -L.  -bE:ruby.imp -brtl -blibpath:NONE/lib:/usr/lib:/lib  main.o  -L/usr/local/lib -lruby  -lpthread -lgmp -ldl -lcrypt -lm    -o ruby
:
gmake[2]: Leaving directory `/opt/freeware/src/packages/BUILD/ruby-2.2.3'
gmake[1]: Leaving directory `/opt/freeware/src/packages/BUILD/ruby-2.2.3'
Generating RDoc documentation
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems "./bin/rdoc" --root "." --page-dir "./doc" --encoding=UTF-8 --no-force-update --all --ri --op ".ext/rdoc" --debug  "."
Parsing sources...
100% [967/967]  vsnprintf.c                                                                   

Generating RI format into /opt/freeware/src/packages/BUILD/ruby-2.2.3/.ext/rdoc...

BEFORE @generator.generate in lib/rdoc/rdoc.rb
/opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:331: [BUG] **Segmentation fault** at 0x000004
ruby 2.2.3p173 (2015-08-18 revision 51636) [powerpc-aix6.1.9.0]

-- Control frame information -----------------------------------------------
c:0025 p:---- s:0126 e:000125 CFUNC  **:byteslice**
c:0024 p:0019 s:0121 e:000120 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:331
c:0023 p:0009 s:0116 e:000115 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:547
c:0022 p:0438 s:0111 e:000108 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:501
c:0021 p:0017 s:0099 e:000098 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup/parser.rb:62
c:0020 p:0019 s:0093 e:000092 METHOD /opt/freeware/src/packages/BUILD/ruby-2.2.3/lib/rdoc/markup.rb:748
...

gmake: *** [rdoc] IOT/Abort trap (core dumped)


# ll ./.ext/rdoc/core
-rw-------    1 root     system    269015892 Sep  8 14:08 ./.ext/rdoc/core


# dbx ./ruby ./.ext/rdoc/core

IOT/Abort trap in pthread_kill at 0xd051ceb4 ($t1)
0xd051ceb4 (pthread_kill+0xb4) 80410014         lwz   r2,0x14(r1)
(dbx) where
pthread_kill(??, ??) at 0xd051ceb4
_p_raise(??) at 0xd051c2e8
raise.raise(??) at 0xd011f8a0
abort() at 0xd01a9a04
die(), line 395 in "error.c"
libdebug assertion "(framep->getGpr(STKP, &addr) == DB_SUCCESS && *nextStkpp == addr)" failed at line 1299 in file ../../../../../../../../../../../src/bos/usr/ccs/lib/libdbx/libdebug/modules/stackdebug/POWER/stackdb_FrameProgress.C
rb_bug_context(ctx = 0x200f83b0, fmt = "Segmentation fault at %p", ... = 0x4, 0xd052f200, 0x0, 0x117100f5, 0x117100f5, 0x200f7f28), line 427 in "error.c"
sigsegv(sig = 11, info = 0x200f863c, ctx = 0x200f83b0), line 879 in "signal.c"


---Files--------------------------------
RubyCore (15.8 KB)


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