From 419c235dccfefc89d93d73b2e28612d42f8eff6b Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 30 Nov 2024 17:35:49 +1300 Subject: [PATCH] Reset signal handlers to default in case this is a detach-teleport child --- CMakeLists.txt | 1 + src/Task.cc | 5 +++++ src/test/nested_release_signal.run | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 src/test/nested_release_signal.run diff --git a/CMakeLists.txt b/CMakeLists.txt index 03e0a386548..16ea31410a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1567,6 +1567,7 @@ set(TESTS_WITH_PROGRAM mutex_pi_stress nested_detach_wait nested_detach_kill_stuck + nested_release_signal overflow_branch_counter pack patch_page_end diff --git a/src/Task.cc b/src/Task.cc index 73c258e4f4b..91e966863d9 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -3561,6 +3561,11 @@ static void set_up_process(Session& session, const ScopedFd& err_fd, TraceeAttentionSet::get_original_sigmask(&sigmask); sigprocmask(SIG_SETMASK, &sigmask, nullptr); + // Stop igoring signals. + for (int sig = 1; sig <= 31; ++sig) { + signal(sig, SIG_DFL); + } + struct NativeArch::cap_header header = {.version = _LINUX_CAPABILITY_VERSION_3, .pid = 0 }; diff --git a/src/test/nested_release_signal.run b/src/test/nested_release_signal.run new file mode 100644 index 00000000000..e875160eac0 --- /dev/null +++ b/src/test/nested_release_signal.run @@ -0,0 +1,3 @@ +source `dirname $0`/util.sh +just_record $RR_EXE "record --nested=detach nested_release_signal$bitness" && failed "error not propagated" +passed