From nobody Mon Feb 9 23:14:42 2026 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+107207+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+107207+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1690248933; cv=none; d=zohomail.com; s=zohoarc; b=M4LDDoh2Sbyz0RAODmO0OW6OUYNf96Cy8beyicVLF9q+h40zTurg4sPVdEkdpVRdch+GuOmwzEO6/C5XLu/+t/JIAAfhcIihqkjpPebc+5dzie1Rh381gX6bkg6K4ZOT4aRvpmgUnfWFkCJIaUI+zjji51OaWwXlhFDcoIEyH1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690248933; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=fKbQ39XDd5NWtoXxnohSgxJgdPIqe8CAz3p/3VxtcgY=; b=d3Tk/aICUftXzbLEsMZNzmgKI9w47bUvsDfKsm/t/u1Xea7/dMYxomcfmlx5NKO3QhiMPsDyhoce9o7k8XiI/T+hvq81ICvTlYm20yPT3BVjCRs6XXfrAgKDR0UDx0dRyRJGnlCAkpKnllJdBB+nLobJaIVBJ0/oM12kxbyftSU= 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+107207+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690248933274869.338899309986; Mon, 24 Jul 2023 18:35:33 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=+QH8aILv4/9xt3ZZWABzfy+HkI1+zFOQm6sy1zeLQIQ=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: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=1690248933; v=1; b=tEn5HVLzCYH7VjrSp69Ktc64OyDUL2FENVQp22ygl1u9UAjCSKsiE41UZsBuPLhrhFl2EzIR Crh4iLEctGIEWvjkschldEdipZDvVepeL5o0zU1gHymF8i1nOY3rFN0ZCAIYzySu7473hea0ocL ujLfofARre7UV6mHnjkE6y+g= X-Received: by 127.0.0.2 with SMTP id RJQdYY1788612x1LF2DLLum4; Mon, 24 Jul 2023 18:35:33 -0700 X-Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mx.groups.io with SMTP id smtpd.web10.11291.1690248932503992027 for ; Mon, 24 Jul 2023 18:35:32 -0700 X-Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1b9c5e07c1bso38123715ad.2 for ; Mon, 24 Jul 2023 18:35:32 -0700 (PDT) X-Gm-Message-State: 8A4woGS55ullCQRPut367Lk5x1787277AA= X-Google-Smtp-Source: APBJJlGjsJeuLhq93PN5royEB8MlFV+BkK4pDqEtUzqp1C076V22sQzfz0fJBl/XunYWhH/U95eqNg== X-Received: by 2002:a17:902:d505:b0:1b6:76ee:190b with SMTP id b5-20020a170902d50500b001b676ee190bmr14449610plg.35.1690248931851; Mon, 24 Jul 2023 18:35:31 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.230.135]) by smtp.gmail.com with ESMTPSA id f8-20020a170902ce8800b001b893b689a0sm9630868plg.84.2023.07.24.18.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 18:35:31 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH v3 10/14] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero Date: Mon, 24 Jul 2023 18:35:09 -0700 Message-ID: <20230725013513.1403-11-t@taylorbeebe.com> In-Reply-To: <20230725013513.1403-1-t@taylorbeebe.com> References: <20230725013513.1403-1-t@taylorbeebe.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,t@taylorbeebe.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690248934453100033 Content-Type: text/plain; charset="utf-8" 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/UefiCpuPk= g/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", M= emoryMap->PhysicalStart, MemoryMap->NumberOfPages)); - if (MemoryMap->Type =3D=3D EfiRuntimeServicesCode) { - MemoryAttribute =3D EFI_MEMORY_RO; - } else { - ASSERT ((MemoryMap->Type =3D=3D EfiRuntimeServicesData) || (MemoryMa= p->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) || (Memory= Map->Type =3D=3D EfiConventionalMemory)); + // + // Set other type memory as NX. + // + MemoryAttribute =3D EFI_MEMORY_XP; + } } =20 // --=20 2.41.0.windows.2 -=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 (#107207): https://edk2.groups.io/g/devel/message/107207 Mute This Topic: https://groups.io/mt/100342606/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-