From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B3DC581EC8 for ; Thu, 17 Nov 2016 07:58:12 -0800 (PST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 819F9C00E0D1; Thu, 17 Nov 2016 15:58:17 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-6.phx2.redhat.com [10.3.116.6]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAHFwFrQ002909; Thu, 17 Nov 2016 10:58:16 -0500 To: Jiewen Yao , edk2-devel@ml01.01.org References: <1479389619-16016-1-git-send-email-jiewen.yao@intel.com> Cc: Michael D Kinney , Jeff Fan From: Laszlo Ersek Message-ID: <39cfaef3-e31f-6d5d-01b1-70fe3cc6057f@redhat.com> Date: Thu, 17 Nov 2016 16:58:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1479389619-16016-1-git-send-email-jiewen.yao@intel.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 17 Nov 2016 15:58:17 +0000 (UTC) Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpu: Check XdSupport before set NX. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 15:58:12 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 11/17/16 14:33, Jiewen Yao wrote: > When XD is not supported, the BIT63 is reserved. > We should not set BIT63 in the page table. > > Test OVMF IA32/IA32X64 with XD enabled/disabled. > > Analyzed-by: Laszlo Ersek > Cc: Laszlo Ersek > Cc: Jeff Fan > Cc: Michael D Kinney > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > --- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > index b4f8861..c85e025 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > @@ -209,10 +209,12 @@ ConvertPageEntryAttribute ( > } > } > if ((Attributes & EFI_MEMORY_XP) != 0) { > - if (IsSet) { > - NewPageEntry |= IA32_PG_NX; > - } else { > - NewPageEntry &= ~IA32_PG_NX; > + if (mXdSupported) { > + if (IsSet) { > + NewPageEntry |= IA32_PG_NX; > + } else { > + NewPageEntry &= ~IA32_PG_NX; > + } > } > } > *PageEntry = NewPageEntry; > Tested-by: Laszlo Ersek Thanks! Laszlo