[#104169] [Ruby master Feature#17938] Keyword alternative for boolean positional arguments — matheusrichardt@...

Issue #17938 has been reported by matheusrich (Matheus Richard).

12 messages 2021/06/04

[#104213] [Ruby master Feature#17942] Add a `initialize(public @a, private @b)` shortcut syntax for defining public/private accessors for instance vars — tyler@...

Issue #17942 has been reported by TylerRick (Tyler Rick).

6 messages 2021/06/09

[#104288] [Ruby master Bug#17992] Upstreaming the htmlentities gem into CGI#.(un)escape_html — alexandermomchilov@...

Issue #17992 has been reported by AMomchilov (Alexander Momchilov).

9 messages 2021/06/15

[#104338] [Ruby master Misc#17997] DevelopersMeeting20210715Japan — mame@...

Issue #17997 has been reported by mame (Yusuke Endoh).

10 messages 2021/06/17

[#104361] [Ruby master Bug#18000] have_library doesn't work when ruby is compiled with --disable-shared --disable-install-static-library — jean.boussier@...

Issue #18000 has been reported by byroot (Jean Boussier).

9 messages 2021/06/18

[#104401] [Ruby master Feature#18007] Help developers of C extensions meet requirements in "doc/extension.rdoc" — mike.dalessio@...

Issue #18007 has been reported by mdalessio (Mike Dalessio).

16 messages 2021/06/25

[#104430] [Ruby master Bug#18011] `Method#parameters` is incorrect for forwarded arguments — josh.cheek@...

Issue #18011 has been reported by josh.cheek (Josh Cheek).

12 messages 2021/06/29

[ruby-core:104433] [Ruby master Bug#2127] Fiber#resume - segfault inside C extension

From: samuel@...
Date: 2021-06-29 07:41:00 UTC
List: ruby-core #104433
Issue #2127 has been updated by ioquatix (Samuel Williams).

Description updated

Make description more readable.

----------------------------------------
Bug #2127: Fiber#resume - segfault inside C extension
https://bugs.ruby-lang.org/issues/2127#change-92687

* Author: sunaku (Suraj Kurapati)
* Status: Rejected
* Priority: Normal
* ruby -v: ruby 1.9.2dev (2009-09-14 trunk 24923) [i686-linux]
----------------------------------------
 Hi,
 
 I am using ruby 1.9.2dev (2009-09-14 trunk 24923) [i686-linux].
 
 Both Fiber#resume and rb_fiber_resume() are causing a segfault
 when called from inside a very simple C extension (see below).
 
 Thanks for your consideration.
 
```
 ###############################################################
 # ls
 ###############################################################
 
 extconf.rb  main.c
 
 ###############################################################
 # cat extconf.rb 
 ###############################################################
 
 require 'mkmf'
 
 have_library('ruby-static', 'ruby_init') ||
 have_library('ruby', 'ruby_init')
 
 create_makefile('main')
 
 ###############################################################
 # cat main.c
 ###############################################################
 
 #include <stdio.h>
 #include <ruby.h>
 
 VALUE body(VALUE arg)
 {
     printf("Fiber: Inside fiber body"); 
     fflush(stdout);
     return Qnil;
 }
 
 RUBY_GLOBAL_SETUP
 
 int main(int argc, char** argv)
 {
     ruby_sysinit(&argc, &argv);
     RUBY_INIT_STACK;
     ruby_init();
 
     printf("Main: Creating Ruby fiber..."); 
     fflush(stdout);
     VALUE fib = rb_fiber_new(body, Qnil);
 
     VALUE dump = rb_inspect(fib);
     rb_io_puts(1, &dump, rb_stdout);
 
     printf("Main: Going to resume fiber...\n"); 
     fflush(stdout);
 
     rb_funcall(fib, rb_intern("resume"), 0); /* <== SEGFAULT */
 
     printf("Main: Fiber resumed successfully.\n");
     fflush(stdout);
 
     return ruby_cleanup(0);
 }
 
 ###############################################################
 # ruby -v extconf.rb 
 ###############################################################
 
 ruby 1.9.2dev (2009-09-14 trunk 24923) [i686-linux]
 checking for ruby_init() in -lruby-static... yes
 creating Makefile
 
 ###############################################################
 # sed -i 's,-shared,,g' Makefile ; make
 ###############################################################
 
 gcc -I. -I/home/sun/app/ruby-1.9-git/include/ruby-1.9.1/i686-linux -I/home/sun/app/ruby-1.9-git/include/ruby-1.9.1/ruby/backward -I/home/sun/app/ruby-1.9-git/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64  -fPIC -g  -o main.o -c main.c
 gcc  -o main.so main.o -L. -L/home/sun/app/ruby-1.9-git/lib -Wl,-R/home/sun/app/ruby-1.9-git/lib -L.  -rdynamic -Wl,-export-dynamic    -lruby-static  -lpthread -lrt -ldl -lcrypt -lm   -lc
 
 ###############################################################
 # ./main.so
 ###############################################################
 
 Main: Creating Ruby fiber...#<Fiber:0x8a5938c>
 Main: Going to resume fiber...
 [BUG] Segmentation fault
 ruby 1.9.2dev (2009-09-14 trunk 24923) [i686-linux]
 
 -- control frame ----------
 c:0001 p:---- s:0001 b:-001 l:000000 d:000000 ------
 ---------------------------
 
 fish: Job 1, “./main.so” terminated by signal SIGSEGV (Address boundary error)
 
 ####################################################
 # gdb main.so core 
 ####################################################
 
 GNU gdb 6.8
 [...]
 Core was generated by `./main.so'.
 Program terminated with signal 11, Segmentation fault.
 [New process 8635]
 [New process 8636]
 #0  0xb7c539be in uw_frame_state_for () from /usr/lib/libgcc_s.so.1
 
 (gdb) bt full
 #0  0xb7c539be in uw_frame_state_for () from /usr/lib/libgcc_s.so.1
 No symbol table info available.
 #1  0xb7c54011 in _Unwind_Backtrace () from /usr/lib/libgcc_s.so.1
 No symbol table info available.
 #2  0xb7ddf405 in backtrace () from /lib/libc.so.6
 No symbol table info available.
 #3  0x08141c33 in rb_vm_bugreport () at vm_dump.c:598
 	trace = {0x8141c33, 0x816fb60, 0x816fbba, 0x80e386e, 0xb7ee740c, 0x0 <repeats 1019 times>}
 	n = -1209027184
 	syms = (char **) 0xb7d4630f
 	i = -1209789088
 #4  0x0816fb60 in report_bug (file=0x0, line=0, fmt=0x819a2e3 "Segmentation fault", 
     args=0x8aa97d4 "\236é\031k") at error.c:215
 	buf = '\0' <repeats 8176 times>, "\230\227ª\bcè\023\b\2102£\b\230~¬\b"
 	out = (FILE *) 0xb7e41560
 	len = 0
 #5  0x0816fbba in rb_bug (fmt=0x819a2e3 "Segmentation fault") at error.c:232
 	args = 0x8aa97d4 "\236é\031k"
 #6  0x080e386e in sigsegv (sig=11, info=0x8aa980c, ctx=0x8aa988c) at signal.c:616
 	th = (rb_thread_t *) 0x8a33288
 #7  <signal handler called>
 No symbol table info available.
 #8  0x6b19e99e in ?? ()
 No symbol table info available.
```




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

In This Thread

Prev Next