mwrap user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* SegFault in mwrap 2.1 on Ruby 2.4.7
@ 2019-11-05 14:56 alex
  2019-11-05 18:13 ` alex
  0 siblings, 1 reply; 3+ messages in thread
From: alex @ 2019-11-05 14:56 UTC (permalink / raw)
  To: mwrap-public

Hi,

I'm getting segmentation fault with mwrap 2.1 & Ruby 2.4.7.

I'm not a C developer but I'll be happy to try and help debug this.

So far this is what I've gathered.

Reproduction steps:

1. Run: mwrap ruby -e ''

Backtrace:

#0  0x00007ffff7bd34d2 in has_ec_p () at mwrap.c:216
#1  0x00007ffff7bd3c23 in update_stats_rcu_lock (size=5, caller=140737336167861) at mwrap.c:426
#2  0x00007ffff7bd48d4 in malloc (size=5) at mwrap.c:721
#3  0x00007ffff6edcdb5 in _nl_normalize_codeset () from /lib64/libc.so.6
#4  0x00007ffff6ed710f in _nl_load_locale_from_archive () from /lib64/libc.so.6
#5  0x00007ffff6ed630e in _nl_find_locale () from /lib64/libc.so.6
#6  0x00007ffff6ed5ad3 in setlocale () from /lib64/libc.so.6
#7  0x0000555555578f8a in main ()

Source for reference:

211	 * to have a native thread but no EC during the early and late
212	 * (teardown) phases of the Ruby process
213	 */
214	static int has_ec_p(void)
215	{
216		return (ruby_thread_has_gvl_p() && ruby_current_vm_ptr &&
217			ruby_current_execution_context_ptr);
218	}
219
220	struct acc {

--
Alex

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

* SegFault in mwrap 2.1 on Ruby 2.4.7
  2019-11-05 14:56 SegFault in mwrap 2.1 on Ruby 2.4.7 alex
@ 2019-11-05 18:13 ` alex
  2019-11-16  0:00   ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: alex @ 2019-11-05 18:13 UTC (permalink / raw)
  To: mwrap-public

Apparently, Ruby internals have changed between 2.4 and 2.5.

Specifically the following definitions are not correct for Ruby 2.4:

mwrap.c:

28 extern void * __attribute__((weak)) ruby_current_execution_context_ptr;
29 extern void * __attribute__((weak)) ruby_current_vm_ptr; /* for rb_gc_count */

They can be found in ruby/vm_core.h in Ruby 2.5+ but not in Ruby 2.4. That said,
I don't know what the right definitions are for Ruby 2.4 or if it's possible
to make mwrap copatible with Ruby 2.4.

--
Alex

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

* Re: SegFault in mwrap 2.1 on Ruby 2.4.7
  2019-11-05 18:13 ` alex
@ 2019-11-16  0:00   ` Eric Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Wong @ 2019-11-16  0:00 UTC (permalink / raw)
  To: alex; +Cc: mwrap-public

alex@pointless.one wrote:
> They can be found in ruby/vm_core.h in Ruby 2.5+ but not in Ruby 2.4. That said,
> I don't know what the right definitions are for Ruby 2.4 or if it's possible
> to make mwrap copatible with Ruby 2.4.

Right, mwrap requires Ruby 2.6 or later.  The README says:

| It does not require recompiling or rebuilding Ruby, but only
| supports Ruby trunk (2.6.0dev+) on a few platforms:

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

end of thread, other threads:[~2019-11-16  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 14:56 SegFault in mwrap 2.1 on Ruby 2.4.7 alex
2019-11-05 18:13 ` alex
2019-11-16  0:00   ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap.git/

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).