diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-21 02:35:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-21 02:35:44 +0000 |
commit | d33830308f79150f362f42e32d5a653c094e745a (patch) | |
tree | 0a66d00a90bdd456ca948d3edc108cc555d31d66 | |
parent | 03a6d033aff09bd333817bdb2a67c52ca5916a83 (diff) |
signal.c: clear received signal at stack overflow
* signal.c (check_stack_overflow): clear the received reserved
signal before raising stack overflow but not aborting.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | signal.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -746,6 +746,7 @@ rb_get_next_signal(void) #if defined(USE_SIGALTSTACK) || defined(_WIN32) NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th)); +static const char *received_signal; # if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__)) # elif defined __linux__ # define USE_UCONTEXT_REG 1 @@ -792,6 +793,7 @@ check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx) * place. */ th->tag = th->tag->prev; } + received_signal = 0; ruby_thread_stack_overflow(th); } } @@ -802,6 +804,7 @@ 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)) { + received_signal = 0; ruby_thread_stack_overflow(th); } } @@ -886,8 +889,7 @@ sigill(int sig SIGINFO_ARG) static void check_reserved_signal_(const char *name, size_t name_len) { - static const char *received; - const char *prev = ATOMIC_PTR_EXCHANGE(received, name); + const char *prev = ATOMIC_PTR_EXCHANGE(received_signal, name); if (prev) { ssize_t RB_UNUSED_VAR(err); |