From nobody Mon Feb 9 01:16:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44470+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44470+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1564198173; cv=none; d=zoho.com; s=zohoarc; b=EtX85NrsvnnfWim03JVjfhWc502KQbEOh18dKEcmEKWGuV2qhbu0nir8UpZ/dFfn1tkRVIKJ/4+hT2cu0+HyXLgrl5MSEbK15SWeisfwcYYy4FPbSs3P+S90Tnp4weTg2twrFeyoKkWn25dLeuIwS4/VuAM4oPqx2A81LNMzfvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564198173; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=NKH/hTkSWYMlnT7MhOk+g3LgCDS6uAQSJBP7X+vDMYI=; b=BU7QxsZl3B0lSOVhvJB8l9N77u0s/pT6gzw0iq3Snz/PQocsodkCA8nXF+CsyQTuUp7oTRcbE4bu6DJrBNUdzgUJylniiBVtzm+kXPIS9nac1+wftJo2pTwkqFrr9vTfW3qg6lEkyE0OnSS8K9a1MGGTZJJo9k8nHnUbc4nQ2pg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44470+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1564198173137796.4849951360327; Fri, 26 Jul 2019 20:29:33 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 26 Jul 2019 20:29:32 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 20:29:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,313,1559545200"; d="scan'208";a="194505177" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.9.16]) by fmsmga004.fm.intel.com with ESMTP; 26 Jul 2019 20:29:31 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Jiewen Yao , Jian J Wang Subject: [edk2-devel] [PATCH 3/3] UefiCpuPkg/PiSmmCpu: Allow SMM access-out when static paging is OFF Date: Sat, 27 Jul 2019 11:28:50 +0800 Message-Id: <20190727032850.337840-4-ray.ni@intel.com> In-Reply-To: <20190727032850.337840-1-ray.ni@intel.com> References: <20190727032850.337840-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1564198172; bh=BYiLIiktP7/AQ5gijAzajJUit9+yf1OL4BQrP8QCA1k=; h=Cc:Date:From:Reply-To:Subject:To; b=B8SosGwqmdzZaqGBBjjF+Ft2sYV20UUcMq6Z8gCS95f3+18PxqgW9LV62hbX2x4p9pE D4Ko6I4jBwhtlXfgOAeNGfLgScywk0BgPArM3J1JjD9eYTWdaS95G8Ka9mVc4lw5PHgET sr18ekiCCaR945NKVpw50akbnQ43YJDFB00= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Commit c60d36b4d1ee1f69b7cca897d3621dfa951895c2 * UefiCpuPkg/SmmCpu: Block access-out only when static paging is used updated page fault handler to treat SMM access-out as allowed address when static paging is not used. But that commit is not complete because the page table is still updated in SetUefiMemMapAttributes() for non-SMRAM memory. When SMM code accesses non-SMRAM memory, page fault is still generated. This patch skips to update page table for non-SMRAM memory and page table itself. Signed-off-by: Ray Ni Cc: Eric Dong Cc: Jiewen Yao Cc: Jian J Wang Acked-by: Laszlo Ersek Reviewed-by: Eric Dong --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 69a04dfb23..d7d94c8b6d 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -1121,6 +1121,9 @@ FindSmramInfo ( *SmrrBase =3D (UINT32)CurrentSmramRange->CpuStart; *SmrrSize =3D (UINT32)CurrentSmramRange->PhysicalSize; =20 + // + // Extend *SmrrBase/*SmrrSize to include adjacent SMRAM ranges + // do { Found =3D FALSE; for (Index =3D 0; Index < mSmmCpuSmramRangeCount; Index++) { @@ -1432,14 +1435,20 @@ PerformRemainingTasks ( SetMemMapAttributes (); =20 // - // For outside SMRAM, we only map SMM communication buffer or MMIO. + // Protect memory outside SMRAM when SMM Static Page Table is enabled. // - SetUefiMemMapAttributes (); + if (IsStaticPageTableEnabled ()) { =20 - // - // Set page table itself to be read-only - // - SetPageTableAttributes (); + // + // For outside SMRAM, we only map SMM communication buffer or MMIO. + // + SetUefiMemMapAttributes (); + + // + // Set page table itself to be read-only + // + SetPageTableAttributes (); + } =20 // // Configure SMM Code Access Check feature if available. --=20 2.21.0.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 (#44470): https://edk2.groups.io/g/devel/message/44470 Mute This Topic: https://groups.io/mt/32616003/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-