mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Unblock SIGFPE, SIGILL, SIGSEGV and SIGBUS for threads.
According to POSIX, behavior is unspecified if a specific thread receives one of those signals (because of e.g. executing an invalid instruction) if the signal is blocked. This resulted in segfaults in threads not propagating to the main thread. Adresses #848
This commit is contained in:
parent
8ff8c66655
commit
e1bd960926
1 changed files with 7 additions and 0 deletions
|
@ -164,6 +164,13 @@ void* BasicThread::launcher(void *arg)
|
|||
// process.
|
||||
sigset_t mask_set;
|
||||
sigfillset(&mask_set);
|
||||
// Unblock the signals where according to POSIX the result is undefined if they are blocked
|
||||
// in a thread and received by that thread. If those are not unblocked, threads will just
|
||||
// hang when they crash without the user being notified.
|
||||
sigdelset(&mask_set, SIGFPE);
|
||||
sigdelset(&mask_set, SIGILL);
|
||||
sigdelset(&mask_set, SIGSEGV);
|
||||
sigdelset(&mask_set, SIGBUS);
|
||||
int res = pthread_sigmask(SIG_BLOCK, &mask_set, 0);
|
||||
assert(res == 0); //
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue