* signal.c (rb_sigaltstack_size): double default size to get rid
of heap corruption by alternate stack overflow in SEGV handler.
typically happened at fprintf() in control_frame_dump().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_reserved_signal): abort if reserved signal
received in reserved signal handlers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (install_signalhandler, init_sigchld): allow failure because it
always fails with ENOSYS on NaCl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (rb_f_kill): get rid of deadlock as unhandled and
discarded signals do not make interrupt_cond signaled.
based on the patch by Kazuki Tsujimoto at [ruby-dev:48606].
[Bug #9820]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (rb_f_kill): should not ignore signal unless the
default handler is registered. [ruby-dev:48592] [Bug #9820]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (trap): SIGEXIT is not a system signal and is dealt
with internally, so it should not try to register the system
signal handler by sigaction.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (ruby_signal): return SIG_ERR as well as signal(2).
* signal.c (trap): raise SystemCallError for all failures when
called as a method.
* signal.c (Init_signal): fail by [BUG] only if initialization is
failed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (ruby_signal): although "EINVAL from sigaction(2) is
not a bug", but even it is a failure. pointed at toRuby/guRuby
in RubyHiroba.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c (rlimit_resource_type, rlimit_resource_value): get rid
of function calls in RSTRING_PTR(), as it evaluates the argument
twice.
* re.c (match_backref_number): ditto.
* signal.c (esignal_init, rb_f_kill, trap_signm): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_vm_t::trap_list_cmds (an array) and
rb_vm_t::trap_list_safes[RUBY_NSIG]
(separate to two different array).
This modification reduce root objects.
* signal.c: ditto.
* vm.c (rb_vm_mark): remove marking code for rb_vm_t::trap_list.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): drop the last tag too close to
the fault page, to get rid of stack overflow deadlock.
[Bug #9971]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (ruby_signal): should return either `old.sa_sigaction`
or `old.sa_handler`, depending on whether `SA_SIGINFO` is set in
`old.sa_flags`, because they may not be a union.
[ruby-core:62836] [Bug #9878]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): revert part of r46100, the
previous condition was correct, and fix compilation error on
other architecture linux. [ruby-core:62746] [Bug #9862]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_bug_context): new function to report bug with
context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
dump machine regisiters. based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): fix condition to use ucontext
register, mcontext_t dereference, and its member names, on Mac
OS X.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): use mcontext_t. the struct tag
name is not portable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): raise SystemStackError if SP
register and fault address is in the same page or the next, on
x86 Mac OS X. [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): check the next page too. SP in
ucontext is not decremented yet when `push` failed, so the fault
page can be the next.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (rb_f_kill): directly enqueue an ignored signal to self,
except for SIGSEGV and SIGBUS. [ruby-dev:48203] [Bug #9820]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (check_stack_overflow): raise SystemStackError if SP
register and fault address is in the same page, on x86 linux.
[EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (sigbus, sigsegv): show fault address in the bug message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
test/ruby/test_exception.rb on Windows.
wrap by __try and __exception statements on mswin to raise SIGSEGV
when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't
handle the exception.
however, (1) mingw-gcc doesn't support __try and __exception
statements, and (2) we cannot retry SystemStackError after this
change yet (maybe crashed) because SEH and longjmp() are too
uncongenial.
* signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on
Windows, too.
* thread_win32.c (ruby_stack_overflowed_p): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c (sighandler_t): get rid of clash with system provided name.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
unistd.h is now included via ruby/defines.h, but should implicitly
include here. (suggested by kosaki)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e