From nobody Sun May 19 03:12:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646816175; cv=none; d=zohomail.com; s=zohoarc; b=e7ADml7lAvYVmwbegvlfUsQgK3hjb4Hpq2FuuxdRYNWtQ+vqb+U3+3dvX94bgABCu2HRuPulvUvteaB3QdeNCMi909c3NyfufOqPBglH+98I/UTCpb7EIaPB9OU1TyBFhFvZtSeB8PKZIYMqjOQozZhQIVNGna2FUXYrEZTX+zY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646816175; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/BQjfAn6wE15WpXLjLhXiMN8RPpCNJet8epHshcWnKQ=; b=UAWQcQwrzXBlmiWj3UeEnSHB8SRDbT97GphyXnQwIX6fy531KnCkOvBz7Hy1ysuacufl3PlHUju9OnGkg9IoecKEXeFolqf70bC2mHHrJMf5DAHJ5SneidhE5fDGfL9sKyqlM7eWbnDG93dc04AMvl9lHS3AKlHx+6PpEjufX/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646816175990292.5150883319187; Wed, 9 Mar 2022 00:56:15 -0800 (PST) Received: from localhost ([::1]:44284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRs7C-0006nA-GY for importer@patchew.org; Wed, 09 Mar 2022 03:56:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2Q-0001gr-3H for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:19 -0500 Received: from mga17.intel.com ([192.55.52.151]:27163) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2O-0000Ya-13 for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:17 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:12 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646815876; x=1678351876; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YLdF6NpOTfWp3qwGIAirD8aN2gGJUzJV8ptPQOvJvkI=; b=jIWY2ZUKUhmiXKoiXytBhSlhgZrt2eRxkg1LUvO9sLvMwqJzKx+pwZ5+ XpQVM1vbD/LgzXxSEXyrAkUsU/C+loCJEneFBuLD/L2LIJvOf7/ln6qGf WD2x2aAh4YkEt60KwA4VKAUZ+gQpkA+TjgOxANQDZC50SLkLoL1yA/YGc ArmmvZcgq46/tBQCXRHNcavmzYu4hgIJ/Gdy75/+uymeB+MXUDmlnU+y1 MStFU1+ley3kaWpvFFsEtrhjSORJ8HbT4gGOJnMLgTIGgOxEWFcEExxT8 Dy9AGUf4qedp+bN4WulvqcONK6M42UcR28ebcNkKygYKdH/y81fSHV4re A==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="235532265" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="235532265" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554030828" From: Zhang Chen To: Jason Wang , Li Zhijian Subject: [PATCH 1/4] softmmu/runstate.c: add RunStateTransition support form COLO to PRELAUNCH Date: Wed, 9 Mar 2022 16:38:55 +0800 Message-Id: <20220309083858.58117-2-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309083858.58117-1-chen.zhang@intel.com> References: <20220309083858.58117-1-chen.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.151; envelope-from=chen.zhang@intel.com; helo=mga17.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , qemu-dev , Like Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1646816177635100001 Content-Type: text/plain; charset="utf-8" If the checkpoint occurs when the guest finishes restarting but has not started running, the runstate_set() may reject the transition from COLO to PRELAUNCH with the crash log: {"timestamp": {"seconds": 1593484591, "microseconds": 26605},\ "event": "RESET", "data": {"guest": true, "reason": "guest-reset"}} qemu-system-x86_64: invalid runstate transition: 'colo' -> 'prelaunch' Long-term testing says that it's pretty safe. Signed-off-by: Like Xu Signed-off-by: Zhang Chen --- softmmu/runstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index e0d869b21a..c021c56338 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -127,6 +127,7 @@ static const RunStateTransition runstate_transitions_de= f[] =3D { { RUN_STATE_RESTORE_VM, RUN_STATE_PRELAUNCH }, =20 { RUN_STATE_COLO, RUN_STATE_RUNNING }, + { RUN_STATE_COLO, RUN_STATE_PRELAUNCH }, { RUN_STATE_COLO, RUN_STATE_SHUTDOWN}, =20 { RUN_STATE_RUNNING, RUN_STATE_DEBUG }, --=20 2.25.1 From nobody Sun May 19 03:12:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646816481; cv=none; d=zohomail.com; s=zohoarc; b=DEEJgIw8rW4hPHIT9PwtxqodBmDSJVcpQVXA4DkQnokQMsRKobd/iuiEF/997WVEuxJZAoX+rTdVjb9s29ytOu1Ca9U1g19FT7hIFkseDEydVLN1DBUtn/32K+h4BK/iFPD/hRSzlDJC6W78LT1tIR6R0dxepKGQOcfIkpt+2kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646816481; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Mr6p1StZ+ode0unzFUQrVuOiBgAg5TSN0ZrFrvK3kGg=; b=QpuZ/wMvOkefcMZu0AQiy9/F/7aLmqpEMlhrSoyC31l/agQJUc9zns6oi+x4aje3GnUv0mWIzCOKLdsh8SqVS/4UZYu87OQI1TV2ZmRND9XNNDjx13b4RvVAnjMr+aYIntAvmeKgrvV1lrWeqzlXTC5l7VCEX1fY+BqYSgtjoH8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646816481882751.9874488239342; Wed, 9 Mar 2022 01:01:21 -0800 (PST) Received: from localhost ([::1]:51634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRsC8-0003SV-97 for importer@patchew.org; Wed, 09 Mar 2022 04:01:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2R-0001h7-Da for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:20 -0500 Received: from mga17.intel.com ([192.55.52.151]:27166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2P-0000Ye-Hk for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:18 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:14 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646815877; x=1678351877; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KDj8QbuXpSltycOHM7DUtH0boie3rPtvzhfhhKDiY6Y=; b=AT+9HtLKoKmyQG3/rl/g2MTGD/Fd4tXRwqWgcK3VlpSGDacip/NZrqMr HZLHhZZTr9NWIrAOFE9m5EWXVYnjjMrTSuYXC2U+zwzklQL2n2hY/HPmJ xtE4gR+3BmmcF0ogmdBm/55ZAl3ejNtVg/a5hMezMHrP2MawvWlo1xoC+ RoNWAqI2JLvuYImpVuDy+qJAxOIZHYz2/PjGc2rn5HaX/mkZANFJ4mnw7 zk4+XuwCxJqGCxyVkh3UQA0fPFKNt0aONfZlz0H67+I+Kfc4OmFzjg2q9 yNm6FCFHR07my2ORt2F9aMS02Qdz4JzHDNSbneoC0VIYBz/tdFf0IK8nr g==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="235532271" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="235532271" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554030847" From: Zhang Chen To: Jason Wang , Li Zhijian Subject: [PATCH 2/4] net/colo: Fix a "double free" crash to clear the conn_list Date: Wed, 9 Mar 2022 16:38:56 +0800 Message-Id: <20220309083858.58117-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309083858.58117-1-chen.zhang@intel.com> References: <20220309083858.58117-1-chen.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.151; envelope-from=chen.zhang@intel.com; helo=mga17.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , qemu-dev , Like Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1646816483652100001 Content-Type: text/plain; charset="utf-8" We notice the QEMU may crash when the guest has too many incoming network connections with the following log: 15197@1593578622.668573:colo_proxy_main : colo proxy connection hashtable f= ull, clear it free(): invalid pointer [1] 15195 abort (core dumped) qemu-system-x86_64 .... This is because we create the s->connection_track_table with g_hash_table_new_full() which is defined as: GHashTable * g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func); The fourth parameter connection_destroy() will be called to free the memory allocated for all 'Connection' values in the hashtable when we call g_hash_table_remove_all() in the connection_hashtable_reset(). It's unnecessary because we clear the conn_list explicitly later, and it's buggy when other agents try to call connection_get() with the same connection_track_table. Signed-off-by: Like Xu Signed-off-by: Zhang Chen --- net/colo-compare.c | 2 +- net/filter-rewriter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 62554b5b3c..ab054cfd21 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1324,7 +1324,7 @@ static void colo_compare_complete(UserCreatable *uc, = Error **errp) s->connection_track_table =3D g_hash_table_new_full(connection_key_has= h, connection_key_equal, g_free, - connection_destroy); + NULL); =20 colo_compare_iothread(s); =20 diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c index bf05023dc3..c18c4c2019 100644 --- a/net/filter-rewriter.c +++ b/net/filter-rewriter.c @@ -383,7 +383,7 @@ static void colo_rewriter_setup(NetFilterState *nf, Err= or **errp) s->connection_track_table =3D g_hash_table_new_full(connection_key_has= h, connection_key_equal, g_free, - connection_destroy); + NULL); s->incoming_queue =3D qemu_new_net_queue(qemu_netfilter_pass_to_next, = nf); } =20 --=20 2.25.1 From nobody Sun May 19 03:12:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1646816052; cv=none; d=zohomail.com; s=zohoarc; b=T6qbumVxmnQwigU3IaPWGU/FA7mZsiW4UqPoha32E9AkpmxH93qMijh2AfBm2L02zeoT8998eJNoNUAZc02HpcB0FBZdsdHMhH4dGkO9wnmYCY9/Y4Q3ui8LdWnr/F25NGiHaGcPchWs7SjGRs5Ka31TLPHVhonQQxzrSecUsLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646816052; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RQgpAfQq7//fBrNlo+dQpe5SUGuYkmbFMSdNa0an8u4=; b=XrAhM5IVC+ekLF3xZuF9iIo47j27J3bUD8KL5bRk95N7TDajAVRO7wW5F1x38hW1r9gh1QPpZkNb5Af/30GLaFBYqWIdrcIOAKh+D/kEdp1LAiTZusc6O6MK5R4C4PoFGCmVbpy09HEu0zUi/52ThFrhQroOJoU0oI2tx6j5q7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164681605290958.686429014308146; Wed, 9 Mar 2022 00:54:12 -0800 (PST) Received: from localhost ([::1]:40796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRs5D-0004PL-De for importer@patchew.org; Wed, 09 Mar 2022 03:54:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2S-0001hF-0m for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:20 -0500 Received: from mga17.intel.com ([192.55.52.151]:27163) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2Q-0000Ya-1u for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:19 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:15 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646815878; x=1678351878; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BqicbkCklrMW9DQ9hWjf1KkDyWkX8bxlghBMjh+E9pA=; b=UFPHH0gDnYjQUH+iXXGBuGDIzlpm4bpWPqqUlGGEqiiBofX/WcO0fJc0 knDM7pmRokc2vzZuSDTwtubiC5TGm2NzSGeu/I1YzejhrdCclxZSR+Qzo 6P3C4PJrok+SoR5fNYqQYkFh7MfalIbACnaOvYLK0H6SCTqi6G9tR7SK+ Qx1+QQ2qRwBqH8Ddw92Robtn5rwR9zBEFE2dPGJDY2hWf0MrPZ494D1+H 31LwRzdxaN0+N4YWRTGAf5mVoQb6NBSZiaIT86AdeYzw4pCaCOUEDBPFv bfOPHehkEPp1zSdVtqqdEid09EmFpZqC9kfT7LZtdtqZvj6wWMQKe3UZe g==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="235532276" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="235532276" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554030858" From: Zhang Chen To: Jason Wang , Li Zhijian Subject: [PATCH 3/4] net/colo.c: No need to track conn_list for filter-rewriter Date: Wed, 9 Mar 2022 16:38:57 +0800 Message-Id: <20220309083858.58117-4-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309083858.58117-1-chen.zhang@intel.com> References: <20220309083858.58117-1-chen.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.151; envelope-from=chen.zhang@intel.com; helo=mga17.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , qemu-dev Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1646816054225100003 Content-Type: text/plain; charset="utf-8" Filter-rewriter no need to track connection in conn_list. This patch fix the glib g_queue_is_empty assertion when COLO guest keep a lot of network connection. Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian --- net/colo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/colo.c b/net/colo.c index 1f8162f59f..694f3c93ef 100644 --- a/net/colo.c +++ b/net/colo.c @@ -218,7 +218,7 @@ Connection *connection_get(GHashTable *connection_track= _table, /* * clear the conn_list */ - while (!g_queue_is_empty(conn_list)) { + while (conn_list && !g_queue_is_empty(conn_list)) { connection_destroy(g_queue_pop_head(conn_list)); } } --=20 2.25.1 From nobody Sun May 19 03:12:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646816053153748.0603015372928; Wed, 9 Mar 2022 00:54:13 -0800 (PST) Received: from localhost ([::1]:40900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRs5D-0004U0-La for importer@patchew.org; Wed, 09 Mar 2022 03:54:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2S-0001hG-BQ for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:20 -0500 Received: from mga17.intel.com ([192.55.52.151]:27159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRs2Q-0000YT-8K for qemu-devel@nongnu.org; Wed, 09 Mar 2022 03:51:20 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:17 -0800 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 00:51:16 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646815878; x=1678351878; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xmpZrrHqbl8ZpfhrrCHPXKP4NwmFJQ0+6oDR/IRPkT0=; b=OPDzdmmQfr+BX+TBd8XZppRffmOwGiE8IQvaxXYyl3Ub3abz7tmjXpDG Ivfak2q558v4qIZDX5uk/W6zJB9T78A9KpR7inJAi3LKgOgIMm2wG0KSb QD74lA8bh/t+X7DRN68VuJrojZi0J9ut05W+wFpJ+0z8FWMyS/BdnfAPu TVrIsnMH9siIRQB2slZJg7qvTmfoXyIkNT58tn4H8+inXruUpyJgnPUNB MwESuqp6O9fpyiiH8be0yf7dFwm/TrqPkASr362QYRLemZxpQmoCPhCX5 H1dROPkIqA+Q2nyX8FoRVARYxfs0KYO9lklIylvYKh2hK1zp0KmpKsvGA A==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="235532282" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="235532282" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="554030869" From: Zhang Chen To: Jason Wang , Li Zhijian Subject: [PATCH 4/4] net/colo.c: fix segmentation fault when packet is not parsed correctly Date: Wed, 9 Mar 2022 16:38:58 +0800 Message-Id: <20220309083858.58117-5-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309083858.58117-1-chen.zhang@intel.com> References: <20220309083858.58117-1-chen.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.151; envelope-from=chen.zhang@intel.com; helo=mga17.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Tao Xu , qemu-dev Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646816955514100001 Content-Type: text/plain; charset="utf-8" When COLO use only one vnet_hdr_support parameter between filter-redirector and filter-mirror(or colo-compare), COLO will crash with segmentation fault. Back track as follow: Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. 0x0000555555cb200b in eth_get_l2_hdr_length (p=3D0x0) at /home/tao/project/COLO/colo-qemu/include/net/eth.h:296 296 uint16_t proto =3D be16_to_cpu(PKT_GET_ETH_HDR(p)->h_proto); (gdb) bt 0 0x0000555555cb200b in eth_get_l2_hdr_length (p=3D0x0) at /home/tao/project/COLO/colo-qemu/include/net/eth.h:296 1 0x0000555555cb22b4 in parse_packet_early (pkt=3D0x555556a44840) at net/colo.c:49 2 0x0000555555cb2b91 in is_tcp_packet (pkt=3D0x555556a44840) at net/filter-rewriter.c:63 So wrong vnet_hdr_len will cause pkt->data become NULL. Add check to raise error and add trace-events to track vnet_hdr_len. Signed-off-by: Tao Xu Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian --- net/colo.c | 9 ++++++++- net/trace-events | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/net/colo.c b/net/colo.c index 694f3c93ef..6b0ff562ad 100644 --- a/net/colo.c +++ b/net/colo.c @@ -46,7 +46,14 @@ int parse_packet_early(Packet *pkt) static const uint8_t vlan[] =3D {0x81, 0x00}; uint8_t *data =3D pkt->data + pkt->vnet_hdr_len; uint16_t l3_proto; - ssize_t l2hdr_len =3D eth_get_l2_hdr_length(data); + ssize_t l2hdr_len; + + if (data =3D=3D NULL) { + trace_colo_proxy_main_vnet_info("This packet is not parsed correct= ly, " + "pkt->vnet_hdr_len", pkt->vnet_hdr= _len); + return 1; + } + l2hdr_len =3D eth_get_l2_hdr_length(data); =20 if (pkt->size < ETH_HLEN + pkt->vnet_hdr_len) { trace_colo_proxy_main("pkt->size < ETH_HLEN"); diff --git a/net/trace-events b/net/trace-events index d7a17256cc..6af927b4b9 100644 --- a/net/trace-events +++ b/net/trace-events @@ -9,6 +9,7 @@ vhost_user_event(const char *chr, int event) "chr: %s got e= vent: %d" =20 # colo.c colo_proxy_main(const char *chr) ": %s" +colo_proxy_main_vnet_info(const char *sta, int size) ": %s =3D %d" =20 # colo-compare.c colo_compare_main(const char *chr) ": %s" --=20 2.25.1