patch 'eal/freebsd: unregister alarm callback before free' has been queued to stable release 23.11.5
Xueming Li
xuemingl at nvidia.com
Thu Jun 26 14:01:36 CEST 2025
Hi,
FYI, your patch has been queued to stable release 23.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/28/25. 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=fd527a32b73d9ad30e41ae138f0bfd60084bca2b
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From fd527a32b73d9ad30e41ae138f0bfd60084bca2b Mon Sep 17 00:00:00 2001
From: Rui Ferreira <rui.ferreira1 at h-partners.com>
Date: Fri, 30 May 2025 09:18:44 +0100
Subject: [PATCH] eal/freebsd: unregister alarm callback before free
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit cf1937a96dcf63f6e00e3181654a845edb1fd682 ]
Unregister callback on cleanup to avoid use after free from the
interrupt thread (eal_intr_thread_main).
To be more defensive, set ptr to NULL if we can unregister.
rte_intr_callback_unregister_sync may (optionally) use traces
so the alarm cleanup must happen before eal_trace_fini to avoid
accessing freed memory.
Bugzilla ID: 1683
Fixes: 90b13ab8d4f7 ("alarm: remove direct access to interrupt handle")
Signed-off-by: Rui Ferreira <rui.ferreira1 at h-partners.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
lib/eal/freebsd/eal.c | 2 +-
lib/eal/freebsd/eal_alarm.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 568e06e9ed..eb62bfdcd3 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -927,9 +927,9 @@ rte_eal_cleanup(void)
rte_service_finalize();
rte_mp_channel_cleanup();
eal_bus_cleanup();
+ rte_eal_alarm_cleanup();
rte_trace_save();
eal_trace_fini();
- rte_eal_alarm_cleanup();
/* after this point, any DPDK pointers will become dangling */
rte_eal_memory_detach();
eal_cleanup_config(internal_conf);
diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c
index e5b0909a45..965f729157 100644
--- a/lib/eal/freebsd/eal_alarm.c
+++ b/lib/eal/freebsd/eal_alarm.c
@@ -49,7 +49,13 @@ static void eal_alarm_callback(void *arg);
void
rte_eal_alarm_cleanup(void)
{
- rte_intr_instance_free(intr_handle);
+ /* unregister callback using intr_handle in interrupt thread */
+ int ret = rte_intr_callback_unregister_sync(intr_handle,
+ eal_alarm_callback, (void *)-1);
+ if (ret >= 0) {
+ rte_intr_instance_free(intr_handle);
+ intr_handle = NULL;
+ }
}
int
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-06-26 19:59:20.596366410 +0800
+++ 0076-eal-freebsd-unregister-alarm-callback-before-free.patch 2025-06-26 19:59:17.502418039 +0800
@@ -1 +1 @@
-From cf1937a96dcf63f6e00e3181654a845edb1fd682 Mon Sep 17 00:00:00 2001
+From fd527a32b73d9ad30e41ae138f0bfd60084bca2b Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit cf1937a96dcf63f6e00e3181654a845edb1fd682 ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org
@@ -28 +30 @@
-index d6fffa2170..45adfad668 100644
+index 568e06e9ed..eb62bfdcd3 100644
@@ -31 +33 @@
-@@ -906,9 +906,9 @@ rte_eal_cleanup(void)
+@@ -927,9 +927,9 @@ rte_eal_cleanup(void)
@@ -43 +45 @@
-index 28f285fdef..c03e281e67 100644
+index e5b0909a45..965f729157 100644
@@ -46 +48 @@
-@@ -50,7 +50,13 @@ static void eal_alarm_callback(void *arg);
+@@ -49,7 +49,13 @@ static void eal_alarm_callback(void *arg);
More information about the stable
mailing list