[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: qemu-m68k and prlimit64 - segfaults




Le 20/11/2015 15:42, John Paul Adrian Glaubitz a écrit :
> On 11/20/2015 03:34 PM, Andreas Schwab wrote:
>> John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> writes:
>>
>>> Now, running this with strace, I made a suspicious observation which
>>> might be related to the the segmentation fault:
>>>
>>> prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024,
>>> rlim_max=RLIM64_INFINITY}) = 0
>>> --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xef79c0d8} ---
>>
>> Why do you think there is any relation between these two events?
> 
> I was guessing. I don't really know.
> 
> If you have any idea how to properly debug the issue, I would be very
> glad.
> 
> Without the debug symbols, this is what gdb shows:
> 
> root@pacman:~> gdb /usr/bin/ruby2.2
> GNU gdb (Debian 7.10-1) 7.10
> Copyright (C) 2015 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "m68k-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /usr/bin/ruby2.2...(no debugging symbols found)...done.
> (gdb) r
> Starting program: /usr/bin/ruby2.2
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/m68k-linux-gnu/libthread_db.so.1".
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0xc01cc0ac in reserve_stack (limit=0xef8000d8 "", size=8384256) at
> thread_pthread.c:690
> 690	thread_pthread.c: No such file or directory.
> (gdb) bt
> #0  0xc01cc0ac in reserve_stack (limit=0xef8000d8 "", size=8384256) at
> thread_pthread.c:690
> #1  0xc01ce9ec in ruby_init_stack (addr=0xeffff680) at thread_pthread.c:719
> #2  0x8000071a in ?? ()
> #3  0xeffff680 in ?? ()
> #4  0xeffff68c in ?? ()
> #5  0xeffff690 in ?? ()
> #6  0x00000000 in ?? ()
> (gdb)


If google give me the good source version,

https://github.com/brightbox/deb-ruby2.2/blob/master/thread_pthread.c

685    else {
686	limit -= size;
687	if (buf > limit) {
688	    limit = alloca(buf - limit);
689	    limit -= stack_check_margin;
690	    limit[0] = 0;
691	}
692    }


It is playing with stack and it fails... perhaps a m68k specific bug.

Laurent


Reply to: