* [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
@ 2017-01-09 5:00 Michael Kinney
2017-01-09 5:06 ` Zeng, Star
2017-01-09 5:18 ` Gao, Liming
0 siblings, 2 replies; 4+ messages in thread
From: Michael Kinney @ 2017-01-09 5:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Feng Tian, Star Zeng
If a BaseAddress of NULL is passed into DXE Core services
CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
DEBUG() messages are enabled, then a NULL pointer reference
is made. The parameter check for BaseAddress is performed
in the function CoreAllocateSpace() after the DEBUG()
messages. A check is added in the DEBUG() messages to
prevent the NULL pointer reference.
This issue was found with PI SCTs with DEBUG messages
enabled in the DXE Core.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index bd7c6c6..e008ce8 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -3,7 +3,7 @@
The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core.
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1337,7 +1337,11 @@ CoreAllocateMemorySpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD, "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ } else {
+ DEBUG ((DEBUG_GCD, "GCD:AllocateMemorySpace(Base=<NULL>,Length=%016lx)\n", Length));
+ }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdMemoryType = %a\n", mGcdMemoryTypeNames[MIN (GcdMemoryType, EfiGcdMemoryTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
@@ -1761,7 +1765,11 @@ CoreAllocateIoSpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD, "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ } else {
+ DEBUG ((DEBUG_GCD, "GCD:AllocateIoSpace(Base=<NULL>,Length=%016lx)\n", Length));
+ }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdIoType = %a\n", mGcdIoTypeNames[MIN (GcdIoType, EfiGcdIoTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
--
2.6.3.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
2017-01-09 5:00 [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages Michael Kinney
@ 2017-01-09 5:06 ` Zeng, Star
2017-01-09 5:07 ` Tian, Feng
2017-01-09 5:18 ` Gao, Liming
1 sibling, 1 reply; 4+ messages in thread
From: Zeng, Star @ 2017-01-09 5:06 UTC (permalink / raw)
To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Tian, Feng
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Kinney, Michael D
Sent: Monday, January 9, 2017 1:00 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
If a BaseAddress of NULL is passed into DXE Core services
CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
DEBUG() messages are enabled, then a NULL pointer reference is made. The parameter check for BaseAddress is performed in the function CoreAllocateSpace() after the DEBUG() messages. A check is added in the DEBUG() messages to prevent the NULL pointer reference.
This issue was found with PI SCTs with DEBUG messages enabled in the DXE Core.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index bd7c6c6..e008ce8 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -3,7 +3,7 @@
The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core.
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1337,7 +1337,11 @@ CoreAllocateMemorySpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length)); } else {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateMemorySpace(Base=<NULL>,Length=%016lx)\n", Length)); }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdMemoryType = %a\n", mGcdMemoryTypeNames[MIN (GcdMemoryType, EfiGcdMemoryTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
@@ -1761,7 +1765,11 @@ CoreAllocateIoSpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length)); } else {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateIoSpace(Base=<NULL>,Length=%016lx)\n", Length)); }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdIoType = %a\n", mGcdIoTypeNames[MIN (GcdIoType, EfiGcdIoTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
--
2.6.3.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
2017-01-09 5:06 ` Zeng, Star
@ 2017-01-09 5:07 ` Tian, Feng
0 siblings, 0 replies; 4+ messages in thread
From: Tian, Feng @ 2017-01-09 5:07 UTC (permalink / raw)
To: Zeng, Star, Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Tian, Feng
Reviewed-by: Feng Tian <feng.tian@Intel.com>
Thanks
Feng
-----Original Message-----
From: Zeng, Star
Sent: Monday, January 9, 2017 1:06 PM
To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>
Subject: RE: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Kinney, Michael D
Sent: Monday, January 9, 2017 1:00 PM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
If a BaseAddress of NULL is passed into DXE Core services
CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
DEBUG() messages are enabled, then a NULL pointer reference is made. The parameter check for BaseAddress is performed in the function CoreAllocateSpace() after the DEBUG() messages. A check is added in the DEBUG() messages to prevent the NULL pointer reference.
This issue was found with PI SCTs with DEBUG messages enabled in the DXE Core.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index bd7c6c6..e008ce8 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -3,7 +3,7 @@
The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core.
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1337,7 +1337,11 @@ CoreAllocateMemorySpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length)); } else {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateMemorySpace(Base=<NULL>,Length=%016lx)\n", Length)); }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdMemoryType = %a\n", mGcdMemoryTypeNames[MIN (GcdMemoryType, EfiGcdMemoryTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
@@ -1761,7 +1765,11 @@ CoreAllocateIoSpace (
IN EFI_HANDLE DeviceHandle OPTIONAL
)
{
- DEBUG ((DEBUG_GCD, "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length));
+ if (BaseAddress != NULL) {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress, Length)); } else {
+ DEBUG ((DEBUG_GCD,
+ "GCD:AllocateIoSpace(Base=<NULL>,Length=%016lx)\n", Length)); }
DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n", mGcdAllocationTypeNames[MIN (GcdAllocateType, EfiGcdMaxAllocateType)]));
DEBUG ((DEBUG_GCD, " GcdIoType = %a\n", mGcdIoTypeNames[MIN (GcdIoType, EfiGcdIoTypeMaximum)]));
DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1, Alignment)));
--
2.6.3.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
2017-01-09 5:00 [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages Michael Kinney
2017-01-09 5:06 ` Zeng, Star
@ 2017-01-09 5:18 ` Gao, Liming
1 sibling, 0 replies; 4+ messages in thread
From: Gao, Liming @ 2017-01-09 5:18 UTC (permalink / raw)
To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Tian, Feng, Zeng, Star
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Michael Kinney
>Sent: Monday, January 09, 2017 1:00 PM
>To: edk2-devel@lists.01.org
>Cc: Tian, Feng <feng.tian@intel.com>; Zeng, Star <star.zeng@intel.com>
>Subject: [edk2] [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD
>DEBUG() messages
>
>If a BaseAddress of NULL is passed into DXE Core services
>CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
>DEBUG() messages are enabled, then a NULL pointer reference
>is made. The parameter check for BaseAddress is performed
>in the function CoreAllocateSpace() after the DEBUG()
>messages. A check is added in the DEBUG() messages to
>prevent the NULL pointer reference.
>
>This issue was found with PI SCTs with DEBUG messages
>enabled in the DXE Core.
>
>Cc: Feng Tian <feng.tian@intel.com>
>Cc: Star Zeng <star.zeng@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
>---
> MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
>diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
>b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
>index bd7c6c6..e008ce8 100644
>--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
>+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
>@@ -3,7 +3,7 @@
> The GCD services are used to manage the memory and I/O regions that
> are accessible to the CPU that is executing the DXE core.
>
>-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
>+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD
>License
> which accompanies this distribution. The full text of the license may be found
>at
>@@ -1337,7 +1337,11 @@ CoreAllocateMemorySpace (
> IN EFI_HANDLE DeviceHandle OPTIONAL
> )
> {
>- DEBUG ((DEBUG_GCD,
>"GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress,
>Length));
>+ if (BaseAddress != NULL) {
>+ DEBUG ((DEBUG_GCD,
>"GCD:AllocateMemorySpace(Base=%016lx,Length=%016lx)\n", *BaseAddress,
>Length));
>+ } else {
>+ DEBUG ((DEBUG_GCD,
>"GCD:AllocateMemorySpace(Base=<NULL>,Length=%016lx)\n", Length));
>+ }
> DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n",
>mGcdAllocationTypeNames[MIN (GcdAllocateType,
>EfiGcdMaxAllocateType)]));
> DEBUG ((DEBUG_GCD, " GcdMemoryType = %a\n",
>mGcdMemoryTypeNames[MIN (GcdMemoryType,
>EfiGcdMemoryTypeMaximum)]));
> DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1,
>Alignment)));
>@@ -1761,7 +1765,11 @@ CoreAllocateIoSpace (
> IN EFI_HANDLE DeviceHandle OPTIONAL
> )
> {
>- DEBUG ((DEBUG_GCD,
>"GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress,
>Length));
>+ if (BaseAddress != NULL) {
>+ DEBUG ((DEBUG_GCD,
>"GCD:AllocateIoSpace(Base=%016lx,Length=%016lx)\n", *BaseAddress,
>Length));
>+ } else {
>+ DEBUG ((DEBUG_GCD,
>"GCD:AllocateIoSpace(Base=<NULL>,Length=%016lx)\n", Length));
>+ }
> DEBUG ((DEBUG_GCD, " GcdAllocateType = %a\n",
>mGcdAllocationTypeNames[MIN (GcdAllocateType,
>EfiGcdMaxAllocateType)]));
> DEBUG ((DEBUG_GCD, " GcdIoType = %a\n", mGcdIoTypeNames[MIN
>(GcdIoType, EfiGcdIoTypeMaximum)]));
> DEBUG ((DEBUG_GCD, " Alignment = %016lx\n", LShiftU64 (1,
>Alignment)));
>--
>2.6.3.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-09 5:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09 5:00 [Patch] MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages Michael Kinney
2017-01-09 5:06 ` Zeng, Star
2017-01-09 5:07 ` Tian, Feng
2017-01-09 5:18 ` Gao, Liming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox