From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06E1C46BAE for ; Fri, 18 Jul 2025 21:36:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0178D40611; Fri, 18 Jul 2025 21:36:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8924C40E42 for ; Fri, 18 Jul 2025 21:36:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752867366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2zhEScNNgDSnu6vlPLkGI+EgQ/hCu0svF4Ipe5IIzUQ=; b=NxUcqL1X/PB8Df9VPXlSut/FngRS4R0GY/29JAaDdP7eZJQmr+D8r+I69Fb/IN5ZORBNJZ jUu4/fsU44uylsKqOehgqksQMzlHzfA/9pPyc6Qs0LIpf7RNswuPQpCWsXUK3xFOkBl4Sy pcQohIln57T7RiOJrUwL965F5Vcf6JE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-UzOp77t6MS-lKiGPvrL_0g-1; Fri, 18 Jul 2025 15:36:02 -0400 X-MC-Unique: UzOp77t6MS-lKiGPvrL_0g-1 X-Mimecast-MFC-AGG-ID: UzOp77t6MS-lKiGPvrL_0g_1752867361 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 500C019560B2; Fri, 18 Jul 2025 19:36:01 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.40]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 48E2F18003FC; Fri, 18 Jul 2025 19:35:59 +0000 (UTC) From: Kevin Traynor To: Rui Ferreira Cc: Bruce Richardson , Thomas Monjalon , dpdk stable Subject: patch 'eal/freebsd: unregister alarm callback before free' has been queued to stable release 24.11.3 Date: Fri, 18 Jul 2025 20:30:23 +0100 Message-ID: <20250718193247.1008129-89-ktraynor@redhat.com> In-Reply-To: <20250718193247.1008129-1-ktraynor@redhat.com> References: <20250718193247.1008129-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: azM9iAfM40RGv5U3p0gvaBcJxiSZFmnYzLK7TbkZZW8_1752867361 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 24.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/23/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/0fce285ecb5e64805f02ff05c11ede111eb90816 Thanks. Kevin --- >From 0fce285ecb5e64805f02ff05c11ede111eb90816 Mon Sep 17 00:00:00 2001 From: Rui Ferreira Date: Fri, 30 May 2025 09:18:44 +0100 Subject: [PATCH] eal/freebsd: unregister alarm callback before free [ 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 Acked-by: Bruce Richardson Signed-off-by: Thomas Monjalon --- 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 d07cff8651..2cb693a90b 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -902,7 +902,7 @@ rte_eal_cleanup(void) 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(); diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c index 3680f5caba..65e8a4eb6b 100644 --- a/lib/eal/freebsd/eal_alarm.c +++ b/lib/eal/freebsd/eal_alarm.c @@ -50,5 +50,11 @@ 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; + } } -- 2.50.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-07-18 20:29:14.102706320 +0100 +++ 0089-eal-freebsd-unregister-alarm-callback-before-free.patch 2025-07-18 20:29:10.995907530 +0100 @@ -1 +1 @@ -From cf1937a96dcf63f6e00e3181654a845edb1fd682 Mon Sep 17 00:00:00 2001 +From 0fce285ecb5e64805f02ff05c11ede111eb90816 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit cf1937a96dcf63f6e00e3181654a845edb1fd682 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index d6fffa2170..45adfad668 100644 +index d07cff8651..2cb693a90b 100644 @@ -31 +32 @@ -@@ -907,7 +907,7 @@ rte_eal_cleanup(void) +@@ -902,7 +902,7 @@ rte_eal_cleanup(void) @@ -41 +42 @@ -index 28f285fdef..c03e281e67 100644 +index 3680f5caba..65e8a4eb6b 100644 @@ -44 +45 @@ -@@ -51,5 +51,11 @@ void +@@ -50,5 +50,11 @@ void