From nobody Mon Feb 9 01:20:40 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+107597+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+107597+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1691178430; cv=none; d=zohomail.com; s=zohoarc; b=Bu7MgRd+/C6kzRu8KwIctk1zA08XM54FNBSarbqXj7z3oBLbS8TQ4NLhZ3Q7WZoD0gUGdCWhxygHY5XnHgCf8BPJzNsi3tUgfiGy6m0WVt5mZBtVx1Vz3oWw5bfzmedSzB6Z0fJu9TMa3law9G6u313NeFWp3UAuCv42pK+IhXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691178430; 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=zmLU47f03H2+NM5ZUGW2mhwwoTw75Rqjk0dEGosOVyg=; b=KdNELa3xHA2WfQdaVmaya7EEW86U+frmGVy9Jr96yEFqHw42gwFQvsslQvNrr3m5YpQeR06ll+o1Qqh+AKYCI6W7k6CcLP4q+ho/QIQ4AEzB6JjzQmiQjJcpcjjdmVtgQbeLh1ljDgrqzm6LOiyPu8aq/6mboHbSXNKK14SvUvU= 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+107597+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1691178430631306.4911543154475; Fri, 4 Aug 2023 12:47:10 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=zjBpl5fzo69B98/iJ9b7A0JDvffqNtkTAT/wDYvLPC8=; c=relaxed/simple; d=groups.io; h=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=1691178430; v=1; b=Kn6rNBgnUvv5ChuOs1X41YiD3X7TKcevLiTp0NXAj4taJ8TtkLTB78w9IZ3vMQlosWMefUig o8G5+Q+6taL8YuoKKxggI+Cv1MmxMryEJmxuLlhl+CJ+r2vo+T9FpTpFDZumz0KDj0HLWkYB0ku nLv2LBy/mVhZFZrMmUL8q9WE= X-Received: by 127.0.0.2 with SMTP id 4GM4YY1788612x04spU4f3AW; Fri, 04 Aug 2023 12:47:10 -0700 X-Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mx.groups.io with SMTP id smtpd.web10.6305.1691178429201326724 for ; Fri, 04 Aug 2023 12:47:09 -0700 X-Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1bbc87ded50so17406715ad.1 for ; Fri, 04 Aug 2023 12:47:09 -0700 (PDT) X-Gm-Message-State: ExW0BwZHAxPIisceGXRSQ7Nrx1787277AA= X-Google-Smtp-Source: AGHT+IG3aT8Qm8NVooiKUlOZrFx8aR/W9i3hxEZDllFsZU8mcIXr6Q2LVV81ITCQXoiEemxwU+uWzA== X-Received: by 2002:a17:903:2350:b0:1bc:3504:de35 with SMTP id c16-20020a170903235000b001bc3504de35mr3123978plh.62.1691178428598; Fri, 04 Aug 2023 12:47:08 -0700 (PDT) X-Received: from localhost.localdomain ([50.46.230.135]) by smtp.gmail.com with ESMTPSA id h15-20020a170902f7cf00b001b890b3bbb1sm2114133plw.211.2023.08.04.12.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 12:47:08 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH v4 11/14] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero Date: Fri, 4 Aug 2023 12:46:45 -0700 Message-ID: <20230804194649.2001-12-t@taylorbeebe.com> In-Reply-To: <20230804194649.2001-1-t@taylorbeebe.com> References: <20230804194649.2001-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: 1691178431480100039 Content-Type: text/plain; charset="utf-8" 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/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.3 -=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 (#107597): https://edk2.groups.io/g/devel/message/107597 Mute This Topic: https://groups.io/mt/100553443/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-