Block SIGINT and SIGALRM in signal handlers.
This commit is contained in:
parent
2b27fcd9bf
commit
e4a98ec195
|
@ -37,6 +37,8 @@ typedef struct
|
|||
# error You must define GET_IP for this CPU
|
||||
#endif
|
||||
|
||||
extern void SIGNAL_Unblock(void);
|
||||
|
||||
void WINAPI EXC_RtlRaiseException( PEXCEPTION_RECORD, PCONTEXT );
|
||||
void WINAPI EXC_RtlUnwind( PEXCEPTION_FRAME, LPVOID,
|
||||
PEXCEPTION_RECORD, DWORD, PCONTEXT );
|
||||
|
@ -174,6 +176,8 @@ void WINAPI EXC_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
|
||||
if (send_debug_event( rec, TRUE, context ) == DBG_CONTINUE) return; /* continue execution */
|
||||
|
||||
SIGNAL_Unblock(); /* we may be in a signal handler, and exception handlers may jump out */
|
||||
|
||||
frame = NtCurrentTeb()->except;
|
||||
nested_frame = NULL;
|
||||
while (frame != (PEXCEPTION_FRAME)0xFFFFFFFF)
|
||||
|
|
|
@ -346,6 +346,8 @@ typedef struct
|
|||
|
||||
DEFAULT_DEBUG_CHANNEL(seh);
|
||||
|
||||
static sigset_t all_sigs;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_trap_code
|
||||
|
@ -617,6 +619,17 @@ static inline DWORD get_fpu_code( const CONTEXT *context )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SIGNAL_Unblock
|
||||
*
|
||||
* Unblock signals. Called from EXC_RtlRaiseException.
|
||||
*/
|
||||
void SIGNAL_Unblock( void )
|
||||
{
|
||||
sigprocmask( SIG_UNBLOCK, &all_sigs, NULL );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* do_segv
|
||||
*
|
||||
|
@ -840,8 +853,9 @@ static int set_handler( int sig, int have_sigaltstack, void (*func)() )
|
|||
{
|
||||
struct kernel_sigaction sig_act;
|
||||
sig_act.ksa_handler = func;
|
||||
sig_act.ksa_flags = SA_RESTART | SA_NOMASK;
|
||||
sig_act.ksa_mask = 0;
|
||||
sig_act.ksa_flags = SA_RESTART;
|
||||
sig_act.ksa_mask = (1 << (SIGINT-1)) |
|
||||
(1 << (SIGALRM-1));
|
||||
/* point to the top of the stack */
|
||||
sig_act.ksa_restorer = (char *)NtCurrentTeb()->signal_stack + SIGNAL_STACK_SIZE;
|
||||
return wine_sigaction( sig, &sig_act, NULL );
|
||||
|
@ -849,9 +863,11 @@ static int set_handler( int sig, int have_sigaltstack, void (*func)() )
|
|||
#endif /* linux */
|
||||
sig_act.sa_handler = func;
|
||||
sigemptyset( &sig_act.sa_mask );
|
||||
sigaddset( &sig_act.sa_mask, SIGINT );
|
||||
sigaddset( &sig_act.sa_mask, SIGALRM );
|
||||
|
||||
#ifdef linux
|
||||
sig_act.sa_flags = SA_RESTART | SA_NOMASK;
|
||||
sig_act.sa_flags = SA_RESTART;
|
||||
#elif defined (__svr4__) || defined(_SCO_DS)
|
||||
sig_act.sa_flags = SA_SIGINFO | SA_RESTART;
|
||||
#else
|
||||
|
@ -887,7 +903,9 @@ BOOL SIGNAL_Init(void)
|
|||
#endif /* linux */
|
||||
}
|
||||
#endif /* HAVE_SIGALTSTACK */
|
||||
|
||||
|
||||
sigfillset( &all_sigs );
|
||||
|
||||
/* automatic child reaping to avoid zombies */
|
||||
signal( SIGCHLD, SIG_IGN );
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
DEFAULT_DEBUG_CHANNEL(seh);
|
||||
|
||||
static sigset_t all_sigs;
|
||||
|
||||
/*
|
||||
* FIXME: All this works only on Solaris for now
|
||||
|
@ -325,6 +326,17 @@ static int set_handler( int sig, void (*func)() )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SIGNAL_Unblock
|
||||
*
|
||||
* Unblock signals. Called from EXC_RtlRaiseException.
|
||||
*/
|
||||
void SIGNAL_Unblock( void )
|
||||
{
|
||||
sigprocmask( SIG_UNBLOCK, &all_sigs, NULL );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* SIGNAL_Init
|
||||
*/
|
||||
|
@ -335,6 +347,8 @@ BOOL SIGNAL_Init(void)
|
|||
/* automatic child reaping to avoid zombies */
|
||||
signal( SIGCHLD, SIG_IGN );
|
||||
|
||||
sigfillset( &all_sigs );
|
||||
|
||||
if (set_handler( SIGINT, (void (*)())int_handler ) == -1) goto error;
|
||||
if (set_handler( SIGFPE, (void (*)())fpe_handler ) == -1) goto error;
|
||||
if (set_handler( SIGSEGV, (void (*)())segv_handler ) == -1) goto error;
|
||||
|
|
Loading…
Reference in New Issue