From nobody Fri May 17 06:43:19 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+113513+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+113513+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1704865119; cv=none; d=zohomail.com; s=zohoarc; b=RKq5LOf3srs+G5lqfXWx+2rHEUE7qFIgxoQfeHLoewUpNYc/JuGLpmF3U4HwwJmGl01aP3h2uDd11EPRodPTxKICl2NSe/5X8JZnzZBNm/T0t+q/xA5Q6BQW63WMqjZpXx0YSDsALQss97UH7fpTIaWOdvUv5gZB8WkDvmthyTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704865119; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=7BQnUK1gnKro4KzTvoTYgIq1yLfBfbnS+2Zi+5hTbHc=; b=Pi1uFsvBRGEjQ3MLSv1VnIi98I83IhlIgkyjpdJxbtje1CDojmuJQn76vQFgwn1lT/d0BGMtSgHAggAltWHdJoIDGwCZanx99jxj6tJ5D47b+XqNP84aMuAXHKsXWFSWj6Jqq+ai0IjZVtl08bOeq58ylpvhPIGXLwSomWSHGIA= 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+113513+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 1704865119611656.1825845647168; Tue, 9 Jan 2024 21:38:39 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=cqXk+j9BrbEEP3ft8Wc/z5OK57LmZ6TwevxAR3Fkoh8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id: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=1704865119; v=1; b=FJ/X7bV/hckr3RZpCME/5jFnCEdRj9dDEnr2Vk5KPO4kn9aO5KiZ9odtamaP3zHC8CfN0m5f j8uwyiOkkRgRea7mV6TAig0XObcUwfVN0j5I/gBjVyhA0oXKxSo6V4lgMH54aD1lB1w1VGQJk5N U+3IQpAbgkAFomrDZSNi/71g= X-Received: by 127.0.0.2 with SMTP id HExeYY1788612xxCtLLFI9pg; Tue, 09 Jan 2024 21:38:39 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by mx.groups.io with SMTP id smtpd.web10.5935.1704865118127832874 for ; Tue, 09 Jan 2024 21:38:38 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="5501259" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="5501259" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 21:38:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="872492363" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="872492363" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 21:38:34 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Ray Ni , Laszlo Ersek , Rahul Kumar , Gerd Hoffmann , Crystal Lee Subject: [edk2-devel] [PATCH] UefiCpuPkg: Fix issue that IsModified is wrongly set in PageTableMap Date: Wed, 10 Jan 2024 13:38:28 +0800 Message-Id: <20240110053828.1473-1-zhiguang.liu@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,zhiguang.liu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 79MknthDjkr7fHfWCgxWaD3Wx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1704865121906100003 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4614 Fix issue that IsModified is wrongly set in PageTableMap. Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Crystal Lee Signed-off-by: Zhiguang Liu Reviewed-by: Ray Ni --- UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c b/UefiCpu= Pkg/Library/CpuPageTableLib/CpuPageTableMap.c index 36b2c4e6a3..164187f151 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c @@ -567,7 +567,10 @@ PageTableLibMapInLevel ( OriginalCurrentPagingEntry.Uint64 =3D CurrentPagingEntry->Uint64; PageTableLibSetPle (Level, CurrentPagingEntry, Offset, Attribute, = &CurrentMask); =20 - if (OriginalCurrentPagingEntry.Uint64 !=3D CurrentPagingEntry->Uin= t64) { + if (Modify && (OriginalCurrentPagingEntry.Uint64 !=3D CurrentPagin= gEntry->Uint64)) { + // + // The page table entry can be changed by this function only whe= n Modify is true. + // *IsModified =3D TRUE; } } @@ -609,7 +612,10 @@ PageTableLibMapInLevel ( // Check if ParentPagingEntry entry is modified here is enough. Except t= he changes happen in leaf PagingEntry during // the while loop, if there is any other change happens in page table, t= he ParentPagingEntry must has been modified. // - if (OriginalParentPagingEntry.Uint64 !=3D ParentPagingEntry->Uint64) { + if (Modify && (OriginalParentPagingEntry.Uint64 !=3D ParentPagingEntry->= Uint64)) { + // + // The page table entry can be changed by this function only when Modi= fy is true. + // *IsModified =3D TRUE; } =20 --=20 2.31.1.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 (#113513): https://edk2.groups.io/g/devel/message/113513 Mute This Topic: https://groups.io/mt/103636407/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-