Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sigaction: handle null sa_sigaction as SIG_DFL
As the comment of the issue #1047 - #1047 (comment) - explains, Linux treats null value of the sa_sigaction parameter of the sigaction() function as SIG_DFL even if SA_SIGINFO is set per sa_flags parameter. This behavior does not seem to be standard as this stack overflow - https://stackoverflow.com/questions/24079875/what-does-it-mean-if-sa-sigaction-is-set-to-null-when-calling-sigaction - explains and probably stems from the fact that both sa_sigaction and sa_handler are fields of the same union. The above means, that if sa_sigaction is null we should treat it the same same as if sa_handler == SIG_DFL and invoke default signal handler if any when corresponding signal arrived. To that effect this patch refines is_sig_dfl() helper function to implemented the expected behavior. Finally this patch adds new test - tst-sigaction.cc - that can be built and run on both Linux and OSv to verify the same handling of null sa_sigaction. Ideally, we would have wanted to expand existing tst-kill.cc test, however we need a separate test to verify the default action to terminate the app when SIGTERM is received is testable. Fixes #1047 Signed-off-by: Waldemar Kozaczuk <[email protected]>
- Loading branch information