From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.9005.1675426263632109785 for ; Fri, 03 Feb 2023 04:11:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bAkn6Mj4; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E3CE61ED2; Fri, 3 Feb 2023 12:11:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF14C4339C; Fri, 3 Feb 2023 12:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675426262; bh=Z/vrQfdrQRkElKFPAKeAABVAVq/iOMFnc6kwCLOl7R4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bAkn6Mj4h+52dlSzapC52ROIQF+OUpv7valZ4rOtQ38qpBSKln336UUGc5P24MKti V2ACPbmpQVxZ3Dj3PvnlIlYKucPd9vs8Z5Ozvci+gxAaIV8ZHXhjY33635y+OXPd9M 6toRsPonwxMF1TH9TZ8FBeY3rfdbRjQCMowidkjv6zaCYvn67d9LfsGBjQ+bDGbtTl /sYAn4dqhmBsWyiOTfNfMoueBxwZB/uyGBBvcVmFehWvNPQO9RNBsUNRSXt6jlqfeb D8UIdlGcPBNoNlpN3IZex4ALcS+7btjMyjwYhJ+EvQgKDwEg6RJkvfArS8TfFh/xmG wdmJttq+0cdcw== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Leif Lindholm , Sami Mujawar , Taylor Beebe , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [RFC PATCH v2 1/7] MdePkg: Update MemoryAttributesTable to v2.10 Date: Fri, 3 Feb 2023 13:10:23 +0100 Message-Id: <20230203121029.2451394-2-ardb@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203121029.2451394-1-ardb@kernel.org> References: <20230203121029.2451394-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable UEFI v2.10 introduces a new flag to the memory attributes table to inform the OS whether or not runtime services code regions were emitted by the compiler with guard instructions for forward edge control flow integrity enforcement. So update our definition accordingly. Signed-off-by: Ard Biesheuvel Reviewed-by: Michael D Kinney Acked-by: Michael Kubacki --- MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 2 +- MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c b/MdeModule= Pkg/Core/Dxe/Misc/MemoryAttributesTable.c index e07921371187..82fa026bceb9 100644 --- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c @@ -182,7 +182,7 @@ InstallMemoryAttributesTable ( MemoryAttributesTable->Version =3D EFI_MEMORY_ATTRIBUTES_TABLE_V= ERSION;=0D MemoryAttributesTable->NumberOfEntries =3D RuntimeEntryCount;=0D MemoryAttributesTable->DescriptorSize =3D (UINT32)DescriptorSize;=0D - MemoryAttributesTable->Reserved =3D 0;=0D + MemoryAttributesTable->Flags =3D 0;=0D DEBUG ((DEBUG_VERBOSE, "MemoryAttributesTable:\n"));=0D DEBUG ((DEBUG_VERBOSE, " Version - 0x%08x\n", MemoryAttrib= utesTable->Version));=0D DEBUG ((DEBUG_VERBOSE, " NumberOfEntries - 0x%08x\n", MemoryAttrib= utesTable->NumberOfEntries));=0D diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h b/MdePkg/Include/G= uid/MemoryAttributesTable.h index 82f83a67b96d..238c14ff92df 100644 --- a/MdePkg/Include/Guid/MemoryAttributesTable.h +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h @@ -17,11 +17,15 @@ typedef struct { UINT32 Version;=0D UINT32 NumberOfEntries;=0D UINT32 DescriptorSize;=0D - UINT32 Reserved;=0D + UINT32 Flags;=0D // EFI_MEMORY_DESCRIPTOR Entry[1];=0D } EFI_MEMORY_ATTRIBUTES_TABLE;=0D =0D -#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION 0x00000001=0D +#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION 0x00000002=0D +=0D +#define EFI_MEMORY_ATTRIBUTES_FLAGS_RT_FORWARD_CONTROL_FLOW_GUARD 0x1=0D +// BIT0 implies that Runtime code includes the forward control flow guard= =0D +// instruction, such as X86 CET-IBT or ARM BTI.=0D =0D extern EFI_GUID gEfiMemoryAttributesTableGuid;=0D =0D --=20 2.39.1