Beispiel #1
0
static void
check_stack_overflow(const void *addr)
{
    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
    rb_thread_t *th = ruby_current_thread;
    if (ruby_stack_overflowed_p(th, addr)) {
	ruby_thread_stack_overflow(th);
    }
}
Beispiel #2
0
static void
check_stack_overflow(const void *addr)
{
    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
    rb_thread_t *th = GET_THREAD();
    if (ruby_stack_overflowed_p(th, addr)) {
	ruby_thread_stack_overflow(th);
    }
}
Beispiel #3
0
static RETSIGTYPE
sigbus(int sig SIGINFO_ARG)
{
/*
 * Mac OS X makes KERN_PROTECTION_FAILURE when thread touch guard page.
 * and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
 * wrong IMHO. but anyway we have to care it. Sigh.
 */
#if defined __MACH__ && defined __APPLE__ && defined USE_SIGALTSTACK
    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
    rb_thread_t *th = GET_THREAD();
    if (ruby_stack_overflowed_p(th, info->si_addr)) {
	ruby_thread_stack_overflow(th);
    }
#endif
    rb_bug("Bus Error");
}
Beispiel #4
0
static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
{
#ifdef USE_SIGALTSTACK
    int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
    NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
    rb_thread_t *th = GET_THREAD();
    if (ruby_stack_overflowed_p(th, info->si_addr)) {
	ruby_thread_stack_overflow(th);
    }
#endif
    if (segv_received) {
	fprintf(stderr, "SEGV received in SEGV handler\n");
	exit(EXIT_FAILURE);
    }
    else {
	extern int ruby_disable_gc_stress;
	segv_received = 1;
	ruby_disable_gc_stress = 1;
	rb_bug("Segmentation fault");
    }
}