mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
merge revision(s) 39354,39356,39382: [Backport #5014]
* signal.c (sigsegv): avoid to use async signal unsafe functions when nested sigsegv is happen. [Bug #5014] [ruby-dev:44082] * signal.c (check_stack_overflow): extract duplicated code and get rid of declaration-after-statement. [Bug #5014] * signal.c (ruby_abort): fix typo in r39354 [Bug #5014] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@40050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c215874b9
commit
3108dc4b38
3 changed files with 62 additions and 27 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
Tue Apr 2 12:56:15 2013 Naohisa Goto <ngotogenome@gmail.com>
|
||||||
|
|
||||||
|
* signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
|
||||||
|
|
||||||
|
Tue Apr 2 12:56:15 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* signal.c (check_stack_overflow): extract duplicated code and get rid
|
||||||
|
of declaration-after-statement. [Bug #5014]
|
||||||
|
|
||||||
|
Tue Apr 2 12:56:15 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* signal.c (sigsegv): avoid to use async signal unsafe functions
|
||||||
|
when nested sigsegv is happen.
|
||||||
|
[Bug #5014] [ruby-dev:44082]
|
||||||
|
|
||||||
Fri Mar 29 13:22:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
|
Fri Mar 29 13:22:15 2013 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/missing.h: fixed merge mistake of r39985.
|
* include/ruby/missing.h: fixed merge mistake of r39985.
|
||||||
|
|
60
signal.c
60
signal.c
|
@ -564,6 +564,23 @@ rb_get_next_signal(void)
|
||||||
return sig;
|
return sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_SIGALTSTACK
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr)
|
||||||
|
#else
|
||||||
|
#define CHECK_STACK_OVERFLOW() (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
sigbus(int sig SIGINFO_ARG)
|
sigbus(int sig SIGINFO_ARG)
|
||||||
|
@ -573,41 +590,44 @@ sigbus(int sig SIGINFO_ARG)
|
||||||
* and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
|
* and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
|
||||||
* wrong IMHO. but anyway we have to care it. Sigh.
|
* wrong IMHO. but anyway we have to care it. Sigh.
|
||||||
*/
|
*/
|
||||||
#if defined __MACH__ && defined __APPLE__ && defined USE_SIGALTSTACK
|
#if defined __APPLE__
|
||||||
int ruby_stack_overflowed_p(const rb_thread_t *, const void *);
|
CHECK_STACK_OVERFLOW();
|
||||||
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
|
#endif
|
||||||
rb_bug("Bus Error");
|
rb_bug("Bus Error");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIGSEGV
|
#ifdef SIGSEGV
|
||||||
|
static void ruby_abort(void)
|
||||||
|
{
|
||||||
|
#ifdef __sun
|
||||||
|
/* Solaris's abort() is async signal unsafe. Of course, it is not
|
||||||
|
* POSIX compliant.
|
||||||
|
*/
|
||||||
|
raise(SIGABRT);
|
||||||
|
#else
|
||||||
|
abort();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static int segv_received = 0;
|
static int segv_received = 0;
|
||||||
|
extern int ruby_disable_gc_stress;
|
||||||
|
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
sigsegv(int sig SIGINFO_ARG)
|
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) {
|
if (segv_received) {
|
||||||
fprintf(stderr, "SEGV received in SEGV handler\n");
|
char msg[] = "SEGV received in SEGV handler\n";
|
||||||
abort();
|
write(2, msg, sizeof(msg));
|
||||||
|
ruby_abort();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
extern int ruby_disable_gc_stress;
|
CHECK_STACK_OVERFLOW();
|
||||||
|
|
||||||
segv_received = 1;
|
segv_received = 1;
|
||||||
ruby_disable_gc_stress = 1;
|
ruby_disable_gc_stress = 1;
|
||||||
rb_bug("Segmentation fault");
|
rb_bug("Segmentation fault");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#define RUBY_VERSION "1.9.3"
|
#define RUBY_VERSION "1.9.3"
|
||||||
#define RUBY_PATCHLEVEL 401
|
#define RUBY_PATCHLEVEL 402
|
||||||
|
|
||||||
#define RUBY_RELEASE_DATE "2013-03-29"
|
#define RUBY_RELEASE_DATE "2013-04-02"
|
||||||
#define RUBY_RELEASE_YEAR 2013
|
#define RUBY_RELEASE_YEAR 2013
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 4
|
||||||
#define RUBY_RELEASE_DAY 29
|
#define RUBY_RELEASE_DAY 2
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue