[edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10

Ard Biesheuvel posted 17 patches 1 year, 6 months ago
There is a newer version of this series
[edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10
Posted by Ard Biesheuvel 1 year, 6 months ago
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.

Link: https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h b/MdePkg/Include/Guid/MemoryAttributesTable.h
index 82f83a67b96d38c5..238c14ff92dfed31 100644
--- a/MdePkg/Include/Guid/MemoryAttributesTable.h
+++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
@@ -17,11 +17,15 @@ typedef struct {
   UINT32    Version;
   UINT32    NumberOfEntries;
   UINT32    DescriptorSize;
-  UINT32    Reserved;
+  UINT32    Flags;
   // EFI_MEMORY_DESCRIPTOR Entry[1];
 } EFI_MEMORY_ATTRIBUTES_TABLE;
 
-#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION  0x00000001
+#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION  0x00000002
+
+#define EFI_MEMORY_ATTRIBUTES_FLAGS_RT_FORWARD_CONTROL_FLOW_GUARD  0x1
+// BIT0 implies that Runtime code includes the forward control flow guard
+// instruction, such as X86 CET-IBT or ARM BTI.
 
 extern EFI_GUID  gEfiMemoryAttributesTableGuid;
 
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101939): https://edk2.groups.io/g/devel/message/101939
Mute This Topic: https://groups.io/mt/97879302/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10
Posted by Leif Lindholm 1 year, 6 months ago
On Mon, Mar 27, 2023 at 13:01:10 +0200, Ard Biesheuvel wrote:
> 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.
> 
> Link: https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h b/MdePkg/Include/Guid/MemoryAttributesTable.h
> index 82f83a67b96d38c5..238c14ff92dfed31 100644
> --- a/MdePkg/Include/Guid/MemoryAttributesTable.h
> +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
> @@ -17,11 +17,15 @@ typedef struct {
>    UINT32    Version;
>    UINT32    NumberOfEntries;
>    UINT32    DescriptorSize;
> -  UINT32    Reserved;
> +  UINT32    Flags;

Does this not cause a bisect breakage vs patch 17?

/
    Leif

>    // EFI_MEMORY_DESCRIPTOR Entry[1];
>  } EFI_MEMORY_ATTRIBUTES_TABLE;
>  
> -#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION  0x00000001
> +#define EFI_MEMORY_ATTRIBUTES_TABLE_VERSION  0x00000002
> +
> +#define EFI_MEMORY_ATTRIBUTES_FLAGS_RT_FORWARD_CONTROL_FLOW_GUARD  0x1
> +// BIT0 implies that Runtime code includes the forward control flow guard
> +// instruction, such as X86 CET-IBT or ARM BTI.
>  
>  extern EFI_GUID  gEfiMemoryAttributesTableGuid;
>  
> -- 
> 2.39.2
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101955): https://edk2.groups.io/g/devel/message/101955
Mute This Topic: https://groups.io/mt/97879302/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10
Posted by Ard Biesheuvel 1 year, 6 months ago
On Mon, 27 Mar 2023 at 15:30, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>
> On Mon, Mar 27, 2023 at 13:01:10 +0200, Ard Biesheuvel wrote:
> > 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.
> >
> > Link: https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> > Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
> > ---
> >  MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > index 82f83a67b96d38c5..238c14ff92dfed31 100644
> > --- a/MdePkg/Include/Guid/MemoryAttributesTable.h
> > +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > @@ -17,11 +17,15 @@ typedef struct {
> >    UINT32    Version;
> >    UINT32    NumberOfEntries;
> >    UINT32    DescriptorSize;
> > -  UINT32    Reserved;
> > +  UINT32    Flags;
>
> Does this not cause a bisect breakage vs patch 17?
>

Yeah, rebase error - this change should update the reference to
Reserved as well in
MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c, and patch 17/17
should only change the value that gets assigned to it.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102130): https://edk2.groups.io/g/devel/message/102130
Mute This Topic: https://groups.io/mt/97879302/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 15/17] MdePkg: Update MemoryAttributesTable to v2.10
Posted by Leif Lindholm 1 year, 6 months ago
On Wed, Mar 29, 2023 at 18:47:50 +0200, Ard Biesheuvel wrote:
> On Mon, 27 Mar 2023 at 15:30, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
> >
> > On Mon, Mar 27, 2023 at 13:01:10 +0200, Ard Biesheuvel wrote:
> > > 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.
> > >
> > > Link: https://uefi.org/specs/UEFI/2.10/04_EFI_System_Table.html#efi-memory-attributes-table
> > > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > > Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> > > Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
> > > ---
> > >  MdePkg/Include/Guid/MemoryAttributesTable.h | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/MdePkg/Include/Guid/MemoryAttributesTable.h b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > index 82f83a67b96d38c5..238c14ff92dfed31 100644
> > > --- a/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > +++ b/MdePkg/Include/Guid/MemoryAttributesTable.h
> > > @@ -17,11 +17,15 @@ typedef struct {
> > >    UINT32    Version;
> > >    UINT32    NumberOfEntries;
> > >    UINT32    DescriptorSize;
> > > -  UINT32    Reserved;
> > > +  UINT32    Flags;
> >
> > Does this not cause a bisect breakage vs patch 17?
> >
> 
> Yeah, rebase error - this change should update the reference to
> Reserved as well in
> MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c, and patch 17/17
> should only change the value that gets assigned to it.

Ah, good.
With that fixed, for 15 and 17:
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>

/
    Leif


> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102133): https://edk2.groups.io/g/devel/message/102133
Mute This Topic: https://groups.io/mt/97879302/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-