patch 'app/pdump: handle SIGTERM and SIGHUP' has been queued to stable release 23.11.2
Xueming Li
xuemingl at nvidia.com
Mon Aug 12 14:50:18 CEST 2024
Hi,
FYI, your patch has been queued to stable release 23.11.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=52bf7488c319917236142521b2190d8d23ad225d
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 52bf7488c319917236142521b2190d8d23ad225d Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Wed, 3 Jul 2024 08:45:44 -0700
Subject: [PATCH] app/pdump: handle SIGTERM and SIGHUP
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit e1253df666fdc672bc378722db0da2ce3091a8dd ]
The pdump application will leak ring and memory pool if killed
by SIGTERM. Like dumpcap, the pdump process should cleanup
if process terminates due to being killed or hangup.
Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/pdump/main.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index a9205e130b..3592f8a865 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -571,11 +571,9 @@ disable_primary_monitor(void)
}
static void
-signal_handler(int sig_num)
+signal_handler(int sig_num __rte_unused)
{
- if (sig_num == SIGINT) {
- quit_signal = 1;
- }
+ quit_signal = 1;
}
static inline int
@@ -975,6 +973,11 @@ enable_primary_monitor(void)
int
main(int argc, char **argv)
{
+ struct sigaction action = {
+ .sa_flags = SA_RESTART,
+ .sa_handler = signal_handler,
+ };
+ struct sigaction origaction;
int diag;
int ret;
int i;
@@ -983,8 +986,14 @@ main(int argc, char **argv)
char mp_flag[] = "--proc-type=secondary";
char *argp[argc + 2];
- /* catch ctrl-c so we can print on exit */
- signal(SIGINT, signal_handler);
+ /* catch ctrl-c so we can cleanup on exit */
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGTERM, &action, NULL);
+ sigaction(SIGINT, &action, NULL);
+ sigaction(SIGPIPE, &action, NULL);
+ sigaction(SIGHUP, NULL, &origaction);
+ if (origaction.sa_handler == SIG_DFL)
+ sigaction(SIGHUP, &action, NULL);
argp[0] = argv[0];
argp[1] = n_flag;
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-08-12 20:44:06.972453145 +0800
+++ 0141-app-pdump-handle-SIGTERM-and-SIGHUP.patch 2024-08-12 20:44:02.555069385 +0800
@@ -1 +1 @@
-From e1253df666fdc672bc378722db0da2ce3091a8dd Mon Sep 17 00:00:00 2001
+From 52bf7488c319917236142521b2190d8d23ad225d Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit e1253df666fdc672bc378722db0da2ce3091a8dd ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
@@ -19 +21 @@
-index 3bdbb8dc78..fa85859703 100644
+index a9205e130b..3592f8a865 100644
More information about the stable
mailing list