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 7151FD811B0 for ; Wed, 24 Jan 2024 13:06:20 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1by/MdW8klvK3L7pBXM9WKLlSFgzj4tRkOGVFvexUxM=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To: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=1706101579; v=1; b=niaX7SyHS5QOotnZ8y4ZPjFD2XxQi6UzY8MljdSKa+rUFSP4xPWoRJ7gcjeXyEwfPlaahCPV PeikCrI7GNloXXK+ujgpUF0CEk1L2TL3s/7nO20r2YqzCEoMP0wME7k9DSzOytSKovaFIZExI/H bOLRFN8Fvei3kHUJEskECn7A= X-Received: by 127.0.0.2 with SMTP id FhKaYY7687511xnK81KA9Sg9; Wed, 24 Jan 2024 05:06:19 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.21803.1706101578313484743 for ; Wed, 24 Jan 2024 05:06:18 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-_X_dRedjO8iulsrLdPLm0A-1; Wed, 24 Jan 2024 08:06:15 -0500 X-MC-Unique: _X_dRedjO8iulsrLdPLm0A-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6AC8D85A5A6; Wed, 24 Jan 2024 13:06:15 +0000 (UTC) X-Received: from [10.39.195.127] (unknown [10.39.195.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7468F2166B33; Wed, 24 Jan 2024 13:06:14 +0000 (UTC) Message-ID: <9aa1a85d-89c0-6c7b-0174-184791d75bcd@redhat.com> Date: Wed, 24 Jan 2024 14:06:13 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler To: devel@edk2.groups.io, ray.ni@intel.com, "Liu, Zhiguang" Cc: Liming Gao , "Wu, Jiaxin" , "POLUDOV, FELIX" References: <20240124040301.2176-1-zhiguang.liu@intel.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: YpPV1mdnrHQupEEzXjiCtnJvx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 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=niaX7SyH; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 1/24/24 09:11, Ni, Ray wrote: > Felix, I remember you mentioned to me about the usage of SMI handler unre= gistering itself. I wanted to ask: is this something that the PI spec comments on? I.e., is this usage expected by the spec (in which case this bugfix is a conformance fix), or is the spec silent on it (in which case I guess we can call this a quality-of-implementation improvement)? >=20 > Reviewed-by: Ray Ni Reviewed-by: Laszlo Ersek Thanks Laszlo >=20 > 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 >> >> 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. >> >> 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(-) >> >> 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 ( >> >> Head =3D &SmiEntry->SmiHandlers; >> >> - for (Link =3D Head->ForwardLink; Link !=3D Head; Link =3D Link->Forwa= rdLink) { >> + 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; >> >> Status =3D SmiHandler->Handler ( >> (EFI_HANDLE)SmiHandler, >> -- >> 2.31.1.windows.1 >=20 >=20 >=20 >=20 >=20 >=20 -=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 (#114291): https://edk2.groups.io/g/devel/message/114291 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-