[PATCH v2] app/test-pmd: terminate process on second signal

Stephen Hemminger stephen at networkplumber.org
Tue Apr 28 15:52:48 CEST 2026


The SIGINT/SIGTERM handler starts a graceful shutdown via
prompt_exit(), after which prompt() frees the cmdline object with
cmdline_stdin_exit(). A second signal delivered during or after
that free re-enters prompt_exit() and dereferences testpmd_cl,
producing a use-after-free.

Reset both signals to SIG_DFL so the process will immediately
exit if second signal arrives.

Fixes: f1d0993e034e ("app/testpmd: fix interactive mode on Windows")
Cc: stable at dpdk.org
Reported-by: Sunyang Wu <sunyang.wu at jaguarmicro.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
v2 - handle the case of SIGINT followed by SIGTERM

 app/test-pmd/testpmd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e2569d9e30..59372838a5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4555,6 +4555,8 @@ print_stats(void)
 static void
 signal_handler(int signum __rte_unused)
 {
+	signal(SIGINT, SIG_DFL);
+	signal(SIGTERM, SIG_DFL);
 	f_quit = 1;
 	prompt_exit();
 }
-- 
2.53.0



More information about the stable mailing list