From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 57F617803D2 for ; Wed, 24 Jan 2024 08:11:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=zHDkZS2oJLdtEZtKzfMRxD0huHodnfLbo1UdZIzSQX0=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706083906; v=1; b=rNmWJK6BzMVurj6rlfOGOFHalMDIGA7RavbQbj3ltCzKBsoamEI0CPOGASEshLxCl7MvRL8O d8N0lRd9agnEDy6BgVdE9A8jOJlROfDaF6POl85oPL55F0cIbKQU0HJKc482cKnwwuzMGit6GvG acwQduaqcxip5qc7yK4sYjBU= X-Received: by 127.0.0.2 with SMTP id KTUZYY7687511x2ecTuFSCu9; Wed, 24 Jan 2024 00:11:46 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by mx.groups.io with SMTP id smtpd.web11.17899.1706083905883932276 for ; Wed, 24 Jan 2024 00:11:46 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="8426752" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="8426752" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 00:11:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="20647332" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Jan 2024 00:11:43 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Jan 2024 00:11:42 -0800 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Jan 2024 00:11:42 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 24 Jan 2024 00:11:42 -0800 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 24 Jan 2024 00:11:41 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EXKcA1dGfa4aT6gjOEMx8RHNUzh96Ey/oXnt46/sJH28hPVpjlgQ3KpDbf/CIsS5sWYnmudPoMqiQg1CRmMj6/y8b0b04b5rSzMG55v3BrRLbQYhXzkvT6GaDoYVnq8PwvOQPUpMTnwzGBdDceZg9Bji0sMVK/EgqPhiamfyjQCV0mH8usaeaX1xVfGi/uRa6L4IzobYcemIhxQQ/1iRjBg4DzF9t4yJ4hjBjplCEppbHclZ74KxkOxT4TnWS8mZlXeKvQrAv2xa0WfbIqTeK2aKewVMB8UoyPar5alDeNlCf+/E13eE7tqHl4ISjg42d06aGyJ7l4FfMpD3O9dKqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=JSo9A1YJcT/KKroHBLXgQIkH+vOEChWPEykVRN67G80=; b=IlIozm+bwpFRICVYOLEkXqm6Hnv4QXO/nsADm5mMSCYinzurY1mbSCaB/obHTo7MurWgC+4MJWt+/NUO6l+Y3gwMXnoxPrglGe/GIo0ZqkuOz1PcFekopFC6Py9Ga4vZNycHAV2vD1LZioBRo9DWKcCCdrXpXBiwnc2bxtWz6B1xf1U5n7KlR8UuJqG6B+SQU7RblrvOjD1sqQg43Kg974btcx4AksCCNxa33oJrbkigR3oeNH/YF27Nh/S66PHCwRX6bDwnCt5wSTHZKr+kisTQsxh6ACP4IDjjSRNtlOD9+Yk5io6GrX82x0WHMDVr9vNEug94cPMJqwKko3MvFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by BN9PR11MB5289.namprd11.prod.outlook.com (2603:10b6:408:136::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22; Wed, 24 Jan 2024 08:11:38 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::fdd3:11d7:1c15:6c2d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::fdd3:11d7:1c15:6c2d%7]) with mapi id 15.20.7228.022; Wed, 24 Jan 2024 08:11:38 +0000 From: "Ni, Ray" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: Liming Gao , "Wu, Jiaxin" , "POLUDOV, FELIX" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler Thread-Topic: [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler Thread-Index: AQHaTnpFQXNlIKdlzEG8tz/NV30y6bDonDHw Date: Wed, 24 Jan 2024 08:11:38 +0000 Message-ID: References: <20240124040301.2176-1-zhiguang.liu@intel.com> In-Reply-To: <20240124040301.2176-1-zhiguang.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|BN9PR11MB5289:EE_ x-ms-office365-filtering-correlation-id: 482da906-c9de-4640-7b14-08dc1cb416f2 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: vpg1i0QGsqfGno+UzWD9QhbuA9bP5kshPbbANdwE7D1ZeoeDBw21pf0SXMrC0UFBlHLILFWgyWEN+JlvPT/OeF4bIw5iNx0pNCDVY7GEqSCkOxo+Y3Re5NxsxkiHWOWrCJoo2SuiYH7JYnlKi4j5mQiz7Chn8bJ+j95IdnRtq0j5fueMQUywu7NvuWyqHJX5R3BaQuA2qJxVwerrxrU+rnIcEC5gD2YvMUEIDTD8kaEBFEkUGmfGrih+jX6kY2SOv3pJt1k03iznyLbp2tazhLmAEbZos9ayI6ITN4o8BtuOhgjybWMqF5kbPkRnmPdSdqa0tYzC9Zem6UUVjerTY5yljvEyTqdkU6XnXSxhu9HabH6AJJS0QR2ATFMS6i2dYGxUb+QirRuH8KpFhksj5RcpbztzuUONnSbbZ1FCx020wstlW3A9ZTtAyVrU3RwAPVLprd1wP5YCa9ETcG05tp6P8vdKknOerssD4n4SIWQUQdFzjRqdW+GW3YRgAg49/0SjQuy/GD97Zm/XgPbcj6bk0L4X9U2YUnTEQLygZnnsdTmSR38GeWn/IKXI1bAC1EEi21inIeLtVf1eKF90iMNKy1+9+2TDb1iChiIzBjlTLuZ3DHNYlzbXqRi88hLA x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?d46uoNWqTJw/kPSdruRS1ztcK7onub9T1MXAfQ3n57CezuGduVQeab44mTv7?= =?us-ascii?Q?Q3hLLA388FNG8RnI2GjI/K8/KARMqMNw3Ta/APJg/y2zuLSp2FPFZUQ1IDWm?= =?us-ascii?Q?PrgyDWu7V/LG7q4p+eLWuKa93NRHS6AmPJd7FHkdNUvphs53ZWc7tyw3fbhN?= =?us-ascii?Q?8VrEWmywli9CEdUJapBmdoDOdGJMhJjgXIUrSg4JRlsfUI/mR1XZclEAevN0?= =?us-ascii?Q?wk87vkR2vJzgKuYluYprgcgbSYn5Dceje7WodNbMBzqVDimhNy/Xh0U19mE6?= =?us-ascii?Q?AjVUTVcft7RAXRJEWenmlO/ZkrVC0ytFqrAW1v3YS6+7SH9UeyOPslEvNcQV?= =?us-ascii?Q?0+3bLiMlI6Am1Z/0HJleA9kdgiR+95tjirm42GurrQXOoF6abRuy0mE+LJr1?= =?us-ascii?Q?bHUDinl2NH/7enLvCx7L91xW5b9Y3UaYrS5h/8NWrHt0xgL1Gr9BCUCh0jub?= =?us-ascii?Q?9DeBsO+xQ2C9PSQJduykFrfCe8das6gZt9fa2fQEpwPycLWmofce3spqLW1B?= =?us-ascii?Q?677rWc/Wl+NGkIU1GSK2ZuPELoYlihIsCjiFtCoBY9QHBv7PSBtzAL9mABkJ?= =?us-ascii?Q?ca4Xat211dra1zGbW18ds22sB97x5hb8785U3RNGnBePLI3psdeHg2Htu2JB?= =?us-ascii?Q?SNmzomOS2GIFbPc2rAgkpvvp4NyD4srgHCsBGK3XJdQgcMNc79uBMmY5RkCQ?= =?us-ascii?Q?MU2cHGTILv+rGWL3fj4MRGlMQg+BoGmsqJmkCWAxHbsr2Y320W3JhS9drzb8?= =?us-ascii?Q?iOj4saU5PDZsL2ZANA/2tpjS7rRETR/d8J5hDjWcfLia7va8LMBMtA1+oDKu?= =?us-ascii?Q?RHjMGYf2oDv50V6ftJs9EitZ8eHw6y6oAe6YcONLYXhVwc6Xj1jZklBdk6H/?= =?us-ascii?Q?1OUCDDX4U8Ha57YNqxbf5ttTK6yjrETTSyuE5Vfi9LZNmVBlIEqfasdrc42q?= =?us-ascii?Q?+4jWbq62fAMqs/8rPcQ/Grhtk423yB+LfjmFnTWFG3yQYrGu+2lsN9fUJeQE?= =?us-ascii?Q?AwV+P37ml6vuVVYNMD3pOmM+2KwA0c1hVrL17jfzZ3ftCFOIytUfX9H2Jfgx?= =?us-ascii?Q?aSQ8YKm16r2RBsvHAbNGXvw69LFsI7ewtW4v7CUeg8hVZvTUeOK6By1az8wU?= =?us-ascii?Q?ILFAvUVnluRz+JeqD9c7s00V/rv8coTl59oIH1M+OWjOJ/XCXIRHvRMTxLRN?= =?us-ascii?Q?ErjpWXhGF9vnIAiCMqcJwa+9InK3XcLjbygm6fIM5vo/GSn+HkBxTZszSfAx?= =?us-ascii?Q?bwgj8ge1OUWlfs6YtD2pDR+MnqGX9OAnt8KjCNCvRradk8GnanbPksqF4/Gx?= =?us-ascii?Q?GA4xB6Y0Tvb62AZodsLuubtjFGH2Q0iQDptpnGnAfN5Jb2EFnSLuk9nEwTCT?= =?us-ascii?Q?P+5aZv2o0dThIl9ctrOz6a7rfSXL8jF9VhFeiRwzah9F5pdNj9zcj0ElLa/E?= =?us-ascii?Q?5IcnqphMraDPnhzyUIPy4ZFAeyiax8iqs8Bm4KIFsgPUQSLT22BeSKD2Cske?= =?us-ascii?Q?AEDIeP+zmiWZb9qSZLhi7egmLQ+IT69aHYRlXNxCQXUoTEp2Nq5/ax1Q2dMb?= =?us-ascii?Q?tTpqgd5TkgHavgcm4S0=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 482da906-c9de-4640-7b14-08dc1cb416f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2024 08:11:38.4076 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UmZ2OXcYYRWWJ+Mq1JN9gTYkNdiwpEiR3GKhvcKTZwAsFgPqXL8jG1s5zS2RZTJF/1muGCh2DRqA/g/qa/plIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5289 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: n8cRWSQO6R4hpU9uHVHn3eYBx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=rNmWJK6B; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Felix, I remember you mentioned to me about the usage of SMI handler unregi= stering itself. Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Liu, Zhiguang > Sent: Wednesday, January 24, 2024 12:03 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Liming Gao > ; Wu, Jiaxin ; Ni, Ray > > Subject: [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler > inside SMI handler >=20 > To support unregister SMI handler inside SMI handler itself, > get next node before SMI handler is executed, since LIST_ENTRY that > Link points to may be freed if unregister SMI handler in SMI handler > itself. >=20 > Cc: Liming Gao > Cc: Jiaxin Wu > Cc: Ray Ni > Signed-off-by: Zhiguang Liu > --- > MdeModulePkg/Core/PiSmmCore/Smi.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c > b/MdeModulePkg/Core/PiSmmCore/Smi.c > index 2985f989c3..a75e52b1ae 100644 > --- a/MdeModulePkg/Core/PiSmmCore/Smi.c > +++ b/MdeModulePkg/Core/PiSmmCore/Smi.c > @@ -134,8 +134,14 @@ SmiManage ( >=20 > Head =3D &SmiEntry->SmiHandlers; >=20 > - for (Link =3D Head->ForwardLink; Link !=3D Head; Link =3D Link->Forwar= dLink) { > + for (Link =3D Head->ForwardLink; Link !=3D Head;) { > SmiHandler =3D CR (Link, SMI_HANDLER, Link, > SMI_HANDLER_SIGNATURE); > + // > + // To support unregiser SMI handler inside SMI handler itself, > + // get next node before handler is executed, since LIST_ENTRY that > + // Link points to may be freed if unregister SMI handler. > + // > + Link =3D Link->ForwardLink; >=20 > Status =3D SmiHandler->Handler ( > (EFI_HANDLE)SmiHandler, > -- > 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114269): https://edk2.groups.io/g/devel/message/114269 Mute This Topic: https://groups.io/mt/103925794/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-