[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:26258] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

From: Suraj Kurapati <redmine@...>
Date: 2009-10-23 19:36:38 UTC
List: ruby-core #26258
Issue #2258 has been updated by Suraj Kurapati.


Hi,

I inspected the assembler code for the prep_stdio() function call
inside Init_IO() and found that the problem was *not* a corrupted
stack pointer as I had imagined, but instead, the wrong argument
value was being passed to prep_stdio() by the assembler code:

  rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO, "<STDIN>");

  Dump of assembler code from 0x808b2bd to 0x808b3bd:
    0x0808b2bd <Init_IO+4171>:      mov    0x8212980,%edx
    0x0808b2c3 <Init_IO+4177>:      mov    0x8202fa4,%eax        # <=== HERE
    0x0808b2c8 <Init_IO+4182>:      movl   $0x81860bd,0xc(%esp)
    0x0808b2d0 <Init_IO+4190>:      mov    %edx,0x8(%esp)
    0x0808b2d4 <Init_IO+4194>:      movl   $0x1,0x4(%esp)
    0x0808b2dc <Init_IO+4202>:      mov    %eax,(%esp)           # <=== stdin
    0x0808b2df <Init_IO+4205>:      call   0x8084fee <prep_stdio>

For some reason, the assembler code is passing the wrong value
for the "stdin" parameter.  GDB shows that the value of "stdin"
inside Init_IO() is:

  (gdb) p stdin
  $8 = (struct _IO_FILE *) 0xb7f3b420
  
But the assembler code thinks that "stdin" is 0x8202fa4 (see "HERE" above).

Any suggestions for debugging?

Thanks for your consideration.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2258

----------------------------------------
http://redmine.ruby-lang.org

In This Thread