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: [email protected]
Reported-by: Sunyang Wu <[email protected]>
Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
---
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