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 E269A46BAE for ; Fri, 18 Jul 2025 21:36:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D8E3240611; Fri, 18 Jul 2025 21:36:05 +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 D106B40611 for ; Fri, 18 Jul 2025 21:36:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752867363; 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=6Uk3DmlQ2lqo1cMzlu7kQLX2iWFASee1ASS8ptw0/8s=; b=LxEn21Xxsgihij+h11ZZCKnMZMmro1dTrbNWHqvur8/3W5/Ajp6E1jLGiaqfzQhoKTi7r7 YR/gsHQTMsrbE0/1qfhtpQ0BkBVemlA3lc3kbzA0DE2QS3Dh3mxQqgNZb+OspGKSFbOIRN qOxTb4+xfKQdpw0xdX1rKE3Kykt4iAo= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-63-lQvYYpBmMaW30L9ZnETiXg-1; Fri, 18 Jul 2025 15:36:00 -0400 X-MC-Unique: lQvYYpBmMaW30L9ZnETiXg-1 X-Mimecast-MFC-AGG-ID: lQvYYpBmMaW30L9ZnETiXg_1752867359 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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C330F180028C; Fri, 18 Jul 2025 19:35:58 +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 D410B18003FC; Fri, 18 Jul 2025 19:35:56 +0000 (UTC) From: Kevin Traynor To: Rui Ferreira Cc: Konstantin Ananyev , Thomas Monjalon , dpdk stable Subject: patch 'eal/linux: unregister alarm callback before free' has been queued to stable release 24.11.3 Date: Fri, 18 Jul 2025 20:30:22 +0100 Message-ID: <20250718193247.1008129-88-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: ZBE8OtQHsRQxjUWXHGZsCM6889M8SKUE7saY5zXQw18_1752867359 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/28861cd46f6c52379a43e43059aa0ade08a180ce Thanks. Kevin --- >From 28861cd46f6c52379a43e43059aa0ade08a180ce Mon Sep 17 00:00:00 2001 From: Rui Ferreira Date: Fri, 30 May 2025 09:18:43 +0100 Subject: [PATCH] eal/linux: unregister alarm callback before free [ upstream commit d84bf0d9aeb474d89a412b6af8e947b16bfcb895 ] This was flagged by Address sanitizer as a use after free. The intr_handle ptr is shared between the main thread and the interrupt thread. The interrupt thread can dereference the ptr after free (from the alarm callback). free is called when the main thread cleans up. The interrupt thread never terminates (eal_intr_thread_main) so use rte_intr_callback_unregister_sync during cleanup to ensure the callback is removed before freeing the ptr. To be more defensive clear out the pointer and registration variable 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: Konstantin Ananyev Signed-off-by: Thomas Monjalon --- .mailmap | 1 + lib/eal/linux/eal.c | 2 +- lib/eal/linux/eal_alarm.c | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 9211e53fc7..2acdcfd272 100644 --- a/.mailmap +++ b/.mailmap @@ -1325,4 +1325,5 @@ Roy Franz Roy Pledge Roy Shterman +Rui Ferreira Ruifeng Wang Rushil Gupta diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index b1e63e37fc..a13d8f559a 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1324,8 +1324,8 @@ rte_eal_cleanup(void) rte_mp_channel_cleanup(); eal_bus_cleanup(); + rte_eal_alarm_cleanup(); rte_trace_save(); eal_trace_fini(); eal_mp_dev_hotplug_cleanup(); - rte_eal_alarm_cleanup(); /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c index 9fe14ade63..44748c7650 100644 --- a/lib/eal/linux/eal_alarm.c +++ b/lib/eal/linux/eal_alarm.c @@ -57,5 +57,12 @@ 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; + handler_registered = 0; + } } -- 2.50.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-07-18 20:29:14.068439178 +0100 +++ 0088-eal-linux-unregister-alarm-callback-before-free.patch 2025-07-18 20:29:10.994907527 +0100 @@ -1 +1 @@ -From d84bf0d9aeb474d89a412b6af8e947b16bfcb895 Mon Sep 17 00:00:00 2001 +From 28861cd46f6c52379a43e43059aa0ade08a180ce Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit d84bf0d9aeb474d89a412b6af8e947b16bfcb895 ] + @@ -24 +25,0 @@ -Cc: stable@dpdk.org @@ -36 +37 @@ -index fb90483bee..9135f06efc 100644 +index 9211e53fc7..2acdcfd272 100644 @@ -39 +40 @@ -@@ -1340,4 +1340,5 @@ Roy Franz +@@ -1325,4 +1325,5 @@ Roy Franz @@ -44 +45 @@ - Rupesh Chiluka + Rushil Gupta @@ -46 +47 @@ -index 20f777b8b0..de90ab3b86 100644 +index b1e63e37fc..a13d8f559a 100644 @@ -49 +50 @@ -@@ -1329,8 +1329,8 @@ rte_eal_cleanup(void) +@@ -1324,8 +1324,8 @@ rte_eal_cleanup(void) @@ -60 +61 @@ -index b216a007a3..eb6a21d4f0 100644 +index 9fe14ade63..44748c7650 100644 @@ -63 +64 @@ -@@ -58,5 +58,12 @@ void +@@ -57,5 +57,12 @@ void