diff --git a/SOURCES/bz1422573_1-dont-override-user-signals.patch b/SOURCES/bz1422573_1-dont-override-user-signals.patch new file mode 100644 index 0000000..4fb0b79 --- /dev/null +++ b/SOURCES/bz1422573_1-dont-override-user-signals.patch @@ -0,0 +1,20 @@ +commit e336b716cce83b3af414a1dcc4c2ef22c591d73f +Author: Christine Caulfield +Date: Fri Feb 24 16:36:35 2017 +0000 + + loop: Also set signals changed in qb_loop_signal_mod() back to SIG_DFL + + Signed-off-by: Christine Caulfield + +diff --git a/lib/loop_poll.c b/lib/loop_poll.c +index 386cae6..cd2474e 100644 +--- a/lib/loop_poll.c ++++ b/lib/loop_poll.c +@@ -723,6 +723,7 @@ qb_loop_signal_mod(qb_loop_t * lp, + sig->p = p; + + if (sig->signal != the_sig) { ++ signal(sig->signal, SIG_DFL); + sig->signal = the_sig; + _adjust_sigactions_(s); + } diff --git a/SOURCES/bz1422573_2-dont-override-user-signals.patch b/SOURCES/bz1422573_2-dont-override-user-signals.patch new file mode 100644 index 0000000..ec02090 --- /dev/null +++ b/SOURCES/bz1422573_2-dont-override-user-signals.patch @@ -0,0 +1,82 @@ +commit c751993c901805cc5cd02622c8672bbc7f8d6849 +Author: Christine Caulfield +Date: Fri Feb 24 16:23:43 2017 +0000 + + loop: don't override external signal handlers + + qb_loop_signal_add() used to set any signals it wasn't managing + back to SIG_DFL. This is unfriendly behaviour in a library. + + Signed-off-by: Christine Caulfield + Reviewed-by: Jan Pokorný + +diff --git a/lib/loop_poll.c b/lib/loop_poll.c +index 5c75748..386cae6 100644 +--- a/lib/loop_poll.c ++++ b/lib/loop_poll.c +@@ -643,8 +643,6 @@ _adjust_sigactions_(struct qb_signal_source *s) + if (needed) { + sigaddset(&s->signal_superset, i); + sigaction(i, &sa, NULL); +- } else { +- (void)signal(i, SIG_DFL); + } + } + } +@@ -775,6 +773,7 @@ qb_loop_signal_del(qb_loop_t * lp, qb_loop_signal_handle handle) + } + + qb_list_del(&sig->item.list); ++ signal(sig->signal, SIG_DFL); + free(sig); + _adjust_sigactions_(s); + return 0; +diff --git a/tests/check_loop.c b/tests/check_loop.c +index ff7f10a..0be5c21 100644 +--- a/tests/check_loop.c ++++ b/tests/check_loop.c +@@ -605,6 +605,36 @@ START_TEST(test_loop_sig_handling) + } + END_TEST + ++/* Globals for this test only */ ++static int our_signal_called = 0; ++static qb_loop_t *this_l; ++static void handle_nonqb_signal(int num) ++{ ++ our_signal_called = 1; ++ qb_loop_job_add(this_l, QB_LOOP_LOW, NULL, job_stop); ++} ++ ++START_TEST(test_loop_dont_override_other_signals) ++{ ++ qb_loop_signal_handle handle; ++ ++ this_l = qb_loop_create(); ++ fail_if(this_l == NULL); ++ ++ signal(SIGUSR1, handle_nonqb_signal); ++ ++ qb_loop_signal_add(this_l, QB_LOOP_HIGH, SIGINT, ++ this_l, sig_handler, &handle); ++ kill(getpid(), SIGUSR1); ++ qb_loop_run(this_l); ++ ++ ck_assert_int_eq(our_signal_called, 1); ++ ++ qb_loop_destroy(this_l); ++} ++END_TEST ++ ++ + START_TEST(test_loop_sig_only_get_one) + { + int res; +@@ -706,6 +736,7 @@ loop_signal_suite(void) + add_tcase(s, tc, test_loop_sig_handling, 10); + add_tcase(s, tc, test_loop_sig_only_get_one); + add_tcase(s, tc, test_loop_sig_delete); ++ add_tcase(s, tc, test_loop_dont_override_other_signals); + + return s; + } diff --git a/SPECS/libqb.spec b/SPECS/libqb.spec index ba00eed..e87a4f7 100644 --- a/SPECS/libqb.spec +++ b/SPECS/libqb.spec @@ -1,6 +1,6 @@ Name: libqb Version: 1.0.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: An IPC library for high performance servers Group: System Environment/Libraries @@ -11,6 +11,8 @@ Source0: https://github.com/ClusterLabs/%{name}/releases/download/v%{vers Patch1: bz1422454-ipc-detect-corrupt-shm-in-peek.patch Patch2: bz1446254-ipc-allow-fs-sockets.patch Patch3: bz1459276-dont-truncate-in-client.patch +Patch4: bz1422573_1-dont-override-user-signals.patch +Patch5: bz1422573_2-dont-override-user-signals.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -27,6 +29,8 @@ Initially these are IPC and poll. %patch1 -p1 -b .bz1422454-ipc-detect-corrupt-shm-in-peek %patch2 -p1 -b .bz1446254-ipc-allow-fs-sockets %patch3 -p1 -b .bz1459276-dont-truncate-in-client.patch +%patch4 -p1 -b .bz1422573_1-dont-override-user-signals.patch +%patch5 -p1 -b .bz1422573_2-dont-override-user-signals.patch # work-around for broken epoll in rawhide/f17 %build @@ -76,6 +80,10 @@ developing applications that use %{name}. %changelog +* Fri Nov 03 2017 Christine Caulfield - 1.0.1-6 + Don't override external signal handlers + Resolves: rhbz#1422573 + * Tue Jun 27 2017 Christine Caulfield - 1.0.1-5 Put backpatch 189ca28 as it's not the culprit