From eabeca26dfa20e5a0cf1417922d66241b92b1913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B2=E1=84=8E=E1=85=A1=E1=86=BC=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=AB=20Enoch?= Date: Thu, 12 Feb 2026 00:47:15 +0900 Subject: [PATCH] Add SA_RESETHAND to SIGSEGV handler to prevent infinite signal loop --- src/ddprof.cc | 2 +- test/simple_malloc.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ddprof.cc b/src/ddprof.cc index 971407e29..30a49940f 100644 --- a/src/ddprof.cc +++ b/src/ddprof.cc @@ -92,7 +92,7 @@ DDRes ddprof_setup(DDProfContext &ctx) { if (ctx.params.fault_info) { struct sigaction sigaction_handlers = {}; sigaction_handlers.sa_sigaction = sigsegv_handler; - sigaction_handlers.sa_flags = SA_SIGINFO; + sigaction_handlers.sa_flags = SA_SIGINFO | SA_RESETHAND; sigaction(SIGSEGV, &(sigaction_handlers), nullptr); } diff --git a/test/simple_malloc.cc b/test/simple_malloc.cc index 140a3bdc7..2c55165c4 100644 --- a/test/simple_malloc.cc +++ b/test/simple_malloc.cc @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) { try { struct sigaction sigaction_handlers = {}; sigaction_handlers.sa_sigaction = sigsegv_handler; - sigaction_handlers.sa_flags = SA_SIGINFO; + sigaction_handlers.sa_flags = SA_SIGINFO | SA_RESETHAND; sigaction(SIGSEGV, &(sigaction_handlers), nullptr); CLI::App app{"Simple allocation test"};