From patchwork Thu Sep 19 17:42:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Yerramneni X-Patchwork-Id: 1987532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=NTymiD5V; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=vZQ3gHIW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X8jY13VcTz1y1g for ; Fri, 20 Sep 2024 03:43:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1434184B68; Thu, 19 Sep 2024 17:43:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id SsxljPhkT4W1; Thu, 19 Sep 2024 17:43:11 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D70DB84B63 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=proofpoint20171006 header.b=NTymiD5V; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=nutanix.com header.i=@nutanix.com header.a=rsa-sha256 header.s=selector1 header.b=vZQ3gHIW Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id D70DB84B63; Thu, 19 Sep 2024 17:43:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B425CC0012; Thu, 19 Sep 2024 17:43:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10A50C0011 for ; Thu, 19 Sep 2024 17:43:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DE9BD84B63 for ; Thu, 19 Sep 2024 17:43:08 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ReRkY5le7x5S for ; Thu, 19 Sep 2024 17:43:08 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=148.163.155.12; helo=mx0b-002c1b01.pphosted.com; envelope-from=naveen.yerramneni@nutanix.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org CFD9D84B4A Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=nutanix.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CFD9D84B4A Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by smtp1.osuosl.org (Postfix) with ESMTPS id CFD9D84B4A for ; Thu, 19 Sep 2024 17:43:07 +0000 (UTC) Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48JGeKZd010753 for ; Thu, 19 Sep 2024 10:43:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=proofpoint20171006; bh=I7IC4+XSTCDYL Uu7DwPx9dxg77y2SFYeu3LpFE1aFNc=; b=NTymiD5VXAU69n5b3eeGpxMdTk2LA iGQtyiDM1En/AYefKZwcv5hXYlTtrZnbSvL44SLYpQHlCwqULpQC9nOst1ucgxTb LH8c5n2GI9BtVZc2PALgvSS3WEWuFYSIacGbGO/fo3gQ5PM8KGnHNGSKobJ43geA LTIU554DB/T8JWI4NUu7fUiT+LobrCX0YsCPplR6WoYzPSCm5Boi/Y0KiLXSE4M2 fenvvo55d+vBfsHEckVG1VrQO22FoGEYzH1stFHE4/cBbo3yzo3irI0FRbzztzQN cmQan6q3F1qyYofRZoyAHqdeNq/CCxb1fo8qnFPhlPR6aZBXU6QulH0mw== Received: from byapr05cu005.outbound.protection.outlook.com (mail-westusazlp17010007.outbound.protection.outlook.com [40.93.1.7]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 41q0cvytsp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 19 Sep 2024 10:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hs9a0MfOmbehKWcBhlI4b+f4xh1tLUaPrmSZjSsG54DSKgB08SPPbqwW0AyCww4t3O0Cwsh9kZH9Pf1tdXvxZJtcPpzlS329oZU+UMdvhGLWKvAUbd0NgqMboETbbNtBGLCnHhphvRQFwOMGT2uabMnI/ZlB2QTsmpW+Fh5/Mdt6vvOtjfYAWqMwSSxc8C7mmdB7zsJ069T2N3jzv7U+5pVGHFb2SlcEx2OERIPplK/GGOo9/AC3t4OAkZrGfyvJkR9GzfS8vAttKf3IOh+Yhuq5E9PqYp26iCaIMj1apIZHTQ7AIAEjUTGIE3KESHqF7PPTXmyRVi5odFpxrm6P6g== 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=I7IC4+XSTCDYLUu7DwPx9dxg77y2SFYeu3LpFE1aFNc=; b=qq7to0ksOK+MPj9omSrkym0paljMUW+WyZ9G7fXnvChsPrqL1j/t2D9Mji8kUAcYbuUS2ivR78q2YROhPEmOtM11tg5kqrPUGYGidL/CZG0GmQ1xBxyjwdPQxgGhMNrdMMqaJ7skU0D6TqUL+LtIWR0OOMIjAHAmtIbNHBK/84VWMFeYDRkYDyDF57rNW6RhUHCELCH5yU2GPL4KVZgcoIl0AhnvDC1XedbwAdoj+KbiriB3XNSe4oo9HvFa++6U+NE3DoVxwaETJhUcXPR5QbKnCnlc+3U7TQvaKljQfgKBpsA3hB8ZdmZPUMt+q4Pi8qO8llMWAsZJEJpKYDF8Aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I7IC4+XSTCDYLUu7DwPx9dxg77y2SFYeu3LpFE1aFNc=; b=vZQ3gHIWN0nRLNsAoxkxRmhjMjSfcjkSE9YNnCBsHpV1u8rVfN8TCBTKrHzHe4VogSYVxqXhin/YkVuWcysZuYoqvwQMp4n2pTaUbVnVu8m8NUowVAISnTwP0GcIa53kEFKyhuiYyg7VZnXwUny7zUvuVX4Y2So/M2oaW4YwRUmG4sslJ9blud0h0b0bo9sDLCd0q79FKkF71uYH5KSPXiw+qrfMfHcGywDNcySv33oUl+xpUlajGmnOL+6w1YXAr0XK0v1AlxXKcfmGMmiwb8hT/bH+VbUnymgrPGruwLGE/lXRk39oiJWqsR20R3F2SlQJTQ8sB/NrnVGVA++9YQ== Received: from SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) by DM6PR02MB6748.namprd02.prod.outlook.com (2603:10b6:5:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.17; Thu, 19 Sep 2024 17:43:02 +0000 Received: from SJ0PR02MB7808.namprd02.prod.outlook.com ([fe80::c879:5909:29d3:9770]) by SJ0PR02MB7808.namprd02.prod.outlook.com ([fe80::c879:5909:29d3:9770%6]) with mapi id 15.20.7982.018; Thu, 19 Sep 2024 17:43:02 +0000 To: dev@openvswitch.org Date: Thu, 19 Sep 2024 17:42:51 +0000 Message-Id: <20240919174251.5136-1-naveen.yerramneni@nutanix.com> X-Mailer: git-send-email 2.36.6 X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR02MB7808.namprd02.prod.outlook.com (2603:10b6:a03:326::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR02MB7808:EE_|DM6PR02MB6748:EE_ X-MS-Office365-Filtering-Correlation-Id: 49cb414c-a228-4989-2587-08dcd8d2825e x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024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Gc0ULvhwwVdSmYXLhCH9qejeWC9tRbI8z7U7WKD0ALif6az1G4qXPUe3VxxEPYVt4XezT3E2cTmu7KoDRdrWEtWhBk12C8drvMy05KOf/Ells9L0d1nI3ZtGTgAA4z2h+V6IFNxvffnjMmMr0Gab6qtq7w6SQFPiT21chWIoad+LkJE0N24SBrtqulEZWQ8d+0ito7YSI3eVqhYk26RD4n+bjp5BFLYmfLIUF6fq53MCnnpjG8XEglwUArBu6iV4RE/nmtVJPLr+W58MCyJFXMxG+vw0vzy3YiTHzHE4ervlPLuoylmteUeUyidt6k28qEwFWLNlEcYRjunR8IOOzb5X+lD6/TIEsljEv/w9/nATTgfVNbNg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR02MB7808.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N5Wwispqq5O0zTWEHTJIyr2anIXjtKcJJRMwq68r6xlXaTSHM/zktY/2ES2VgJF7vrTUpbPBgpbbt23kQr1+ASNo1IaE8fKDsvncP2qqPp4SqW/5+/SHzLeN7R9K/PrukIkZYfslPxOOKiuXfBqeqiOZTMsjY82sOi90K4Z7MK5loUqRROZ60c38gVDzaZCGyfse6vzbRg7FEBKDi2VKfrThbtMxZtUhbJPKvmcWKqWvkPDBMWl4PyFNsuds0MeSeOq0RRWU4u1TQzRDhf0f3g8uG96bVmNN4h7m6+/9hreaIqkt5LDAlmAKH0cI0X2vl/BG3h24TQfkD79OHh0Y/CUdRNF0BeNTwBzg6G0/rz54BANnXWOBdORud/dOH6MG9XF/GT0gcGOR9dfqwsoZO8DMW7FkxR8RTTCEAX9TFLQwtbPZQHjN4DPpECxfh+QBXNuJ28Thj7BvYHDWNIBKikm14qcuh8yWiiT1kFpg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JyZdiRIY8I3TjR1n4yfPeXPI3Wah3qh+FGOPvsxUKuGGe98H86krIqDC5ngI+OodtU= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49cb414c-a228-4989-2587-08dcd8d2825e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB7808.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 17:43:02.3493 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T3byp4kATTog5rGlAivFhhE4k2Mtl9NOF2IaV0ssJXiF+ojwogeEQ1I6gnzG1x+9+TnjBDRj6AGMGC6og7X9MESePl/aU4bizFNd388o8Uo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6748 X-Proofpoint-GUID: 7Kt6N1FlZ1LOosy_m7hMCoSHIInNys9i X-Authority-Analysis: v=2.4 cv=dZfS3mXe c=1 sm=1 tr=0 ts=66ec62aa cx=c_pps a=+1/HLBYLL4tv2yjlBWnClw==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=EaEq8P2WXUwA:10 a=0034W8JfsZAA:10 a=0kUYKlekyDsA:10 a=64Cc0HZtAAAA:8 a=XdZQGz9QOfOQbRr8j5sA:9 a=14NRyaPF5x3gF6G45PvQ:22 X-Proofpoint-ORIG-GUID: 7Kt6N1FlZ1LOosy_m7hMCoSHIInNys9i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_16,2024-09-19_01,2024-09-02_01 X-Proofpoint-Spam-Reason: safe Subject: [ovs-dev] [PATCH ovn] controller: Fix "use after free" issue in statctrl_run(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naveen Yerramneni via dev From: Naveen Yerramneni Reply-To: Naveen Yerramneni Cc: shibir.basak@nutanix.com Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Issue: ===== OVN controller main() is caching the "sbrec_mac_binding/sbrec_fdb" pointers in "mac_cache_mac_binding->mac_bindings/fdbs" which are used to update timestamp in mac_cache_mb_stats_run()/ mac_cache_fdb_stats_run(). There is a condition where cached "sbrec_mac_binding/sbrec_fdb" pointers gets freed without removing the refs from "mac_cache_mac_binding->mac_bindings/fdbs" which is leading to crash due to "use after free". This condition can occur due to following reason. - en_runtime_data is input to en_mac_cache. - en_runtime_data went for full recompute but engine_run() is called with recompute_allowed as false due to ofctrl_has_backlog() returned true. This caused to avoid the recompute in the current engine run. - If there are any mac_binding/fdb deletes in the same run then, entries gets deleted during ovsdb_idl_loop_run() and rows are freed in ovsdb_idl_track_clear() but references to them are present in mac_cache_data->mac_bindings/fdbs. Fix: === Avoid statctrl_run() when engine recompute is not allowed. Signed-off-by: Naveen Yerramneni Signed-off-by: Naveen Yerramneni --- controller/ovn-controller.c | 57 +++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index c48667887..6bb8f07db 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -5363,6 +5363,7 @@ main(int argc, char *argv[]) /* Main loop. */ bool sb_monitor_all = false; while (!exit_args.exiting) { + bool recompute_allowed = true; memory_run(); if (memory_should_report()) { struct simap usage = SIMAP_INITIALIZER(&usage); @@ -5536,34 +5537,34 @@ main(int argc, char *argv[]) stopwatch_start(CONTROLLER_LOOP_STOPWATCH_NAME, time_msec()); - if (ovnsb_idl_txn) { - if (ofctrl_has_backlog()) { - /* When there are in-flight messages pending to - * ovs-vswitchd, we should hold on recomputing so - * that the previous flow installations won't be - * delayed. However, we still want to try if - * recompute is not needed and we can quickly - * incrementally process the new changes, to avoid - * unnecessarily forced recomputes later on. This - * is because the OVSDB change tracker cannot - * preserve tracked changes across iterations. If - * change tracking is improved, we can simply skip - * this round of engine_run and continue processing - * acculated changes incrementally later when - * ofctrl_has_backlog() returns false. */ - engine_run(false); - } else { - engine_run(true); - } - } else { + if (!ovnsb_idl_txn || ofctrl_has_backlog()) { + /* No ovnsb_idl_txn */ /* Even if there's no SB DB transaction available, - * try to run the engine so that we can handle any - * incremental changes that don't require a recompute. - * If a recompute is required, the engine will cancel, - * triggerring a full run in the next iteration. - */ - engine_run(false); + * try to run the engine so that we can handle any + * incremental changes that don't require a recompute. + * If a recompute is required, the engine will cancel, + * triggerring a full run in the next iteration. + */ + + /* OR */ + + /* ofctrl_has_backlog */ + /* When there are in-flight messages pending to + * ovs-vswitchd, we should hold on recomputing so + * that the previous flow installations won't be + * delayed. However, we still want to try if + * recompute is not needed and we can quickly + * incrementally process the new changes, to avoid + * unnecessarily forced recomputes later on. This + * is because the OVSDB change tracker cannot + * preserve tracked changes across iterations. If + * change tracking is improved, we can simply skip + * this round of engine_run and continue processing + * acculated changes incrementally later when + * ofctrl_has_backlog() returns false. */ + recompute_allowed = false; } + engine_run(recompute_allowed); stopwatch_stop(CONTROLLER_LOOP_STOPWATCH_NAME, time_msec()); if (engine_has_updated()) { @@ -5685,7 +5686,9 @@ main(int argc, char *argv[]) } } - if (mac_cache_data) { + if (mac_cache_data && recompute_allowed) { + /* Run only when engine recompute is allowed + * since mac_binding/FDB rows are cached */ statctrl_run(ovnsb_idl_txn, mac_cache_data); }