Issue #10460 has been updated by Adrien Lamothe.


When I run 'strace ./segfault.rb', it segfaults but doesn't hang. strace also shows a file that is missing:


open("/usr/local/bin/ruby-2.2.0-preview1/lib/ruby/vendor_ruby/2.2.0/x86_64-linux/rubygems/defaults/operating_system.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)


Here are the final lines of the strace:

lstat("/home/adrien/sandbox/segfault.rb", {st_mode=S_IFREG|0755, st_size=317, ...}) = 0
mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f47c8a39000
mmap(NULL, 1052672, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f47c8938000
mprotect(0x7f47c8938000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f47c8a37fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f47c8a389d0, tls=0x7f47c8a38700, child_tidptr=0x7f47c8a389d0) = 7540
futex(0x2600464, FUTEX_WAIT_PRIVATE, 1, NULL./segfault.rb:12: [BUG] vm_call_cfunc - cfp consistency error
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-linux]

 <unfinished ...>
+++ killed by SIGSEGV +++
Segmentation fault



----------------------------------------
Bug #10460: Segfault instead of stack level too deep
https://bugs.ruby-lang.org/issues/10460#change-49909

* Author: Arne Brasseur
* Status: Open
* Priority: High
* Assignee: Koichi Sasada
* Category: YARV
* Target version: current: 2.2.0
* ruby -v: ruby 2.2.0dev (2014-10-29 trunk 48188) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
The code to trigger this can be found here: https://gist.github.com/mbj/31163a8e712573877268

Also have a look at the comments there. A lot of different people tried it, in some cases it segfaults, in others it doesn't. It seems to have to do with version of gcc or specific CFLAGS. 

I can reproduce the problem for 2.1.3, 2.1.4, and trunk.



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