From nobody Sat May 18 20:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81044+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81044+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1632407915; cv=none; d=zohomail.com; s=zohoarc; b=brM+wlWgmBhJUFGhlsdLMw18FPDzn8Wk625XtFb8kyEXtKav7q8zqwzzEIaDfZBJKSoNcmh3N2uussqEI3tOBeUgsdA3/tna1sPxKc44MZsdXJYP/deD6gfZYT0aIivcJgSKok9fkf1CFdOLNr2uCKvhmXRJMlEvGfAt9yQSzEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632407915; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=0F50kEsZe7Sr/7t3umZkR72KGmn5OHmowzHDLnO8JDc=; b=m2O9r9pab5nT6JRxKTDcyZ9ef4nQqteQsouYVopqaTuK5QCsVM1Cni9qPMoBLhE3AMPAIjwKPOBNaMa91JsgBqqjjUXgTeixQAIy8oze/qEERVMXR0s8fuwgIJT1yAsNT6m8FnJ8mZAXMMMQbZLXaR7ll4PTSaCSTptHkObRA6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81044+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1632407915875239.58620187878762; Thu, 23 Sep 2021 07:38:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 77BgYY1788612xbbdFNNquI0; Thu, 23 Sep 2021 07:38:35 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web08.3282.1632369718863159010 for ; Wed, 22 Sep 2021 21:01:58 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10115"; a="203256338" X-IronPort-AV: E=Sophos;i="5.85,315,1624345200"; d="scan'208";a="203256338" X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 21:01:58 -0700 X-IronPort-AV: E=Sophos;i="5.85,315,1624345200"; d="scan'208";a="557967498" X-Received: from hshi1-mobl.ccr.corp.intel.com ([10.238.8.237]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 21:01:56 -0700 From: "Shi, Hao" To: devel@edk2.groups.io Cc: Hao Shi , Dandan Bi Subject: [edk2-devel] [PATCH] UserAuthFeaturePkg/UserAuthenticationDxeSmm: The SMI to handle the user authentication should be unregister before booting to OS Date: Thu, 23 Sep 2021 12:01:38 +0800 Message-Id: <20210923040138.1960-1-hao.shi@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,hao.shi@intel.com X-Gm-Message-State: USPk2tLD1Irt4TNakF5H2v6Dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1632407915; bh=FSzQdENB9Eun9J6aRXQ7O88VuGfXC6rLc/HPAHxJs1E=; h=Cc:Date:From:Reply-To:Subject:To; b=L2JYhQ+7hR8Z1dEZX/rlbvDoVlg3+HyPEjrnlfTz7K0t3zfaWKqWSyybz6HmInaej4z Ar2Q595Jph68Er//AvyM1BYmWdjvpYze0RcCkTNragVU22qSA6ulkBoV6V/4tKIl1OWqU HW++3/jj0HAhEU5Aoi7x/UGPRQ7vyZHnjQg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1632407919928100005 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3648 Register SmmExitBootServices and SmmLegacyBoot callback function to unregis= ter this handler. Signed-off-by: Hao Shi --- .../UserAuthenticationSmm.c | 34 +++++++++++++++++++ .../UserAuthenticationSmm.inf | 2 ++ 2 files changed, 36 insertions(+) diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthentica= tionDxeSmm/UserAuthenticationSmm.c b/Features/Intel/UserInterface/UserAuthF= eaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.c index 07e834eb..30f889dd 100644 --- a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe= Smm/UserAuthenticationSmm.c +++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe= Smm/UserAuthenticationSmm.c @@ -13,6 +13,7 @@ UINTN mAdminPasswordTryCount = =3D 0; =20 BOOLEAN mNeedReVerify =3D TRUE; BOOLEAN mPasswordVerified =3D FALSE; +EFI_HANDLE mSmmHandle =3D NULL; =20 /** Verify if the password is correct. @@ -612,6 +613,30 @@ EXIT: return EFI_SUCCESS; } =20 +/** + Performs Exit Boot Services UserAuthentication actions + + @param[in] Protocol Points to the protocol's unique identifier. + @param[in] Interface Points to the interface instance. + @param[in] Handle The handle on which the interface was installed. + + @retval EFI_SUCCESS Notification runs successfully. +**/ +EFI_STATUS +EFIAPI +UaExitBootServices ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + DEBUG ((DEBUG_INFO, "Unregister User Authentication Smi\n")); + + gSmst->SmiHandlerUnRegister(mSmmHandle); + + return EFI_SUCCESS; +} + /** Main entry for this driver. =20 @@ -633,6 +658,7 @@ PasswordSmmInit ( EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock; CHAR16 PasswordHistoryName[sizeof(USER_AU= THENTICATION_VAR_NAME)/sizeof(CHAR16) + 5]; UINTN Index; + EFI_EVENT ExitBootServicesEvent; =20 ASSERT (PASSWORD_HASH_SIZE =3D=3D SHA256_DIGEST_SIZE); ASSERT (PASSWORD_HISTORY_CHECK_COUNT < 0xFFFF); @@ -663,6 +689,14 @@ PasswordSmmInit ( if (EFI_ERROR (Status)) { return Status; } + mSmmHandle =3D SmmHandle; + // + // Register for SmmExitBootServices and SmmLegacyBoot notification. + // + Status =3D gSmst->SmmRegisterProtocolNotify (&gEdkiiSmmExitBootServicesP= rotocolGuid, UaExitBootServices, &ExitBootServicesEvent); + ASSERT_EFI_ERROR (Status); + Status =3D gSmst->SmmRegisterProtocolNotify (&gEdkiiSmmLegacyBootProtoco= lGuid, UaExitBootServices, &ExitBootServicesEvent); + ASSERT_EFI_ERROR (Status); =20 if (IsPasswordCleared()) { DEBUG ((DEBUG_INFO, "IsPasswordCleared\n")); diff --git a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthentica= tionDxeSmm/UserAuthenticationSmm.inf b/Features/Intel/UserInterface/UserAut= hFeaturePkg/UserAuthenticationDxeSmm/UserAuthenticationSmm.inf index 0b33b194..d73a2fe2 100644 --- a/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe= Smm/UserAuthenticationSmm.inf +++ b/Features/Intel/UserInterface/UserAuthFeaturePkg/UserAuthenticationDxe= Smm/UserAuthenticationSmm.inf @@ -48,6 +48,8 @@ [Protocols] gEdkiiVariableLockProtocolGuid ## CONSUMES gEfiSmmVariableProtocolGuid ## CONSUMES + gEdkiiSmmExitBootServicesProtocolGuid ## CONSUMES + gEdkiiSmmLegacyBootProtocolGuid ## CONSUMES =20 [Depex] gEfiSmmVariableProtocolGuid AND gEfiVariableWriteArchProtocolGuid --=20 2.26.2.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 (#81044): https://edk2.groups.io/g/devel/message/81044 Mute This Topic: https://groups.io/mt/85815441/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-