From nobody Sat May 18 19:12:55 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+90099+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+90099+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1653975596; cv=none; d=zohomail.com; s=zohoarc; b=QCiJ8YlQWGY0iZfVBIYvuIiatN9VKe3oFO/741qhR+xVNt80xIJroTWSDkr5LCLndgIvjPWP99NYYkFEeXvscPlaA3E2r1KBqLFm5CAgwP8xUnnLfRupNbXXFVoT2JwsERIqilee75UFWZrQvdHsaNjPqyvTXjwzzigESHFBc90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653975596; 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=vAZe8N2Ejwlo3qF/N/KSpbeRfy/vArk/0unNI8P5RGI=; b=cbPfGj63VkzeXz2jtNGOqlr55IplqjvZPV1yiaW/VcL/NWVpKTs6uBkoQxd0SN1wcf5x7ZhjdGE8iLw4zhU9xEd6Z7LHrGT5DgwFO8t7war6TWJq/rdsKfMnhvblnH87Q/xPoXZmSYiNZ7FM0NDLYvagMB7VGkWjk8OtzJHXuso= 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+90099+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 1653975596282623.8954106240193; Mon, 30 May 2022 22:39:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5MTSYY1788612xorASb97w0t; Mon, 30 May 2022 22:39:55 -0700 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.45897.1653975594319064902 for ; Mon, 30 May 2022 22:39:55 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10363"; a="335802779" X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="335802779" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 22:39:53 -0700 X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="754287373" X-Received: from liuzhigu-mobl.ccr.corp.intel.com ([10.249.171.130]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 22:39:51 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Guo Dong , Ray Ni , Maurice Ma , Benjamin You , Sean Rhodes Subject: [edk2-devel] [PATCH] UefiPayloadPkg: Always split page table entry to 4K if it covers stack. Date: Tue, 31 May 2022 13:39:37 +0800 Message-Id: <20220531053937.19696-1-zhiguang.liu@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,zhiguang.liu@intel.com X-Gm-Message-State: hGREU1tzhelTBwIvXM52cUbGx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1653975595; bh=GOv6HjyU9RqsMk/HKz+s2nMp+go95J+FFU7OsbiACX4=; h=Cc:Date:From:Reply-To:Subject:To; b=G4FwfuPg7hBJOsouxVex+fXya2Aa4XWTVepLRHXHJrZBnEinWV6djxMn+YSv7Q+aYTP +J+rIFxUpPo23WAnQK6ZE/BV9hN3611MoX+jgclqgeBofwYN7dBChHe3ZCA+YiPZUNQcL GlX+T7Mq8AKaI2OxSPc6eMC2fCTfmgl5qVQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1653975598254100003 Content-Type: text/plain; charset="utf-8" There is a concern case that stack and a proteced DXE memory range is in the same 2M Page Table entry, and somehow CPU doesn't flash the page table entry cache for stack, and causes Page fault when using stack. Always split the page table entry to 4K if it covers stack to avoid this issue. Cc: Guo Dong Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Cc: Sean Rhodes Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c b/UefiPayl= oadPkg/UefiPayloadEntry/X64/VirtualMemory.c index ac0d58e685..74b667a62a 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c +++ b/UefiPayloadPkg/UefiPayloadEntry/X64/VirtualMemory.c @@ -218,16 +218,8 @@ ToSplitPageTable ( return TRUE; } =20 - if (PcdGetBool (PcdCpuStackGuard)) { - if ((StackBase >=3D Address) && (StackBase < (Address + Size))) { - return TRUE; - } - } - - if (PcdGetBool (PcdSetNxForStack)) { - if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase= )) { - return TRUE; - } + if ((Address < StackBase + StackSize) && ((Address + Size) > StackBase))= { + return TRUE; } =20 if (GhcbBase !=3D 0) { --=20 2.16.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 (#90099): https://edk2.groups.io/g/devel/message/90099 Mute This Topic: https://groups.io/mt/91446026/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-