mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Disregard si_addr for fatal signals sent from other processes
Previously, when another process sends a fatal signals such as SIGBUS to Ruby, we could mis-interpret it as a stack overflow Ruby itself generated. When the si_pid field is set on the signal, we shouldn't check the si_addr field to check for stack overflow. > Signals sent with kill(2) and sigqueue(3) fill in si_pid and si_uid. Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
This commit is contained in:
parent
ad2aa6d727
commit
1e7ee871cb
1 changed files with 2 additions and 2 deletions
4
signal.c
4
signal.c
|
@ -872,9 +872,9 @@ check_stack_overflow(int sig, const void *addr)
|
||||||
# else
|
# else
|
||||||
# define FAULT_ADDRESS info->si_addr
|
# define FAULT_ADDRESS info->si_addr
|
||||||
# ifdef USE_UCONTEXT_REG
|
# ifdef USE_UCONTEXT_REG
|
||||||
# define CHECK_STACK_OVERFLOW() check_stack_overflow(sig, (uintptr_t)FAULT_ADDRESS, ctx)
|
# define CHECK_STACK_OVERFLOW() (info->si_pid ? (void)0 : check_stack_overflow(sig, (uintptr_t)FAULT_ADDRESS, ctx))
|
||||||
# else
|
# else
|
||||||
# define CHECK_STACK_OVERFLOW() check_stack_overflow(sig, FAULT_ADDRESS)
|
# define CHECK_STACK_OVERFLOW() (info->si_pid ? (void)0 : check_stack_overflow(sig, FAULT_ADDRESS))
|
||||||
# endif
|
# endif
|
||||||
# define MESSAGE_FAULT_ADDRESS " at %p", FAULT_ADDRESS
|
# define MESSAGE_FAULT_ADDRESS " at %p", FAULT_ADDRESS
|
||||||
# endif
|
# endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue