Unmask signal before re-raising fatal signal

On Linux, while the signal handler runs, that signal is masked, so in
the rb_bug_for_fatal_signal() code path we didn't get the default signal
action as intended. See signal(7). It worked fine on macOS, though.

Before:

    $ ./miniruby -e 'Process.kill :SIGSEGV, Process.pid'
    <snip>
    Aborted (core dumped)

After:

    $ ./miniruby -e 'Process.kill :SIGSEGV, Process.pid'
    <snip>
    Segmentation fault (core dumped)

Follow-up for 1ac0afab4d "rb_bug_for_fatal_signal: exit with the right
signal".
This commit is contained in:
Alan Wu 2023-12-18 16:37:52 -05:00
Родитель 11fa76b1b5
Коммит 3c47114991
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -403,6 +403,9 @@ interrupt_init(int argc, VALUE *argv, VALUE self)
}
void rb_malloc_info_show_results(void); /* gc.c */
#ifdef POSIX_SIGNAL
static void reset_sigmask(int sig);
#endif
void
ruby_default_signal(int sig)
@ -413,6 +416,9 @@ ruby_default_signal(int sig)
rb_malloc_info_show_results();
signal(sig, SIG_DFL);
#ifdef POSIX_SIGNAL
reset_sigmask(sig);
#endif
raise(sig);
}