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 A5DE1470E5 for ; Thu, 25 Dec 2025 10:24:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7ED7C402B2; Thu, 25 Dec 2025 10:24:11 +0100 (CET) Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11011006.outbound.protection.outlook.com [52.101.52.6]) by mails.dpdk.org (Postfix) with ESMTP id 3607840658 for ; Thu, 25 Dec 2025 10:24:10 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L+DSC7OvBO//AdpSYXCOI3JQewlwrQmci9pTmb6W+VhccnoaBss16npibIwKURypqtg0IRTV4bbdVX4jYXZAi2PK0IM9cr9+QTzA7CQEjEN3YohfxfrEa+TMTVGI9CPjhTKezdpj4g6UCGe1+ojXTfI57EA/z6R8mfolvolBHfk1IGG9iUPJHIMB/kvcqFOJEjKC014O/0rua3Nfxym9jGHHmkX5pQNo4wcSG9SGDD4/V6uaZQCBmnB9sdr6910tT30vFY6arLIdzviVLPdlILklwsgg+u+IuqdRNhDtpnQHIxvnKjwk7dqHuqSCKyJJKRIp7vDUQtM8yAXRpxShLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1PayvBMpUowsguJziFnPixUBhwDRImL9oxRN3KSROkI=; b=y7uOE9H/R6vfOgSx51EDnoUpSQclcruIPl+4lu5Lbz/d6Cl3720U8d216vwK9VbK2puICHvgvxXkcsJtAcBThaalJ6cRpidxiT53Yzxr7NqFSSltDKX9eiiatogGav6pcKTcjYTqDdaUJn2o+sTkABmugajFuS8HmT51C7FV6dPq1VIbpXDMZHvxD5ia0RpvOHPVtchnZv5ICB9lVz+GpUga6BVohYkkBbUdbDJjqF993UVxNEbo3qxVE/9F2t/zUWOKjAQrblzY0JBjS9d+F34isKOayH9QZ0wAUsaid18LfKkhh7EC63JL2Tc8V+oSK9K58uK9HGV9aCfJGq13Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1PayvBMpUowsguJziFnPixUBhwDRImL9oxRN3KSROkI=; b=aiE21T+4Gi9U3LVNVYekjCAwhe6JiHnwJm9iPMrr1uJt6uVP0SVIT8kVG31De9qPgdQGTCgek89VGRHSfZjAD8LP7SxgR6c4iNOMRrOL4ivc8K36NEFiSchSNTAiwI+lagEfv4driWlHPc19P6Px+pkaRVENMWf2yIOKyOyL2EOVBOBsHgQEOgvsjKK2G8dr8wfAKTdMwn6wRGs2Fju490K8o4KsP/nMuCW/AFKxThKc8so/29cZIQ5s0MUyEw3w4Jumuv4S4PhaYzlPcQhURWDhrecBGZnxNtL9ef0u808iktMxpG+Q793XsSogTd43A30u2YTE4d9KzI6QXvrsgg== Received: from SA0PR11CA0084.namprd11.prod.outlook.com (2603:10b6:806:d2::29) by SA1PR12MB8120.namprd12.prod.outlook.com (2603:10b6:806:331::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9456.11; Thu, 25 Dec 2025 09:24:05 +0000 Received: from SA2PEPF00003AE4.namprd02.prod.outlook.com (2603:10b6:806:d2:cafe::11) by SA0PR11CA0084.outlook.office365.com (2603:10b6:806:d2::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9456.11 via Frontend Transport; Thu, 25 Dec 2025 09:24:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SA2PEPF00003AE4.mail.protection.outlook.com (10.167.248.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9456.9 via Frontend Transport; Thu, 25 Dec 2025 09:24:05 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 25 Dec 2025 01:23:56 -0800 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 25 Dec 2025 01:23:56 -0800 Received: from nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Thu, 25 Dec 2025 01:23:54 -0800 From: Shani Peretz To: Robin Jarry CC: Jerin Jacob , dpdk stable Subject: patch 'graph: fix updating edge with active graph' has been queued to stable release 23.11.6 Date: Thu, 25 Dec 2025 11:18:23 +0200 Message-ID: <20251225091938.345892-62-shperetz@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251225091938.345892-1-shperetz@nvidia.com> References: <20251221145746.763179-93-shperetz@nvidia.com> <20251225091938.345892-1-shperetz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE4:EE_|SA1PR12MB8120:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e3e0020-c031-4323-dce4-08de4397596b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013|13003099007|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?aEd9MyNxuXdWp1rLnfW8ts1G17wUKXo3FQnRTevG+XOpfTQXNqG2cFhauQJt?= =?us-ascii?Q?CUgPwCndQHvQE6kKi/yjNDTvxRxXVoxdXOO0MWzBnBHqiogWzNBBmDbAKUcT?= =?us-ascii?Q?GdtnYAaupzH7pIu4CI/ylVtrpc+sAr9HbKNvduVK4azWbPns5P6FCSwUPY5F?= =?us-ascii?Q?uWNDUGFBWyDXgsCqOC6h8rP0VfZw9ORQbvhmCdiLiXKbCZFHzDADeH9zLRx4?= =?us-ascii?Q?CHeey45ak/gbvm4ZqRti/+U6Q00ASUG3za27Ger54nwEqYupeM4tv6PMMPuQ?= =?us-ascii?Q?nu00FWQpUF7FqNsQxKphZt87ek28AcpvUkriHSSF/Rjj9yL4Pk11IoO8OQR0?= =?us-ascii?Q?V2hZgEUnd5sjuNWDeQtNcVbNFBf5gszyoN5dain5HP6FQi/gDNavfMxWhMm5?= =?us-ascii?Q?BPABJ1MxANNCFz6JbYmNOfPvS8EdCB/Bksu18rfOyUVqYXCxkaoEIT3Xim+Y?= =?us-ascii?Q?cDjYg0kPUK5n51usCIN3q0QfwWvV77w0qfW2rtTUhQa8wPeaF9vIEbzDkEMA?= =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N3wrNdawTwmnOGGjunqXnkd?= =?us-ascii?Q?niFuuOOdaRo2t1UI0Sy8gHCJuI5+SEtz1tW9DFB0qLwjm6tEV8n4xuYMfAor?= =?us-ascii?Q?TG9Fl1We7v9jvppL67OsaIaN2kj8ARAkA4CSD+UnFXa8R2yNENiVrIDwy5CN?= =?us-ascii?Q?J2oNKLFfcjHSG+H4Ibw=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(1800799024)(82310400026)(36860700013)(13003099007)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Dec 2025 09:24:05.1266 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e3e0020-c031-4323-dce4-08de4397596b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8120 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 23.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/30/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/shanipr/dpdk-stable This queued commit can be viewed at: https://github.com/shanipr/dpdk-stable/commit/3c45ee5556f6bc93422296601fd23e93c360238d Thanks. Shani --- >From 3c45ee5556f6bc93422296601fd23e93c360238d Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Fri, 31 Oct 2025 23:13:04 +0100 Subject: [PATCH] graph: fix updating edge with active graph [ upstream commit eaa11767069f476e13000fc3fec618a40c46ab7e ] After creating at least one graph and calling rte_node_edge_update to add a new edge on a node which is in use in the graph, the node memory is reallocated but the active graph still has a pointer to the freed memory. When destroying the graph, it causes a use-after-free error detected by libasan: ERROR: AddressSanitizer: heap-use-after-free READ of size 8 at 0x7c4baa5e4da8 thread T0 #0 0x0000005ad224 in graph_node_fini lib/graph/graph.c:256 #1 0x0000005ae657 in rte_graph_destroy lib/graph/graph.c:504 ... freed by thread T0 here: #0 0x7f1bac4e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) #1 0x0000005ab6d7 in edge_update lib/graph/node.c:271 #2 0x0000005abb1b in rte_node_edge_update lib/graph/node.c:339 ... previously allocated by thread T0 here: #0 0x7f1bac4e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) #1 0x0000005ab6d7 in edge_update lib/graph/node.c:271 #2 0x0000005abb1b in rte_node_edge_update lib/graph/node.c:339 ... Use malloc+memcpy and add an internal function to replace all references to the old node memory before freeing it. Fixes: c59dac2ca14a ("graph: implement node operations") Signed-off-by: Robin Jarry Acked-by: Jerin Jacob --- lib/graph/graph.c | 14 ++++++++++++++ lib/graph/graph_private.h | 12 ++++++++++++ lib/graph/node.c | 6 +++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 8ea2109645..c101a37cd5 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -260,6 +260,20 @@ graph_node_fini(struct graph *graph) graph_node->node->name)); } +void +graph_node_replace_all(struct node *old, struct node *new) +{ + struct graph_node *graph_node; + struct graph *graph; + + STAILQ_FOREACH(graph, &graph_list, next) { + STAILQ_FOREACH(graph_node, &graph->node_list, next) { + if (graph_node->node == old) + graph_node->node = new; + } + } +} + static struct rte_graph * graph_mem_fixup_node_ctx(struct rte_graph *graph) { diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index d0ef13b205..f10f894bbe 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -289,6 +289,18 @@ int graph_node_has_edge_to_src_node(struct graph *graph); */ int graph_node_has_loop_edge(struct graph *graph); +/** + * @internal + * + * Replace all pointers of a given node with another one in all active graphs. + * + * @param old + * Node pointer to replace in all graphs. + * @param new + * Updated pointer. + */ +void graph_node_replace_all(struct node *old, struct node *new); + /** * @internal * diff --git a/lib/graph/node.c b/lib/graph/node.c index 99a9622779..d492e30507 100644 --- a/lib/graph/node.c +++ b/lib/graph/node.c @@ -235,11 +235,15 @@ edge_update(struct node *node, struct node *prev, rte_edge_t from, need_realloc = max_edges > node->nb_edges; if (need_realloc) { sz = sizeof(struct node) + (max_edges * RTE_NODE_NAMESIZE); - new_node = realloc(node, sz); + new_node = malloc(sz); if (new_node == NULL) { rte_errno = ENOMEM; goto restore; } else { + sz = sizeof(*node) + (node->nb_edges * RTE_NODE_NAMESIZE); + memcpy(new_node, node, sz); + graph_node_replace_all(node, new_node); + free(node); node = new_node; } } -- 2.43.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-12-25 11:16:39.473774620 +0200 +++ 0062-graph-fix-updating-edge-with-active-graph.patch 2025-12-25 11:16:36.020952000 +0200 @@ -1 +1 @@ -From eaa11767069f476e13000fc3fec618a40c46ab7e Mon Sep 17 00:00:00 2001 +From 3c45ee5556f6bc93422296601fd23e93c360238d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit eaa11767069f476e13000fc3fec618a40c46ab7e ] + @@ -36 +37,0 @@ -Cc: stable@dpdk.org @@ -47 +48 @@ -index 61159edc72..6911ea8abe 100644 +index 8ea2109645..c101a37cd5 100644 @@ -50 +51 @@ -@@ -277,6 +277,20 @@ graph_node_fini(struct graph *graph) +@@ -260,6 +260,20 @@ graph_node_fini(struct graph *graph) @@ -72 +73 @@ -index 21912c0ae6..26cdc66371 100644 +index d0ef13b205..f10f894bbe 100644 @@ -75 +76 @@ -@@ -299,6 +299,18 @@ int graph_node_has_edge_to_src_node(struct graph *graph); +@@ -289,6 +289,18 @@ int graph_node_has_edge_to_src_node(struct graph *graph); @@ -95 +96 @@ -index cae1c809ed..e3359fe490 100644 +index 99a9622779..d492e30507 100644 @@ -98 +99 @@ -@@ -325,11 +325,15 @@ edge_update(struct node *node, struct node *prev, rte_edge_t from, +@@ -235,11 +235,15 @@ edge_update(struct node *node, struct node *prev, rte_edge_t from,