Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault unmarshalling exception class data member #1224

Closed
pepone opened this issue Dec 29, 2020 · 0 comments
Closed

Segmentation fault unmarshalling exception class data member #1224

pepone opened this issue Dec 29, 2020 · 0 comments
Assignees

Comments

@pepone
Copy link
Member

pepone commented Dec 29, 2020

This crash happens after I add a call to rb_gc for debug builds, the call is to ensure that the unmarshalling of class values isn't broken by a GC call.

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001002a9430 libruby.2.7.dylib`iv_index_tbl_make + 18
    frame #1: 0x00000001002a8e96 libruby.2.7.dylib`ivar_set + 233
    frame #2: 0x00000001002a77df libruby.2.7.dylib`rb_ivar_set + 52
    frame #3: 0x0000000106919d61 IceRuby.bundle`IceRuby::RF_3<unsigned long (*)(unsigned long, unsigned long, unsigned long), unsigned long, unsigned long, unsigned long>::operator(this=0x00007ffeefbfe640)() at Util.h:269:40
    frame #4: 0x0000000106919cf5 IceRuby.bundle`IceRuby::RF_3<unsigned long (*)(unsigned long, unsigned long, unsigned long), unsigned long, unsigned long, unsigned long>::call(f=140732920751680) at Util.h:272:16
    frame #5: 0x00000001001908eb libruby.2.7.dylib`rb_protect + 345
    frame #6: 0x00000001069ad388 IceRuby.bundle`IceRuby::callProtected(func=(IceRuby.bundle`IceRuby::RF_3<unsigned long (*)(unsigned long, unsigned long, unsigned long), unsigned long, unsigned long, unsigned long>::call(unsigned long) at Util.h:271), arg=140732920751680)(unsigned long), unsigned long) at Util.cpp:576:29
    frame #7: 0x000000010690f041 IceRuby.bundle`unsigned long IceRuby::callRuby<unsigned long (*)(unsigned long, unsigned long, unsigned long), unsigned long, unsigned long, unsigned long>(fun=(libruby.2.7.dylib`rb_ivar_set), t1=4311900960, t2=67411, t3=4311901600)(unsigned long, unsigned long, unsigned long), unsigned long, unsigned long, unsigned long) at Util.h:288:12
    frame #8: 0x000000010696de6c IceRuby.bundle`IceRuby::DataMember::unmarshaled(this=0x00000001006fd030, val=4311901600, target=4311900960, (null)=0x0000000000000000) at Types.cpp:874:5
    frame #9: 0x000000010697b475 IceRuby.bundle`IceRuby::ReadObjectCallback::invoke(this=0x0000000103923420, p=0x00007ffeefbfe940) at Types.cpp:2763:14
    frame #10: 0x0000000106976482 IceRuby.bundle`(anonymous namespace)::patchObject(addr=0x0000000103923420, v=0x00007ffeefbfe940) at Types.cpp:2126:9
    frame #11: 0x0000000103bf924a libIce.37.dylib`Ice::InputStream::EncapsDecoder::unmarshal(int, IceInternal::Handle<Ice::Object> const&) + 618
    frame #12: 0x0000000103bfa326 libIce.37.dylib`Ice::InputStream::EncapsDecoder10::readInstance() + 614
    frame #13: 0x0000000103bf9fc8 libIce.37.dylib`Ice::InputStream::EncapsDecoder10::readPendingValues() + 72
    frame #14: 0x0000000103bf9aef libIce.37.dylib`Ice::InputStream::EncapsDecoder10::throwException(IceUtil::Handle<Ice::UserExceptionFactory> const&) + 367
    frame #15: 0x0000000106933ccc IceRuby.bundle`IceRuby::OperationI::unmarshalException(this=0x0000000105e44a50, bytes=size=167, communicator=0x00007ffeefbfeda8) at Operation.cpp:576:12
    frame #16: 0x0000000106932ae8 IceRuby.bundle`IceRuby::OperationI::invoke(this=0x0000000105e44a50, proxy=0x00007ffeefbfef60, args=4311861640, hctx=8) at Operation.cpp:332:33
    frame #17: 0x000000010692fed1 IceRuby.bundle`::IceRuby_Operation_invoke(self=4362777960, proxy=4303569600, opArgs=4311861640, ctx=8) at Operation.cpp:126:20
    frame #18: 0x00000001002c19b7 libruby.2.7.dylib`vm_call_cfunc + 345
    frame #19: 0x00000001002af461 libruby.2.7.dylib`vm_exec_core + 8443
    frame #20: 0x00000001002be50d libruby.2.7.dylib`rb_vm_exec + 1872
    frame #21: 0x000000010018fe39 libruby.2.7.dylib`rb_ec_exec_node + 187
    frame #22: 0x000000010018fd38 libruby.2.7.dylib`ruby_run_node + 85
    frame #23: 0x0000000100003f18 ruby`main + 100
    frame #24: 0x00007fff2035c621 libdyld.dylib`start + 1
    frame #25: 0x00007fff2035c621 libdyld.dylib`start + 1

Here the crash happens when trying to set a class data member on the exception object, the problem is that the exception is not longer in the stack and so it is eligible for GC, the ExceptionReader should mark it to avoid this.

@pepone pepone self-assigned this Dec 29, 2020
@pepone pepone closed this as completed in b64ae59 Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant