diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2025-02-12 08:18:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-12 08:18:58 -0500 |
| commit | 8edcdf014938ef5edd42f620d7efe2928d6a7572 (patch) | |
| tree | 1eb0b85eec9734fcb05ebaaac9835efac07776e1 /lib/sigevent.h | |
| parent | 57c152832b190c8ae0f01e09b3f79fcaa1693a36 (diff) | |
| parent | cbcc66c5d6c05414d3123f85eed0b4a38e628fa2 (diff) | |
Merge pull request #18101 from FRRouting/mergify/bp/dev/10.3/pr-18060
lib: crash handlers must be allowed on threads (backport #18060)
Diffstat (limited to 'lib/sigevent.h')
| -rw-r--r-- | lib/sigevent.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/sigevent.h b/lib/sigevent.h index 0b07f594c1..2c51ba3767 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -45,6 +45,33 @@ bool frr_sigevent_check(sigset_t *setp); /* check whether there are signals to handle, process any found */ extern int frr_sigevent_process(void); +/* Ensure we don't handle "application-type" signals on a secondary thread by + * blocking these signals when creating threads + * + * NB: SIGSEGV, SIGABRT, etc. must be allowed on all threads or we get no + * crashlogs. Since signals vary a little bit between platforms, below is a + * list of known things to go to the main thread. Any unknown signals should + * stay thread-local. + */ +static inline void frr_sigset_add_mainonly(sigset_t *blocksigs) +{ + /* signals we actively handle */ + sigaddset(blocksigs, SIGHUP); + sigaddset(blocksigs, SIGINT); + sigaddset(blocksigs, SIGTERM); + sigaddset(blocksigs, SIGUSR1); + + /* signals we don't actively use but that semantically belong */ + sigaddset(blocksigs, SIGUSR2); + sigaddset(blocksigs, SIGQUIT); + sigaddset(blocksigs, SIGCHLD); + sigaddset(blocksigs, SIGPIPE); + sigaddset(blocksigs, SIGTSTP); + sigaddset(blocksigs, SIGTTIN); + sigaddset(blocksigs, SIGTTOU); + sigaddset(blocksigs, SIGWINCH); +} + #ifdef __cplusplus } #endif |
