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 619277803CD for ; Wed, 8 Nov 2023 02:20:30 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=f8V/vATKE5tN58yCtu0uIdJhAUvgnPzA93UvSllbnuM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699410028; v=1; b=pazgKRWp1ZuTNPRq7+jqQs8FJhjH4n5N7J62bTZz5a2OwhypcdcwWIzpbmd8A3otYqSVEhq2 mum0C35FR7YGMqGxZw7xQzLPHV4rhMey3cHeELibcpTu0oBT9dd13TbpVDxPR4gRMIL0XlCQvH9 eOQ8o7EnH4v+XOT6xGCk0P5g= X-Received: by 127.0.0.2 with SMTP id 96nuYY7687511xfx18pCcBt5; Tue, 07 Nov 2023 18:20:28 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.5520.1699410024118966955 for ; Tue, 07 Nov 2023 18:20:28 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="392543223" X-IronPort-AV: E=Sophos;i="6.03,285,1694761200"; d="scan'208";a="392543223" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2023 18:20:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="712788863" X-IronPort-AV: E=Sophos;i="6.03,285,1694761200"; d="scan'208";a="712788863" X-Received: from shwdesssddpdwei.ccr.corp.intel.com ([10.239.157.28]) by orsmga003.jf.intel.com with ESMTP; 07 Nov 2023 18:20:26 -0800 From: "Sheng Wei" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Wu Jiaxin , Tan Dun Subject: [edk2-devel] [PATCH v3 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Change CR4.CET bit only Date: Wed, 8 Nov 2023 10:20:09 +0800 Message-Id: <20231108022009.312-3-w.sheng@intel.com> In-Reply-To: <20231108022009.312-1-w.sheng@intel.com> References: <20231108022009.312-1-w.sheng@intel.com> MIME-Version: 1.0 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,w.sheng@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: WTpbdAImD2lNPB9YcJ9KQp7Lx7686176AA= 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=pazgKRWp; 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 Do not use fixed CR4 value 0x668, change CR4.CET bit only. Signed-off-by: Sheng Wei Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Wu Jiaxin Cc: Tan Dun --- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 9 ++++++--- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm b/UefiCpuPkg/PiSm= mCpuDxeSmm/Ia32/SmiEntry.nasm index 68332e2c3f..a087576a54 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm @@ -260,7 +260,8 @@ CetInterruptDone: bts ecx, 16 ; set WP=0D mov cr0, ecx=0D =0D - mov eax, 0x668 | CR4_CET=0D + mov eax, cr4=0D + bts eax, CR4_CET_BIT=0D mov cr4, eax=0D =0D setssbsy=0D @@ -292,8 +293,10 @@ CetDone: xor edx, edx=0D wrmsr=0D =0D - mov eax, 0x668=0D - mov cr4, eax ; disable CET=0D + ; clear CR4.CET bit=0D + mov eax, cr4=0D + btr eax, CR4_CET_BIT=0D + mov cr4, eax=0D =0D mov ecx, MSR_IA32_PL0_SSP=0D pop eax=0D diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmm= CpuDxeSmm/X64/SmiEntry.nasm index 007fbff640..7aed7c8dda 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm @@ -287,7 +287,8 @@ CetInterruptDone: bts ecx, 16 ; set WP=0D mov cr0, rcx=0D =0D - mov eax, 0x668 | CR4_CET=0D + mov rax, cr4=0D + bts rax, CR4_CET_BIT=0D mov cr4, rax=0D =0D setssbsy=0D --=20 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110885): https://edk2.groups.io/g/devel/message/110885 Mute This Topic: https://groups.io/mt/102457046/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-