Issue #17487 has been updated by josegutierrez (Jose Gutierrez de la Concha).


I cannot reproduce with 2.6.6 or 2.7.2, using those the call to rb_gc doesn't cause a segfault.

----------------------------------------
Bug #17487: rb_gc segfaults on ARM64 platforms
https://bugs.ruby-lang.org/issues/17487#change-89625

* Author: josegutierrez (Jose Gutierrez de la Concha)
* Status: Feedback
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
I have a ruby native extension, and I see a segfault when calling rb_gc, so far I have seen this happening on arm64 platforms both rhel7 arm64 using ruby 2.0 and debian stretch arm64 using ruby 2.3

```
(gdb) bt
#0  0x0000ffffbe2251b8 in raise () from /lib64/libc.so.6
#1  0x0000ffffbe226830 in abort () from /lib64/libc.so.6
#2  0x0000ffffbe592f78 in rb_bug () from /lib64/libruby.so.2.0
#3  0x0000ffffbe5a9bc4 in slot_sweep () from /lib64/libruby.so.2.0
#4  0x0000ffffbe5aa6c8 in garbage_collect () from /lib64/libruby.so.2.0
#5  0x0000ffffbe5aad90 in rb_gc () from /lib64/libruby.so.2.0
#6  0x0000ffffb761a764 in IceRuby::ReadObjectCallback::invoke (this=0xa10f90, p=...) at src/IceRuby/Types.cpp:2760
#7  0x0000ffffb7617644 in (anonymous namespace)::patchObject (addr=0xa10f90, v=...) at src/IceRuby/Types.cpp:2125
#8  0x0000ffffb7202a4c in Ice::InputStream::EncapsDecoder::unmarshal(int, IceInternal::Handle<Ice::Object> const&)
    () from /home/ec2-user/workspace/ice/ruby/ruby/../../cpp/lib64/libIce.so.37
#9  0x0000ffffb7202f70 in Ice::InputStream::EncapsDecoder10::readInstance() ()
   from /home/ec2-user/workspace/ice/ruby/ruby/../../cpp/lib64/libIce.so.37
#10 0x0000ffffb7203224 in Ice::InputStream::EncapsDecoder10::readPendingValues() ()
   from /home/ec2-user/workspace/ice/ruby/ruby/../../cpp/lib64/libIce.so.37
#11 0x0000ffffb7200428 in Ice::InputStream::EncapsDecoder10::throwException(IceUtil::Handle<Ice::UserExceptionFactory> const&) () from /home/ec2-user/workspace/ice/ruby/ruby/../../cpp/lib64/libIce.so.37
#12 0x0000ffffb71fe2b0 in Ice::InputStream::throwException(IceUtil::Handle<Ice::UserExceptionFactory> const&) ()
   from /home/ec2-user/workspace/ice/ruby/ruby/../../cpp/lib64/libIce.so.37
#13 0x0000ffffb764c72c in IceRuby::OperationI::unmarshalException (this=0x5fd8b0, 
    bytes=std::vector of length 167, capacity 167 = {...}, communicator=...) at src/IceRuby/Operation.cpp:575
#14 0x0000ffffb764b4fc in IceRuby::OperationI::invoke (this=0x5fd8b0, proxy=..., args=4483280, hctx=8)
    at src/IceRuby/Operation.cpp:331
#15 0x0000ffffb764a43c in IceRuby_Operation_invoke (self=4586160, proxy=7642800, opArgs=4483280, ctx=8)
    at src/IceRuby/Operation.cpp:125
#16 0x0000ffffbe67c980 in call_cfunc_3 () from /lib64/libruby.so.2.0
#17 0x0000ffffbe680e88 in vm_call_cfunc_with_frame () from /lib64/libruby.so.2.0
#18 0x0000ffffbe69031c in vm_call_method () from /lib64/libruby.so.2.0
#19 0x0000ffffbe685220 in vm_exec_core () from /lib64/libruby.so.2.0
#20 0x0000ffffbe689c68 in vm_exec () from /lib64/libruby.so.2.0
#21 0x0000ffffbe68bc4c in rb_iseq_eval_main () from /lib64/libruby.so.2.0
#22 0x0000ffffbe595d5c in ruby_exec_internal () from /lib64/libruby.so.2.0
#23 0x0000ffffbe597434 in ruby_exec_node () from /lib64/libruby.so.2.0
#24 0x0000ffffbe598b9c in ruby_run_node () from /lib64/libruby.so.2.0
#25 0x00000000004009e8 in main ()
```

In my extension I added a call to `rb_gc` in debug builds to ensure the extension is correctly handling memory, and this is triggering the segfault in slot_sweep



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>