* [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
@ 2019-06-28 20:18 Michael D Kinney
2019-06-28 22:13 ` [edk2-devel] " Yao, Jiewen
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Michael D Kinney @ 2019-06-28 20:18 UTC (permalink / raw)
To: devel; +Cc: Jian J Wang, Hao A Wu, Ray Ni, Star Zeng, Jiewen Yao
https://bugzilla.tianocore.org/show_bug.cgi?id=1948
Update the data structure signatures in the PiSmmCore
to be unique. Some of the signatures are the same as those
used by the DxeCore. For example, the memory pool head and
tail structures use the same signature in the PiSmmCore
and DxeCore. This means the use of the wrong FreePool API
will not be noticed at the time FreePool is called and a
failure can occur much later. By making the signatures
unique, misuse of an API is caught at that time the API is
called.
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
index da01a1f07d..0908e7f4e9 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
@@ -2,7 +2,7 @@
The internal header file includes the common header files, defines
internal structure and functions used by SmmCore module.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -140,7 +140,7 @@ typedef struct {
EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
} EFI_SMM_DRIVER_ENTRY;
-#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
+#define EFI_HANDLE_SIGNATURE SIGNATURE_32('s','h','d','l')
///
/// IHANDLE - contains a list of protocol handles
@@ -156,7 +156,7 @@ typedef struct {
#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
-#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
+#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('s','p','t','e')
///
/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
@@ -175,7 +175,7 @@ typedef struct {
LIST_ENTRY Notify;
} PROTOCOL_ENTRY;
-#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
+#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
///
/// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
@@ -195,7 +195,7 @@ typedef struct {
VOID *Interface;
} PROTOCOL_INTERFACE;
-#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
+#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('s','p','t','n')
///
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
@@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap;
//
#define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
-#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
+#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
typedef struct {
UINT32 Signature;
@@ -1254,7 +1254,7 @@ typedef struct {
UINTN Size;
} POOL_HEADER;
-#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
+#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
typedef struct {
UINT32 Signature;
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
@ 2019-06-28 22:13 ` Yao, Jiewen
2019-06-28 23:55 ` Zeng, Star
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Yao, Jiewen @ 2019-06-28 22:13 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Zeng, Star
Good idea to catch the issue earlier.
Reviewed-by: Jiewen.yao@intel.com
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Saturday, June 29, 2019 4:19 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique
> structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore
> to be unique. Some of the signatures are the same as those
> used by the DxeCore. For example, the memory pool head and
> tail structures use the same signature in the PiSmmCore
> and DxeCore. This means the use of the wrong FreePool API
> will not be noticed at the time FreePool is called and a
> failure can occur much later. By making the signatures
> unique, misuse of an API is caught at that time the API is
> called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header files, defines
> internal structure and functions used by SmmCore module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE
> SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles
> @@ -156,7 +156,7 @@ typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE
> SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE
> SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
> @@ -175,7 +175,7 @@ typedef struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
> @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE
> SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE
> SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register notification for a protocol
> @@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap;
> //
> #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
2019-06-28 22:13 ` [edk2-devel] " Yao, Jiewen
@ 2019-06-28 23:55 ` Zeng, Star
2019-07-01 2:50 ` Wang, Jian J
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Zeng, Star @ 2019-06-28 23:55 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Yao, Jiewen, Zeng, Star
Good idea. Reviewed-by: Star Zeng <star.zeng@intel.com>.
Thanks,
Star
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Saturday, June 29, 2019 4:19 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique
> structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore to be unique. Some
> of the signatures are the same as those used by the DxeCore. For example,
> the memory pool head and tail structures use the same signature in the
> PiSmmCore and DxeCore. This means the use of the wrong FreePool API will
> not be noticed at the time FreePool is called and a failure can occur much
> later. By making the signatures unique, misuse of an API is caught at that
> time the API is called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header files, defines
> internal structure and functions used by SmmCore module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All rights
> + reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles @@ -156,7 +156,7 @@
> typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
> @@ -175,7 +175,7 @@ typedef struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
> @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register notification for a protocol
> @@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap; //
> #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
2019-06-28 22:13 ` [edk2-devel] " Yao, Jiewen
2019-06-28 23:55 ` Zeng, Star
@ 2019-07-01 2:50 ` Wang, Jian J
2019-08-01 20:06 ` Michael D Kinney
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Wang, Jian J @ 2019-07-01 2:50 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wu, Hao A, Ni, Ray, Zeng, Star, Yao, Jiewen
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Saturday, June 29, 2019 4:19 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique
> structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore
> to be unique. Some of the signatures are the same as those
> used by the DxeCore. For example, the memory pool head and
> tail structures use the same signature in the PiSmmCore
> and DxeCore. This means the use of the wrong FreePool API
> will not be noticed at the time FreePool is called and a
> failure can occur much later. By making the signatures
> unique, misuse of an API is caught at that time the API is
> called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header files, defines
> internal structure and functions used by SmmCore module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles
> @@ -156,7 +156,7 @@ typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
> @@ -175,7 +175,7 @@ typedef struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
> @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register notification for a protocol
> @@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap;
> //
> #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
` (2 preceding siblings ...)
2019-07-01 2:50 ` Wang, Jian J
@ 2019-08-01 20:06 ` Michael D Kinney
2019-08-02 0:21 ` Dong, Eric
2019-08-02 1:25 ` Ni, Ray
5 siblings, 0 replies; 7+ messages in thread
From: Michael D Kinney @ 2019-08-01 20:06 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Zeng, Star, Yao, Jiewen,
Jin, Eric
Hi Eric and Ray,
Adding Eric Dong to Cc.
Have you had a chance to review this patch
in the SMM/MM area of the MdeModulePkg.
Thanks,
Mike
> -----Original Message-----
> From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf Of Michael D
> Kinney
> Sent: Friday, June 28, 2019 1:19 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng,
> Star <star.zeng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore:
> Use unique structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore
> to be unique. Some of the signatures are the same as
> those used by the DxeCore. For example, the memory pool
> head and tail structures use the same signature in the
> PiSmmCore and DxeCore. This means the use of the wrong
> FreePool API will not be noticed at the time FreePool
> is called and a failure can occur much later. By
> making the signatures unique, misuse of an API is
> caught at that time the API is called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++--
> -----
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header
> files, defines
> internal structure and functions used by SmmCore
> module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All
> rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All
> rights
> + reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE
> SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE
> SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles @@ -
> 156,7 +156,7 @@ typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE
> SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE
> SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1
> entry in the protocol @@ -175,7 +175,7 @@ typedef
> struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE
> SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE
> SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a
> handle is tracked @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE
> SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE
> SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register
> notification for a protocol @@ -1245,7 +1245,7 @@
> extern LIST_ENTRY mSmmMemoryMap; // #define
> MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE
> SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE
> SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE
> SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE
> SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
` (3 preceding siblings ...)
2019-08-01 20:06 ` Michael D Kinney
@ 2019-08-02 0:21 ` Dong, Eric
2019-08-02 1:25 ` Ni, Ray
5 siblings, 0 replies; 7+ messages in thread
From: Dong, Eric @ 2019-08-02 0:21 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wang, Jian J, Wu, Hao A, Ni, Ray, Zeng, Star, Yao, Jiewen
Good catch. Reviewed-by: Eric Dong <eric.dong@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Saturday, June 29, 2019 4:19 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique
> structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore to be unique. Some
> of the signatures are the same as those used by the DxeCore. For example,
> the memory pool head and tail structures use the same signature in the
> PiSmmCore and DxeCore. This means the use of the wrong FreePool API will
> not be noticed at the time FreePool is called and a failure can occur much
> later. By making the signatures unique, misuse of an API is caught at that
> time the API is called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header files, defines
> internal structure and functions used by SmmCore module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All rights
> + reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles @@ -156,7 +156,7 @@
> typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
> @@ -175,7 +175,7 @@ typedef struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
> @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register notification for a protocol
> @@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap; //
> #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
` (4 preceding siblings ...)
2019-08-02 0:21 ` Dong, Eric
@ 2019-08-02 1:25 ` Ni, Ray
5 siblings, 0 replies; 7+ messages in thread
From: Ni, Ray @ 2019-08-02 1:25 UTC (permalink / raw)
To: devel@edk2.groups.io, Kinney, Michael D
Cc: Wang, Jian J, Wu, Hao A, Zeng, Star, Yao, Jiewen
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> D Kinney
> Sent: Saturday, June 29, 2019 4:19 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J <jian.j.wang@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: [edk2-devel] [Patch] MdeModulePkg/PiSmmCore: Use unique
> structure signatures
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=1948
>
> Update the data structure signatures in the PiSmmCore to be unique. Some
> of the signatures are the same as those used by the DxeCore. For example,
> the memory pool head and tail structures use the same signature in the
> PiSmmCore and DxeCore. This means the use of the wrong FreePool API will
> not be noticed at the time FreePool is called and a failure can occur much
> later. By making the signatures unique, misuse of an API is caught at that
> time the API is called.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> index da01a1f07d..0908e7f4e9 100644
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
> @@ -2,7 +2,7 @@
> The internal header file includes the common header files, defines
> internal structure and functions used by SmmCore module.
>
> - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2009 - 2019, Intel Corporation. All rights
> + reserved.<BR>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> **/
> @@ -140,7 +140,7 @@ typedef struct {
> EFI_LOADED_IMAGE_PROTOCOL SmmLoadedImage;
> } EFI_SMM_DRIVER_ENTRY;
>
> -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
> +#define EFI_HANDLE_SIGNATURE SIGNATURE_32('s','h','d','l')
>
> ///
> /// IHANDLE - contains a list of protocol handles @@ -156,7 +156,7 @@
> typedef struct {
>
> #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature ==
> EFI_HANDLE_SIGNATURE)
>
> -#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
> +#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('s','p','t','e')
>
> ///
> /// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
> @@ -175,7 +175,7 @@ typedef struct {
> LIST_ENTRY Notify;
> } PROTOCOL_ENTRY;
>
> -#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
> +#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('s','p','i','f')
>
> ///
> /// PROTOCOL_INTERFACE - each protocol installed on a handle is tracked
> @@ -195,7 +195,7 @@ typedef struct {
> VOID *Interface;
> } PROTOCOL_INTERFACE;
>
> -#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
> +#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('s','p','t','n')
>
> ///
> /// PROTOCOL_NOTIFY - used for each register notification for a protocol
> @@ -1245,7 +1245,7 @@ extern LIST_ENTRY mSmmMemoryMap; //
> #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
>
> -#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
> +#define POOL_HEAD_SIGNATURE SIGNATURE_32('s','p','h','d')
>
> typedef struct {
> UINT32 Signature;
> @@ -1254,7 +1254,7 @@ typedef struct {
> UINTN Size;
> } POOL_HEADER;
>
> -#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
> +#define POOL_TAIL_SIGNATURE SIGNATURE_32('s','p','t','l')
>
> typedef struct {
> UINT32 Signature;
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-08-02 1:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28 20:18 [Patch] MdeModulePkg/PiSmmCore: Use unique structure signatures Michael D Kinney
2019-06-28 22:13 ` [edk2-devel] " Yao, Jiewen
2019-06-28 23:55 ` Zeng, Star
2019-07-01 2:50 ` Wang, Jian J
2019-08-01 20:06 ` Michael D Kinney
2019-08-02 0:21 ` Dong, Eric
2019-08-02 1:25 ` Ni, Ray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox