[edk2-devel] [PATCH v2 19/25] MdeModulePkg: Add Additional Profiles to SetMemoryProtectionsLib

Gerd Hoffmann kraxel at redhat.com
Tue Aug 29 10:46:01 UTC 2023


>  ////////////////////////////
>  // PROFILE CONFIGURATIONS //
>  ////////////////////////////
>  
>  DXE_MEMORY_PROTECTION_PROFILES  DxeMemoryProtectionProfiles[DxeMemoryProtectionSettingsMax] = {
> +  {
> +    .Name        = L"Debug",
> +    .Description = L"Development profile ideal for debug scenarios",
> +    .Settings    = DXE_MEMORY_PROTECTION_SETTINGS_DEBUG
> +  },
> +  {
> +    .Name        = L"Release",
> +    .Description = L"Release profile recommended for production scenarios",
> +    .Settings    = DXE_MEMORY_PROTECTION_SETTINGS_PROD_MODE
> +  },
> +  {
> +    .Name        = L"ReleaseNoPageGuards",
> +    .Description = L"Release profile without page guards recommended for performance sensitive production scenarios",
> +    .Settings    = DXE_MEMORY_PROTECTION_SETTINGS_PROD_MODE_NO_PAGE_GUARDS
> +  },
>    {
>      .Name        = L"Pcd",
>      .Description = L"Memory protection settings from PCDs",
>      .Settings    = DXE_MEMORY_PROTECTION_SETTINGS_PCD
>    },
> +  {
> +    .Name        = L"Off",
> +    .Description = L"Disables all memory protection settings",
> +    .Settings    = DXE_MEMORY_PROTECTION_SETTINGS_OFF
> +  }
>  };

> --- a/MdeModulePkg/Include/Library/SetMemoryProtectionsLib.h
> +++ b/MdeModulePkg/Include/Library/SetMemoryProtectionsLib.h
> @@ -17,6 +17,10 @@ typedef struct {
>  } DXE_MEMORY_PROTECTION_PROFILES;
>  
>  typedef enum {
> +  DxeMemoryProtectionSettingsDebug = 0,
> +  DxeMemoryProtectionSettingsRelease,
> +  DxeMemoryProtectionSettingsReleaseNoPageGuards,
> +  DxeMemoryProtectionSettingsOff,
>    DxeMemoryProtectionSettingsPcd,
>    DxeMemoryProtectionSettingsMax
>  } DXE_MEMORY_PROTECTION_PROFILE_INDEX;

Ordering mismatch for "pcd" and "off".

I'd suggest to use C99 initializers, i.e.

	DxeMemoryProtectionProfiles[] = {
		[ DxeMemoryProtectionSettingsDebug ] = {
			.Name = "Debug",

to avoid that.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108088): https://edk2.groups.io/g/devel/message/108088
Mute This Topic: https://groups.io/mt/100830918/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list