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 77992AC1022 for ; Thu, 2 Nov 2023 11:33:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=7ezzytg6EEk+YxEb4+gtmb97yhkGaOkWIDdm7mslUc0=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698924790; v=1; b=MJdCdhJijLD9k5J2BLs3MxRwnndvIxQlJSG2aP3CulF+OotMUgp32C3K8VYBSLfuNwGxR2tS W5GaMT0p1/jwFXWXEBGlWbE2M0xcpbc5QpE0NaklKpuwE3myr28yyFoj6X9iAfSxJSXTvXKxq7u Uq7Le24iJ/282pOkeFvU6H/0= X-Received: by 127.0.0.2 with SMTP id LN05YY7687511xafoqCMGgPu; Thu, 02 Nov 2023 04:33:10 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.28467.1698924789573679991 for ; Thu, 02 Nov 2023 04:33:09 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-NisAnhHaMfizLsp02_Lknw-1; Thu, 02 Nov 2023 07:33:05 -0400 X-MC-Unique: NisAnhHaMfizLsp02_Lknw-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3ED2885A5B5; Thu, 2 Nov 2023 11:33:05 +0000 (UTC) X-Received: from [10.39.195.76] (unknown [10.39.195.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 421D940C6EBF; Thu, 2 Nov 2023 11:33:04 +0000 (UTC) Message-ID: <7704ef2b-cf6f-6a2b-2eec-c9f76f615f6f@redhat.com> Date: Thu, 2 Nov 2023 12:33:03 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v4 11/14] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero To: devel@edk2.groups.io, taylor.d.beebe@gmail.com Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann References: <20230804194649.2001-1-t@taylorbeebe.com> <177845D23ACA42F9.19347@groups.io> <73a5273e-2dd5-42d1-aed9-287ddea1fe27@gmail.com> From: "Laszlo Ersek" In-Reply-To: <73a5273e-2dd5-42d1-aed9-287ddea1fe27@gmail.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Q3Zi94eos2b8QttqSaApZBI1x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=MJdCdhJi; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.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 On 11/1/23 21:11, Taylor Beebe wrote: > This patch is the final in this series which needs a review. Can someone > take a look? I'll try to do that. I didn't have mail delivery enabled for the list in August. Can you resend v4, rebased, and with the R-b / A-b tags given thus far picked up? Sorry about the churn. Thanks, Laszlo > > On 8/4/2023 12:46 PM, Taylor Beebe via groups.io wrote: >> From: Taylor Beebe >> >> The function EnforceMemoryMapAttribute() in the SMM MAT logic will >> ensure that the CODE and DATA memory types have the desired attributes. >> The consumer of the SMM MAT should only override the Attributes field >> in the MAT if it is nonzero. This also allows the UEFI and SMM MAT >> logic to use ImagePropertiesRecordLib instead of carrying two copies >> of the image properties record manipulation. >> >> Signed-off-by: Taylor Beebe >> Cc: Eric Dong >> Cc: Ray Ni >> Cc: Rahul Kumar >> Cc: Gerd Hoffmann >> --- >>   UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 19 >> +++++++++++-------- >>   1 file changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c >> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c >> index 6f498666157e..d302a9b0cbcf 100644 >> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c >> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c >> @@ -1062,14 +1062,17 @@ SetMemMapAttributes ( >>     MemoryMap = MemoryMapStart; >>     for (Index = 0; Index < MemoryMapEntryCount; Index++) { >>       DEBUG ((DEBUG_VERBOSE, "SetAttribute: Memory Entry - 0x%lx, >> 0x%x\n", MemoryMap->PhysicalStart, MemoryMap->NumberOfPages)); >> -    if (MemoryMap->Type == EfiRuntimeServicesCode) { >> -      MemoryAttribute = EFI_MEMORY_RO; >> -    } else { >> -      ASSERT ((MemoryMap->Type == EfiRuntimeServicesData) || >> (MemoryMap->Type == EfiConventionalMemory)); >> -      // >> -      // Set other type memory as NX. >> -      // >> -      MemoryAttribute = EFI_MEMORY_XP; >> +    MemoryAttribute = MemoryMap->Attribute & EFI_MEMORY_ACCESS_MASK; >> +    if (MemoryAttribute == 0) { >> +      if (MemoryMap->Type == EfiRuntimeServicesCode) { >> +        MemoryAttribute = EFI_MEMORY_RO; >> +      } else { >> +        ASSERT ((MemoryMap->Type == EfiRuntimeServicesData) || >> (MemoryMap->Type == EfiConventionalMemory)); >> +        // >> +        // Set other type memory as NX. >> +        // >> +        MemoryAttribute = EFI_MEMORY_XP; >> +      } >>       } >>         // -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110523): https://edk2.groups.io/g/devel/message/110523 Mute This Topic: https://groups.io/mt/102328201/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-