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 78E41AC17FC for ; Wed, 1 Nov 2023 20:11:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=YRrJkdbGbr63lFTD/nw/RFfb0tr0EvwGrcr4tAG1oKQ=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent: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=1698869503; v=1; b=ABS9onH0O3IKDCUSdOQqEdhywP8ZPkXJnoR51FxoZuBSupqxAoJo8nQn+f0qgCgd80gNAIEr 6JvF1KTbgyxLp6KsEjd3CqYUyQKOiVtx1d1MYBEYOt8keehz3tY3VYza6FB0MZm7vX07d1QdMhj 4nqbdTuaQUET1/UQcIH09r7Q= X-Received: by 127.0.0.2 with SMTP id IequYY7687511xvNoKnKBG7r; Wed, 01 Nov 2023 13:11:43 -0700 X-Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mx.groups.io with SMTP id smtpd.web11.42674.1698869502342955110 for ; Wed, 01 Nov 2023 13:11:42 -0700 X-Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1cc29f39e7aso1222325ad.0 for ; Wed, 01 Nov 2023 13:11:42 -0700 (PDT) X-Gm-Message-State: L7H6Tqa3IrBn3vQ8JBJxzskxx7686176AA= X-Google-Smtp-Source: AGHT+IEHh2VrTbYPUxbR57won60giN7rY7a4+G2PhEktj1DShLx7K/mrgnqvkD9Nii80uUT9GVnReA== X-Received: by 2002:a17:902:dac3:b0:1cc:2c45:757a with SMTP id q3-20020a170902dac300b001cc2c45757amr17005058plx.10.1698869501509; Wed, 01 Nov 2023 13:11:41 -0700 (PDT) X-Received: from [192.168.0.125] ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id u6-20020a17090282c600b001c611e9a5fdsm1675855plz.306.2023.11.01.13.11.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Nov 2023 13:11:41 -0700 (PDT) Message-ID: <73a5273e-2dd5-42d1-aed9-287ddea1fe27@gmail.com> Date: Wed, 1 Nov 2023 13:11:40 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v4 11/14] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann References: <20230804194649.2001-1-t@taylorbeebe.com> <177845D23ACA42F9.19347@groups.io> From: "Taylor Beebe" In-Reply-To: <177845D23ACA42F9.19347@groups.io> 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,taylor.d.beebe@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ABS9onH0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.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 This patch is the final in this series which needs a review. Can someone=20 take a look? 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/UefiCpu= Pkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > index 6f498666157e..d302a9b0cbcf 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > @@ -1062,14 +1062,17 @@ SetMemMapAttributes ( > MemoryMap =3D MemoryMapStart; > for (Index =3D 0; Index < MemoryMapEntryCount; Index++) { > DEBUG ((DEBUG_VERBOSE, "SetAttribute: Memory Entry - 0x%lx, 0x%x\n"= , MemoryMap->PhysicalStart, MemoryMap->NumberOfPages)); > - if (MemoryMap->Type =3D=3D EfiRuntimeServicesCode) { > - MemoryAttribute =3D EFI_MEMORY_RO; > - } else { > - ASSERT ((MemoryMap->Type =3D=3D EfiRuntimeServicesData) || (Memory= Map->Type =3D=3D EfiConventionalMemory)); > - // > - // Set other type memory as NX. > - // > - MemoryAttribute =3D EFI_MEMORY_XP; > + MemoryAttribute =3D MemoryMap->Attribute & EFI_MEMORY_ACCESS_MASK; > + if (MemoryAttribute =3D=3D 0) { > + if (MemoryMap->Type =3D=3D EfiRuntimeServicesCode) { > + MemoryAttribute =3D EFI_MEMORY_RO; > + } else { > + ASSERT ((MemoryMap->Type =3D=3D EfiRuntimeServicesData) || (Memo= ryMap->Type =3D=3D EfiConventionalMemory)); > + // > + // Set other type memory as NX. > + // > + MemoryAttribute =3D EFI_MEMORY_XP; > + } > } > =20 > // -=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 (#110488): https://edk2.groups.io/g/devel/message/110488 Mute This Topic: https://groups.io/mt/102328201/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-