* [PATCH V4 00/27] Disabling safe string constraint assertions
@ 2020-05-11 15:40 Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
` (27 more replies)
0 siblings, 28 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
Cc: Andrew Fish, Mike Kinney, Marvin Häuser, Liming Gao,
Zhichao Gao, Laszlo Ersek
Cc: Andrew Fish <afish@apple.com>
Cc: Mike Kinney <michael.d.kinney@intel.com>
Cc: Marvin Häuser <mhaeuser@outlook.de>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
CC: Laszlo Ersek <lersek@redhat.com>
This changesest hopefully finally resolves the longstanding
https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Requesting to merge into edk2-stable202005.
Vitaly Cheptsov (27):
MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib
UnitTestFrameworkPkg: Add support for DebugCommonLib
MdePkg: Add support for DebugCommonLib
MdeModulePkg: Add support for DebugCommonLib
ArmPkg: Add support for DebugCommonLib
ArmPlatformPkg: Add support for DebugCommonLib
ArmVirtPkg: Add support for DebugCommonLib
CryptoPkg: Add support for DebugCommonLib
DynamicTablesPkg: Add support for DebugCommonLib
EmbeddedPkg: Add support for DebugCommonLib
EmulatorPkg: Add support for DebugCommonLib
FatPkg: Add support for DebugCommonLib
FmpDevicePkg: Add support for DebugCommonLib
IntelFsp2Pkg: Add support for DebugCommonLib
IntelFsp2WrapperPkg: Add support for DebugCommonLib
OvmfPkg: Add support for DebugCommonLib
NetworkPkg: Add support for DebugCommonLib
ShellPkg: Add support for DebugCommonLib
SecurityPkg: Add support for DebugCommonLib
PcAtChipsetPkg: Add support for DebugCommonLib
SignedCapsulePkg: Add support for DebugCommonLib
SourceLevelDebugPkg: Add support for DebugCommonLib
StandaloneMmPkg: Add support for DebugCommonLib
UefiCpuPkg: Add support for DebugCommonLib
UefiPayloadPkg: Add support for DebugCommonLib
MdePkg: Introduce assertion on constraint debug mask bit
MdePkg: Use assertion on constraint violation bit in SafeString
ArmPkg/ArmPkg.dsc | 1 +
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc | 1 +
ArmPkg/Library/SemiHostingDebugLib/DebugLib.c | 84 ----------
ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf | 3 +-
ArmPlatformPkg/ArmPlatformPkg.dsc | 1 +
ArmVirtPkg/ArmVirt.dsc.inc | 1 +
CryptoPkg/CryptoPkg.dsc | 2 +
DynamicTablesPkg/DynamicTablesPkg.dsc | 1 +
EmbeddedPkg/EmbeddedPkg.dsc | 1 +
EmulatorPkg/EmulatorPkg.dsc | 1 +
FatPkg/FatPkg.dsc | 1 +
FmpDevicePkg/FmpDevicePkg.dsc | 1 +
IntelFsp2Pkg/IntelFsp2Pkg.dsc | 1 +
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf | 1 +
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c | 97 -----------
IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 +
MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c | 100 ------------
MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf | 1 +
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c | 98 -----------
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf | 1 +
MdeModulePkg/MdeModulePkg.dsc | 1 +
MdePkg/Include/Library/BaseLib.h | 120 +++++++-------
MdePkg/Include/Library/DebugCommonLib.h | 172 ++++++++++++++++++++
MdePkg/Include/Library/DebugLib.h | 155 +++---------------
MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf | 39 +++++
MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni | 16 ++
MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 133 +++++++++++++++
MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf | 10 ++
MdePkg/Library/BaseDebugLibNull/DebugLib.c | 98 -----------
MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf | 1 +
MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c | 98 -----------
MdePkg/Library/BaseLib/BaseLib.inf | 1 +
MdePkg/Library/BaseLib/SafeString.c | 2 +-
MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c | 98 -----------
MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf | 1 +
MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 98 -----------
MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf | 1 +
MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c | 99 -----------
MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf | 1 +
MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 98 -----------
MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf | 1 +
MdePkg/MdePkg.dec | 6 +-
MdePkg/MdePkg.dsc | 1 +
MdePkg/MdePkg.uni | 3 +-
NetworkPkg/NetworkPkg.dsc | 1 +
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 98 -----------
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 1 +
OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
OvmfPkg/OvmfPkgX64.dsc | 1 +
OvmfPkg/OvmfXen.dsc | 1 +
PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 +
SecurityPkg/SecurityPkg.dsc | 1 +
ShellPkg/ShellPkg.dsc | 1 +
SignedCapsulePkg/SignedCapsulePkg.dsc | 1 +
SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 +
StandaloneMmPkg/StandaloneMmPkg.dsc | 1 +
UefiCpuPkg/UefiCpuPkg.dsc | 1 +
UefiPayloadPkg/UefiPayloadPkgIa32.dsc | 1 +
UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc | 1 +
UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c | 94 -----------
UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf | 1 +
UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 1 +
UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 1 +
64 files changed, 501 insertions(+), 1360 deletions(-)
create mode 100644 MdePkg/Include/Library/DebugCommonLib.h
create mode 100644 MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
create mode 100644 MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
create mode 100644 MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
--
2.24.2 (Apple Git-127)
^ permalink raw reply [flat|nested] 48+ messages in thread
* [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
@ 2020-05-11 15:40 ` Vitaly Cheptsov
2020-05-11 20:37 ` [edk2-devel] " Laszlo Ersek
2020-05-11 20:42 ` Laszlo Ersek
2020-05-11 15:40 ` [PATCH V4 02/27] UnitTestFrameworkPkg: Add support for DebugCommonLib Vitaly Cheptsov
` (26 subsequent siblings)
27 siblings, 2 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
This library allows to make a common part of all DebugLib instances
and avoid the need to update every DebugLib on extending a new debug
mask PCD bit.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdePkg/Include/Library/DebugCommonLib.h | 154 ++++++++++++++++++++
MdePkg/Include/Library/DebugLib.h | 137 +----------------
MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf | 39 +++++
MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni | 16 ++
MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 113 ++++++++++++++
MdePkg/MdePkg.dec | 3 +
MdePkg/MdePkg.dsc | 1 +
MdePkg/MdePkg.uni | 3 +-
8 files changed, 329 insertions(+), 137 deletions(-)
diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
new file mode 100644
index 0000000000..31249f91fa
--- /dev/null
+++ b/MdePkg/Include/Library/DebugCommonLib.h
@@ -0,0 +1,154 @@
+/** @file
+ Provides services to access common debugging features.
+
+ The debug common library interface provides common code for all debug libraries.
+
+ Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __DEBUG_COMMON_LIB_H__
+#define __DEBUG_COMMON_LIB_H__
+
+//
+// Declare bits for PcdDebugPropertyMask
+//
+#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
+#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
+#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
+#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
+#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
+#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
+
+//
+// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
+//
+#define DEBUG_INIT 0x00000001 // Initialization
+#define DEBUG_WARN 0x00000002 // Warnings
+#define DEBUG_LOAD 0x00000004 // Load events
+#define DEBUG_FS 0x00000008 // EFI File system
+#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
+#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
+#define DEBUG_INFO 0x00000040 // Informational debug messages
+#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
+#define DEBUG_VARIABLE 0x00000100 // Variable
+#define DEBUG_BM 0x00000400 // Boot Manager
+#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
+#define DEBUG_NET 0x00004000 // Network Io Driver
+#define DEBUG_UNDI 0x00010000 // UNDI Driver
+#define DEBUG_LOADFILE 0x00020000 // LoadFile
+#define DEBUG_EVENT 0x00080000 // Event messages
+#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
+#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
+#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
+ // significantly impact boot performance
+#define DEBUG_ERROR 0x80000000 // Error
+
+//
+// Aliases of debug message mask bits
+//
+#define EFI_D_INIT DEBUG_INIT
+#define EFI_D_WARN DEBUG_WARN
+#define EFI_D_LOAD DEBUG_LOAD
+#define EFI_D_FS DEBUG_FS
+#define EFI_D_POOL DEBUG_POOL
+#define EFI_D_PAGE DEBUG_PAGE
+#define EFI_D_INFO DEBUG_INFO
+#define EFI_D_DISPATCH DEBUG_DISPATCH
+#define EFI_D_VARIABLE DEBUG_VARIABLE
+#define EFI_D_BM DEBUG_BM
+#define EFI_D_BLKIO DEBUG_BLKIO
+#define EFI_D_NET DEBUG_NET
+#define EFI_D_UNDI DEBUG_UNDI
+#define EFI_D_LOADFILE DEBUG_LOADFILE
+#define EFI_D_EVENT DEBUG_EVENT
+#define EFI_D_VERBOSE DEBUG_VERBOSE
+#define EFI_D_ERROR DEBUG_ERROR
+
+/**
+ Returns TRUE if ASSERT() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugAssertEnabled (
+ VOID
+ );
+
+
+/**
+ Returns TRUE if DEBUG() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintEnabled (
+ VOID
+ );
+
+
+/**
+ Returns TRUE if DEBUG_CODE() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugCodeEnabled (
+ VOID
+ );
+
+
+/**
+ Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugClearMemoryEnabled (
+ VOID
+ );
+
+
+/**
+ Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+ This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+ @retval TRUE Current ErrorLevel is supported.
+ @retval FALSE Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+ IN CONST UINTN ErrorLevel
+ );
+
+
+#endif
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index baab34bf05..a38e0e2904 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -16,60 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __DEBUG_LIB_H__
#define __DEBUG_LIB_H__
-//
-// Declare bits for PcdDebugPropertyMask
-//
-#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
-#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
-#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
-#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
-#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
-#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
-
-//
-// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
-//
-#define DEBUG_INIT 0x00000001 // Initialization
-#define DEBUG_WARN 0x00000002 // Warnings
-#define DEBUG_LOAD 0x00000004 // Load events
-#define DEBUG_FS 0x00000008 // EFI File system
-#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
-#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
-#define DEBUG_INFO 0x00000040 // Informational debug messages
-#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
-#define DEBUG_VARIABLE 0x00000100 // Variable
-#define DEBUG_BM 0x00000400 // Boot Manager
-#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
-#define DEBUG_NET 0x00004000 // Network Io Driver
-#define DEBUG_UNDI 0x00010000 // UNDI Driver
-#define DEBUG_LOADFILE 0x00020000 // LoadFile
-#define DEBUG_EVENT 0x00080000 // Event messages
-#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
-#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
-#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
- // significantly impact boot performance
-#define DEBUG_ERROR 0x80000000 // Error
-
-//
-// Aliases of debug message mask bits
-//
-#define EFI_D_INIT DEBUG_INIT
-#define EFI_D_WARN DEBUG_WARN
-#define EFI_D_LOAD DEBUG_LOAD
-#define EFI_D_FS DEBUG_FS
-#define EFI_D_POOL DEBUG_POOL
-#define EFI_D_PAGE DEBUG_PAGE
-#define EFI_D_INFO DEBUG_INFO
-#define EFI_D_DISPATCH DEBUG_DISPATCH
-#define EFI_D_VARIABLE DEBUG_VARIABLE
-#define EFI_D_BM DEBUG_BM
-#define EFI_D_BLKIO DEBUG_BLKIO
-#define EFI_D_NET DEBUG_NET
-#define EFI_D_UNDI DEBUG_UNDI
-#define EFI_D_LOADFILE DEBUG_LOADFILE
-#define EFI_D_EVENT DEBUG_EVENT
-#define EFI_D_VERBOSE DEBUG_VERBOSE
-#define EFI_D_ERROR DEBUG_ERROR
+#include <Library/DebugCommonLib.h>
/**
Prints a debug message to the debug output device if the specified error level is enabled.
@@ -198,88 +145,6 @@ DebugClearMemory (
);
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- );
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- );
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- );
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- );
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- );
-
/**
Internal worker macro that calls DebugAssert().
diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
new file mode 100644
index 0000000000..c1f4b0d5a8
--- /dev/null
+++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
@@ -0,0 +1,39 @@
+## @file
+# Instance of Debug Common Library interface.
+# It uses PcdLib to provide a common set of Debug Library interface.
+#
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BaseDebugCommonLib
+ MODULE_UNI_FILE = BaseDebugCommonLib.uni
+ FILE_GUID = 7CD790D2-E13F-4446-AF4F-813F0B9DEFF8
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = DebugCommonLib
+
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ DebugCommonLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ PcdLib
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
+ gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
+
diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
new file mode 100644
index 0000000000..a5ad34298b
--- /dev/null
+++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
@@ -0,0 +1,16 @@
+// /** @file
+// Instance of Debug Common Library interface.
+//
+// It uses PcdLib to provide a common set of Debug Library interface.
+//
+// Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Common Library interface"
+
+#string STR_MODULE_DESCRIPTION #language en-US "It uses PcdLib to provide a common set of Debug Library interface."
+
diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
new file mode 100644
index 0000000000..2291fb5382
--- /dev/null
+++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
@@ -0,0 +1,113 @@
+/** @file
+ Instance of Debug Common Library interface.
+ It uses PcdLib to provide a common set of Debug Library interface.
+
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/DebugCommonLib.h>
+#include <Library/PcdLib.h>
+
+
+/**
+ Returns TRUE if ASSERT() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugAssertEnabled (
+ VOID
+ )
+{
+ return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
+}
+
+
+/**
+ Returns TRUE if DEBUG() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintEnabled (
+ VOID
+ )
+{
+ return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
+}
+
+
+/**
+ Returns TRUE if DEBUG_CODE() macros are enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugCodeEnabled (
+ VOID
+ )
+{
+ return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
+}
+
+
+/**
+ Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugClearMemoryEnabled (
+ VOID
+ )
+{
+ return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+}
+
+
+/**
+ Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+ This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
+
+ @retval TRUE Current ErrorLevel is supported.
+ @retval FALSE Current ErrorLevel is not supported.
+
+**/
+BOOLEAN
+EFIAPI
+DebugPrintLevelEnabled (
+ IN CONST UINTN ErrorLevel
+ )
+{
+ return (BOOLEAN) ((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
+}
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 0b9c4bc40a..a121b9ecab 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -229,6 +229,9 @@ [LibraryClasses]
# library class maps directly on top of the Timer class.
S3StallLib|Include/Library/S3StallLib.h
+ ## @libraryclass Provides services to access common debugging features.
+ DebugCommonLib|Include/Library/DebugCommonLib.h
+
## @libraryclass Defines library APIs used by modules to get/set print error level.
DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 6cd38e7ec3..1072322450 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -36,6 +36,7 @@ [Components]
MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+ MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
index 5c1fa24065..5addb0eaba 100644
--- a/MdePkg/MdePkg.uni
+++ b/MdePkg/MdePkg.uni
@@ -189,7 +189,8 @@
"BIT2 - Enable Debug Code.<BR>\n"
"BIT3 - Enable Clear Memory.<BR>\n"
"BIT4 - Enable BreakPoint as ASSERT.<BR>\n"
- "BIT5 - Enable DeadLoop as ASSERT.<BR>"
+ "BIT5 - Enable DeadLoop as ASSERT.<BR>\n"
+ "BIT6 - Treat constrait violations as ASSERT.<BR>"
#string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero."
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 02/27] UnitTestFrameworkPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
@ 2020-05-11 15:40 ` Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 03/27] MdePkg: " Vitaly Cheptsov
` (25 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c | 94 --------------------
UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf | 1 +
UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 1 +
UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc | 1 +
4 files changed, 3 insertions(+), 94 deletions(-)
diff --git a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
index 0daea00728..e490a53474 100644
--- a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
+++ b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
@@ -183,97 +183,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf
index 5babbca3b0..3e4f7d1b14 100644
--- a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf
+++ b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf
@@ -28,6 +28,7 @@ [LibraryClasses]
PcdLib
PrintLib
BaseLib
+ DebugCommonLib
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
index e954968efc..194e6ce108 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
@@ -12,6 +12,7 @@ [LibraryClasses.common.HOST_APPLICATION]
CmockaLib|UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf
UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.inf
DebugLib|UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.inf
[BuildOptions]
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
index c29b056fca..d1cb92aa0f 100644
--- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
+++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
@@ -17,6 +17,7 @@ [LibraryClasses]
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 03/27] MdePkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 02/27] UnitTestFrameworkPkg: Add support for DebugCommonLib Vitaly Cheptsov
@ 2020-05-11 15:40 ` Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 04/27] MdeModulePkg: " Vitaly Cheptsov
` (24 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf | 10 ++
MdePkg/Library/BaseDebugLibNull/DebugLib.c | 98 -------------------
MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf | 1 +
MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c | 98 -------------------
MdePkg/Library/BaseLib/BaseLib.inf | 1 +
MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c | 98 -------------------
MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf | 1 +
MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 98 -------------------
MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf | 1 +
MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c | 99 --------------------
MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf | 1 +
MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 98 -------------------
MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf | 1 +
13 files changed, 16 insertions(+), 589 deletions(-)
diff --git a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
index 81a63a5074..78a63de6cc 100644
--- a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+++ b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
@@ -29,3 +29,13 @@ [Sources]
[Packages]
MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugCommonLib
+ PcdLib
+
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
+ gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
+
diff --git a/MdePkg/Library/BaseDebugLibNull/DebugLib.c b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
index 20c175ec6d..843be399aa 100644
--- a/MdePkg/Library/BaseDebugLibNull/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
@@ -146,101 +146,3 @@ DebugClearMemory (
return Buffer;
}
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return FALSE;
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return FALSE;
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return FALSE;
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return FALSE;
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return FALSE;
-}
-
diff --git a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
index 7504faee67..9230caf757 100644
--- a/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+++ b/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
@@ -35,6 +35,7 @@ [LibraryClasses]
PcdLib
PrintLib
BaseLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Pcd]
diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
index aeeab85737..be801b536c 100644
--- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
@@ -274,101 +274,3 @@ DebugClearMemory (
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
-
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf
index a57ae2da31..d2cb2340df 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -403,6 +403,7 @@ [Packages]
[LibraryClasses]
PcdLib
DebugLib
+ DebugCommonLib
BaseMemoryLib
[Pcd]
diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
index cc79843b1c..b792c4abf6 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
@@ -335,101 +335,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
index 31d169ad7c..dc994f0516 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
@@ -36,6 +36,7 @@ [Packages]
[LibraryClasses]
BaseLib
BaseMemoryLib
+ DebugCommonLib
DebugPrintErrorLevelLib
PcdLib
PrintLib
diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index 8ea38ea7cc..268ca5bfef 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -274,101 +274,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
index 53bbc8ce3f..ac692e6d21 100644
--- a/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+++ b/MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
@@ -44,6 +44,7 @@ [LibraryClasses]
BaseLib
PcdLib
PrintLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Pcd]
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
index cd7e2abbd3..e3add1ec22 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
@@ -328,102 +328,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
-
diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
index e12a1025c6..5e96462a27 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProtocol.inf
@@ -44,6 +44,7 @@ [LibraryClasses]
BaseLib
PcdLib
PrintLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Protocols]
diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
index fcfdafede0..129c85587a 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
@@ -275,101 +275,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
index 5ecb971a0a..3afd50d709 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+++ b/MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
@@ -42,6 +42,7 @@ [LibraryClasses]
BaseLib
PcdLib
PrintLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Pcd]
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 04/27] MdeModulePkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (2 preceding siblings ...)
2020-05-11 15:40 ` [PATCH V4 03/27] MdePkg: " Vitaly Cheptsov
@ 2020-05-11 15:40 ` Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 05/27] ArmPkg: " Vitaly Cheptsov
` (23 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c | 100 --------------------
MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf | 1 +
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c | 98 -------------------
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf | 1 +
MdeModulePkg/MdeModulePkg.dsc | 1 +
5 files changed, 3 insertions(+), 198 deletions(-)
diff --git a/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
index 05a7dab99c..66748ee836 100644
--- a/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
+++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
@@ -352,103 +352,3 @@ DebugClearMemory (
return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise, FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
-
diff --git a/MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf b/MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf
index 4df479d742..0412af7b1b 100644
--- a/MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf
+++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf
@@ -41,6 +41,7 @@ [Packages]
[LibraryClasses]
PcdLib
BaseMemoryLib
+ DebugCommonLib
DebugPrintErrorLevelLib
PeiServicesLib
PeiServicesTablePointerLib
diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index fb47401466..ec90cb6e37 100644
--- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -501,101 +501,3 @@ DebugClearMemory (
return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
index b52fc5686a..53027e8cf1 100644
--- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
@@ -37,6 +37,7 @@ [LibraryClasses]
ReportStatusCodeLib
BaseMemoryLib
BaseLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Pcd]
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 25aea3e2a4..72b6fa755b 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -74,6 +74,7 @@ [LibraryClasses]
# Misc
#
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 05/27] ArmPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (3 preceding siblings ...)
2020-05-11 15:40 ` [PATCH V4 04/27] MdeModulePkg: " Vitaly Cheptsov
@ 2020-05-11 15:40 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 06/27] ArmPlatformPkg: " Vitaly Cheptsov
` (22 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:40 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
ArmPkg/ArmPkg.dsc | 1 +
ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc | 1 +
ArmPkg/Library/SemiHostingDebugLib/DebugLib.c | 84 --------------------
ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf | 3 +-
4 files changed, 4 insertions(+), 85 deletions(-)
diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc
index 549a2d29ab..fe9691205e 100644
--- a/ArmPkg/ArmPkg.dsc
+++ b/ArmPkg/ArmPkg.dsc
@@ -35,6 +35,7 @@ [LibraryClasses.common]
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
diff --git a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
index 2818ce65db..51d7776eb3 100644
--- a/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
+++ b/ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
@@ -30,6 +30,7 @@ [LibraryClasses]
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
diff --git a/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c b/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
index ae762d8bea..58822db098 100644
--- a/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
+++ b/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
@@ -250,87 +250,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
-
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CODE()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
diff --git a/ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf b/ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf
index 71bf20b1ca..ef1f97672a 100644
--- a/ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf
+++ b/ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.inf
@@ -33,7 +33,8 @@ [LibraryClasses]
PcdLib
PrintLib
SemihostLib
- DebugLib
+ DebugCommonLib
+ DebugPrintErrorLevelLib
[Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 06/27] ArmPlatformPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (4 preceding siblings ...)
2020-05-11 15:40 ` [PATCH V4 05/27] ArmPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 07/27] ArmVirtPkg: " Vitaly Cheptsov
` (21 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
ArmPlatformPkg/ArmPlatformPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc
index 5381c95af2..2a3432d91e 100644
--- a/ArmPlatformPkg/ArmPlatformPkg.dsc
+++ b/ArmPlatformPkg/ArmPlatformPkg.dsc
@@ -45,6 +45,7 @@ [LibraryClasses.common]
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 07/27] ArmVirtPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (5 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 06/27] ArmPlatformPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 20:42 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 08/27] CryptoPkg: " Vitaly Cheptsov
` (20 subsequent siblings)
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
ArmVirtPkg/ArmVirt.dsc.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index cf44fc7389..4f3092a201 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -39,6 +39,7 @@ [LibraryClasses.common]
!else
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
!endif
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 08/27] CryptoPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (6 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 07/27] ArmVirtPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 09/27] DynamicTablesPkg: " Vitaly Cheptsov
` (19 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
CryptoPkg/CryptoPkg.dsc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index f79ff331cf..72c8429c0a 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -55,6 +55,7 @@ [LibraryClasses]
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
BaseCryptLib|CryptoPkg/Library/BaseCryptLibNull/BaseCryptLibNull.inf
@@ -88,6 +89,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER]
[LibraryClasses]
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 09/27] DynamicTablesPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (7 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 08/27] CryptoPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 10/27] EmbeddedPkg: " Vitaly Cheptsov
` (18 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
DynamicTablesPkg/DynamicTablesPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc
index 02f04447ff..239f671952 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -24,6 +24,7 @@ [LibraryClasses]
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 10/27] EmbeddedPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (8 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 09/27] DynamicTablesPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 11/27] EmulatorPkg: " Vitaly Cheptsov
` (17 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
EmbeddedPkg/EmbeddedPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index e88d76ab2f..28822c66f4 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -43,6 +43,7 @@ [SkuIds]
[LibraryClasses.common]
# DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
AndroidBootImgLib|EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 11/27] EmulatorPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (9 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 10/27] EmbeddedPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 12/27] FatPkg: " Vitaly Cheptsov
` (16 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
EmulatorPkg/EmulatorPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 1fc924ae5a..3d2bfaad96 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -98,6 +98,7 @@ [LibraryClasses]
#
# Misc
#
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 12/27] FatPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (10 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 11/27] EmulatorPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 13/27] FmpDevicePkg: " Vitaly Cheptsov
` (15 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
FatPkg/FatPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index d86256068b..f811964085 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -44,6 +44,7 @@ [LibraryClasses]
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 13/27] FmpDevicePkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (11 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 12/27] FatPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 14/27] IntelFsp2Pkg: " Vitaly Cheptsov
` (14 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
FmpDevicePkg/FmpDevicePkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
index b8fb9d7c19..25ce1bd783 100644
--- a/FmpDevicePkg/FmpDevicePkg.dsc
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -47,6 +47,7 @@ [LibraryClasses]
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
!ifdef CONTINUOUS_INTEGRATION
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 14/27] IntelFsp2Pkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (12 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 13/27] FmpDevicePkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-12 0:49 ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 15/27] IntelFsp2WrapperPkg: " Vitaly Cheptsov
` (13 subsequent siblings)
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
IntelFsp2Pkg/IntelFsp2Pkg.dsc | 1 +
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf | 1 +
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c | 97 --------------------
3 files changed, 2 insertions(+), 97 deletions(-)
diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
index 02fe9cb188..3b2d2a5b8a 100644
--- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
+++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
@@ -21,6 +21,7 @@ [LibraryClasses]
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
index 14b1899e6c..c708386677 100644
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
+++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
@@ -35,6 +35,7 @@ [LibraryClasses]
PcdLib
PrintLib
BaseLib
+ DebugCommonLib
DebugDeviceLib
DebugPrintErrorLevelLib
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
index b34905365d..f2e1de8822 100644
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
+++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
@@ -316,100 +316,3 @@ DebugClearMemory (
{
return Buffer;
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 15/27] IntelFsp2WrapperPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (13 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 14/27] IntelFsp2Pkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-12 0:47 ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 16/27] OvmfPkg: " Vitaly Cheptsov
` (12 subsequent siblings)
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
index cb4f69285d..b84de7cf70 100644
--- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
+++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
@@ -22,6 +22,7 @@ [LibraryClasses]
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 16/27] OvmfPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (14 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 15/27] IntelFsp2WrapperPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 20:49 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 17/27] NetworkPkg: " Vitaly Cheptsov
` (11 subsequent siblings)
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 98 --------------------
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 1 +
OvmfPkg/OvmfPkgIa32.dsc | 1 +
OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
OvmfPkg/OvmfPkgX64.dsc | 1 +
OvmfPkg/OvmfXen.dsc | 1 +
6 files changed, 5 insertions(+), 98 deletions(-)
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
index dffb20822d..a4e0861d00 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
@@ -261,101 +261,3 @@ DebugClearMemory (
//
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
}
-
-
-/**
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CODE() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
- Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
-
-/**
- Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
-
- @retval TRUE Current ErrorLevel is supported.
- @retval FALSE Current ErrorLevel is not supported.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
- )
-{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
-}
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
index 8f721d249d..4078f0e361 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
@@ -39,6 +39,7 @@ [LibraryClasses]
PcdLib
PrintLib
BaseLib
+ DebugCommonLib
DebugPrintErrorLevelLib
[Pcd]
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 7c8b51f43b..c8adf75730 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -180,6 +180,7 @@ [LibraryClasses]
!endif
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a0596c4416..4df757ae68 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -184,6 +184,7 @@ [LibraryClasses]
!endif
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 2e764b6b72..f0f6226f67 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -184,6 +184,7 @@ [LibraryClasses]
!endif
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 8b3615e0b0..257e2c1740 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -171,6 +171,7 @@ [LibraryClasses]
!endif
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 17/27] NetworkPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (15 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 16/27] OvmfPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 18/27] ShellPkg: " Vitaly Cheptsov
` (10 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
NetworkPkg/NetworkPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 503d828f91..6018bc7e00 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -50,6 +50,7 @@ [LibraryClasses]
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
!endif
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 18/27] ShellPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (16 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 17/27] NetworkPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 19/27] SecurityPkg: " Vitaly Cheptsov
` (9 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
ShellPkg/ShellPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc
index b7ee856b3a..27b148e6b2 100644
--- a/ShellPkg/ShellPkg.dsc
+++ b/ShellPkg/ShellPkg.dsc
@@ -29,6 +29,7 @@ [LibraryClasses.common]
!else
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
!endif
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 19/27] SecurityPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (17 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 18/27] ShellPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 20/27] PcAtChipsetPkg: " Vitaly Cheptsov
` (8 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
SecurityPkg/SecurityPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 53fce05353..aa9814474c 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -19,6 +19,7 @@ [Defines]
[LibraryClasses]
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 20/27] PcAtChipsetPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (18 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 19/27] SecurityPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 21/27] SignedCapsulePkg: " Vitaly Cheptsov
` (7 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index 01a3ee716a..89d66744eb 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -21,6 +21,7 @@ [LibraryClasses]
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 21/27] SignedCapsulePkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (19 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 20/27] PcAtChipsetPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 22/27] SourceLevelDebugPkg: " Vitaly Cheptsov
` (6 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
SignedCapsulePkg/SignedCapsulePkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/SignedCapsulePkg/SignedCapsulePkg.dsc b/SignedCapsulePkg/SignedCapsulePkg.dsc
index c5080ec1dd..c3bedb1462 100644
--- a/SignedCapsulePkg/SignedCapsulePkg.dsc
+++ b/SignedCapsulePkg/SignedCapsulePkg.dsc
@@ -71,6 +71,7 @@ [LibraryClasses]
# Misc
#
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 22/27] SourceLevelDebugPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (20 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 21/27] SignedCapsulePkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 23/27] StandaloneMmPkg: " Vitaly Cheptsov
` (5 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
index a1a1b81d03..f7468885c1 100644
--- a/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
+++ b/SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
@@ -24,6 +24,7 @@ [Defines]
[LibraryClasses.common]
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 23/27] StandaloneMmPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (21 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 22/27] SourceLevelDebugPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 24/27] UefiCpuPkg: " Vitaly Cheptsov
` (4 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
StandaloneMmPkg/StandaloneMmPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index f9546e182e..5d1fb929f7 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -38,6 +38,7 @@ [LibraryClasses]
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
FvLib|StandaloneMmPkg/Library/FvLib/FvLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 24/27] UefiCpuPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (22 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 23/27] StandaloneMmPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 20:52 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 25/27] UefiPayloadPkg: " Vitaly Cheptsov
` (3 subsequent siblings)
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
UefiCpuPkg/UefiCpuPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index d28cb5cccb..f5f407ad23 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -27,6 +27,7 @@ [LibraryClasses]
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 25/27] UefiPayloadPkg: Add support for DebugCommonLib
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (23 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 24/27] UefiCpuPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit Vitaly Cheptsov
` (2 subsequent siblings)
27 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
UefiPayloadPkg/UefiPayloadPkgIa32.dsc | 1 +
UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc | 1 +
2 files changed, 2 insertions(+)
diff --git a/UefiPayloadPkg/UefiPayloadPkgIa32.dsc b/UefiPayloadPkg/UefiPayloadPkgIa32.dsc
index d52945442e..fdfd37f666 100644
--- a/UefiPayloadPkg/UefiPayloadPkgIa32.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkgIa32.dsc
@@ -182,6 +182,7 @@ [LibraryClasses]
#
# Misc
#
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
!if $(SOURCE_DEBUG_ENABLE) == TRUE
diff --git a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc b/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc
index 0736cd9954..56c8f00af3 100644
--- a/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc
@@ -183,6 +183,7 @@ [LibraryClasses]
#
# Misc
#
+ DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
!if $(SOURCE_DEBUG_ENABLE) == TRUE
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (24 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 25/27] UefiPayloadPkg: " Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 20:58 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString Vitaly Cheptsov
2020-05-11 22:40 ` [PATCH V4 00/27] Disabling safe string constraint assertions Michael D Kinney
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
This bit allows to control assertion on constrain violation.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdePkg/Include/Library/DebugCommonLib.h | 18 ++++++++++++++++++
MdePkg/Include/Library/DebugLib.h | 18 ++++++++++++++++++
MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 20 ++++++++++++++++++++
MdePkg/MdePkg.dec | 3 ++-
4 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
index 31249f91fa..3dc906d02a 100644
--- a/MdePkg/Include/Library/DebugCommonLib.h
+++ b/MdePkg/Include/Library/DebugCommonLib.h
@@ -21,6 +21,7 @@
#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
+#define DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED 0x40
//
// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
@@ -135,6 +136,23 @@ DebugClearMemoryEnabled (
);
+/**
+ Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugAssertConstraintEnabled (
+ VOID
+ );
+
+
/**
Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index a38e0e2904..ea38522ae3 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -212,6 +212,24 @@ DebugClearMemory (
#define ASSERT(Expression)
#endif
+
+/**
+ Macro that calls ASSERT when constrain assertions are enabled.
+
+ If DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set,
+ then this macro evaluates to an ASSERT macro passing in the original Expression.
+
+ @param Expression Boolean expression.
+
+**/
+#define ASSERT_CONSTRAINT(Expression) \
+ do { \
+ if (DebugAssertConstraintEnabled ()) { \
+ ASSERT (Expression); \
+ } \
+ } while (FALSE)
+
+
/**
Macro that calls DebugPrint().
diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
index 2291fb5382..870f9ceec5 100644
--- a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
+++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
@@ -93,6 +93,26 @@ DebugClearMemoryEnabled (
}
+/**
+ Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
+
+ This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
+ PcdDebugProperyMask is set. Otherwise, FALSE is returned.
+
+ @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
+ @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
+
+**/
+BOOLEAN
+EFIAPI
+DebugAssertConstraintEnabled (
+ VOID
+ )
+{
+ return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED) != 0);
+}
+
+
/**
Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index a121b9ecab..63003357d6 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2136,9 +2136,10 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
# BIT3 - Enable Clear Memory.<BR>
# BIT4 - Enable BreakPoint as ASSERT.<BR>
# BIT5 - Enable DeadLoop as ASSERT.<BR>
+ # BIT6 - Treat constrait violations as ASSERT.<BR>
# @Prompt Debug Property.
# @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000045
## This flag is used to control the print out Debug message.<BR><BR>
# BIT0 - Initialization message.<BR>
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (25 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit Vitaly Cheptsov
@ 2020-05-11 15:41 ` Vitaly Cheptsov
2020-05-11 21:04 ` [edk2-devel] " Laszlo Ersek
2020-05-11 22:40 ` [PATCH V4 00/27] Disabling safe string constraint assertions Michael D Kinney
27 siblings, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-11 15:41 UTC (permalink / raw)
To: devel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
This change allows using SafeString interfaces for untrusted data
checking when constraint violation assertions are disabled.
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
---
MdePkg/Include/Library/BaseLib.h | 120 ++++++++++----------
MdePkg/Library/BaseLib/SafeString.c | 2 +-
2 files changed, 61 insertions(+), 61 deletions(-)
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index b0bbe8cef8..9c9f9fe25f 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -216,7 +216,7 @@ StrnSizeS (
If Destination is not aligned on a 16-bit boundary, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -252,7 +252,7 @@ StrCpyS (
If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -290,7 +290,7 @@ StrnCpyS (
If Destination is not aligned on a 16-bit boundary, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -330,7 +330,7 @@ StrCatS (
If Destination is not aligned on a 16-bit boundary, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -377,12 +377,12 @@ StrnCatS (
be ignored. Then, the function stops at the first character that is a not a
valid decimal character or a Null-terminator, whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid decimal digits in the above format, then 0 is stored
at the location pointed to by Data.
@@ -433,12 +433,12 @@ StrDecimalToUintnS (
be ignored. Then, the function stops at the first character that is a not a
valid decimal character or a Null-terminator, whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid decimal digits in the above format, then 0 is stored
at the location pointed to by Data.
@@ -494,12 +494,12 @@ StrDecimalToUint64S (
the first character that is a not a valid hexadecimal character or NULL,
whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid hexadecimal digits in the above format, then 0 is
stored at the location pointed to by Data.
@@ -555,12 +555,12 @@ StrHexToUintnS (
the first character that is a not a valid hexadecimal character or NULL,
whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid hexadecimal digits in the above format, then 0 is
stored at the location pointed to by Data.
@@ -649,7 +649,7 @@ AsciiStrnSizeS (
This function is similar as strcpy_s defined in C11.
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -683,7 +683,7 @@ AsciiStrCpyS (
This function is similar as strncpy_s defined in C11.
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -719,7 +719,7 @@ AsciiStrnCpyS (
This function is similar as strcat_s defined in C11.
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -757,7 +757,7 @@ AsciiStrCatS (
This function is similar as strncat_s defined in C11.
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -804,11 +804,11 @@ AsciiStrnCatS (
be ignored. Then, the function stops at the first character that is a not a
valid decimal character or a Null-terminator, whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than
PcdMaximumAsciiStringLength Ascii characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid decimal digits in the above format, then 0 is stored
at the location pointed to by Data.
@@ -859,11 +859,11 @@ AsciiStrDecimalToUintnS (
be ignored. Then, the function stops at the first character that is a not a
valid decimal character or a Null-terminator, whichever one comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than
PcdMaximumAsciiStringLength Ascii characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid decimal digits in the above format, then 0 is stored
at the location pointed to by Data.
@@ -918,11 +918,11 @@ AsciiStrDecimalToUint64S (
character that is a not a valid hexadecimal character or Null-terminator,
whichever on comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than
PcdMaximumAsciiStringLength Ascii characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid hexadecimal digits in the above format, then 0 is
stored at the location pointed to by Data.
@@ -977,11 +977,11 @@ AsciiStrHexToUintnS (
character that is a not a valid hexadecimal character or Null-terminator,
whichever on comes first.
- If String is NULL, then ASSERT().
- If Data is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Data is NULL, then ASSERT_CONSTRAINT().
If PcdMaximumAsciiStringLength is not zero, and String contains more than
PcdMaximumAsciiStringLength Ascii characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If String has no valid hexadecimal digits in the above format, then 0 is
stored at the location pointed to by Data.
@@ -1533,15 +1533,15 @@ StrHexToUint64 (
"::" can be used to compress one or more groups of X when X contains only 0.
The "::" can only appear once in the String.
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Address is NULL, then ASSERT().
+ If Address is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If EndPointer is not NULL and Address is translated from String, a pointer
to the character that stopped the scan is stored at the location pointed to
@@ -1594,15 +1594,15 @@ StrToIpv6Address (
When /P is in the String, the function stops at the first character that is not
a valid decimal digit character after P is converted.
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Address is NULL, then ASSERT().
+ If Address is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters, not including the
- Null-terminator, then ASSERT().
+ Null-terminator, then ASSERT_CONSTRAINT().
If EndPointer is not NULL and Address is translated from String, a pointer
to the character that stopped the scan is stored at the location pointed to
@@ -1667,8 +1667,8 @@ StrToIpv4Address (
oo Data4[48:55]
pp Data4[56:63]
- If String is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Guid is NULL, then ASSERT_CONSTRAINT().
If String is not aligned in a 16-bit boundary, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@@ -1703,16 +1703,16 @@ StrToGuid (
If String is not aligned in a 16-bit boundary, then ASSERT().
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Buffer is NULL, then ASSERT().
+ If Buffer is NULL, then ASSERT_CONSTRAINT().
- If Length is not multiple of 2, then ASSERT().
+ If Length is not multiple of 2, then ASSERT_CONSTRAINT().
If PcdMaximumUnicodeStringLength is not zero and Length is greater than
- PcdMaximumUnicodeStringLength, then ASSERT().
+ PcdMaximumUnicodeStringLength, then ASSERT_CONSTRAINT().
- If MaxBufferSize is less than (Length / 2), then ASSERT().
+ If MaxBufferSize is less than (Length / 2), then ASSERT_CONSTRAINT().
@param String Pointer to a Null-terminated Unicode string.
@param Length The number of Unicode characters to decode.
@@ -1804,7 +1804,7 @@ UnicodeStrToAsciiStr (
the upper 8 bits, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -1851,7 +1851,7 @@ UnicodeStrToAsciiStrS (
If any Unicode characters in Source contain non-zero value in the upper 8
bits, then ASSERT().
If Source is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -2415,9 +2415,9 @@ AsciiStrHexToUint64 (
"::" can be used to compress one or more groups of X when X contains only 0.
The "::" can only appear once in the String.
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Address is NULL, then ASSERT().
+ If Address is NULL, then ASSERT_CONSTRAINT().
If EndPointer is not NULL and Address is translated from String, a pointer
to the character that stopped the scan is stored at the location pointed to
@@ -2470,9 +2470,9 @@ AsciiStrToIpv6Address (
When /P is in the String, the function stops at the first character that is not
a valid decimal digit character after P is converted.
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Address is NULL, then ASSERT().
+ If Address is NULL, then ASSERT_CONSTRAINT().
If EndPointer is not NULL and Address is translated from String, a pointer
to the character that stopped the scan is stored at the location pointed to
@@ -2535,8 +2535,8 @@ AsciiStrToIpv4Address (
oo Data4[48:55]
pp Data4[56:63]
- If String is NULL, then ASSERT().
- If Guid is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
+ If Guid is NULL, then ASSERT_CONSTRAINT().
@param String Pointer to a Null-terminated ASCII string.
@param Guid Pointer to the converted GUID.
@@ -2568,16 +2568,16 @@ AsciiStrToGuid (
decoding stops after Length of characters and outputs Buffer containing
(Length / 2) bytes.
- If String is NULL, then ASSERT().
+ If String is NULL, then ASSERT_CONSTRAINT().
- If Buffer is NULL, then ASSERT().
+ If Buffer is NULL, then ASSERT_CONSTRAINT().
- If Length is not multiple of 2, then ASSERT().
+ If Length is not multiple of 2, then ASSERT_CONSTRAINT().
If PcdMaximumAsciiStringLength is not zero and Length is greater than
- PcdMaximumAsciiStringLength, then ASSERT().
+ PcdMaximumAsciiStringLength, then ASSERT_CONSTRAINT().
- If MaxBufferSize is less than (Length / 2), then ASSERT().
+ If MaxBufferSize is less than (Length / 2), then ASSERT_CONSTRAINT().
@param String Pointer to a Null-terminated ASCII string.
@param Length The number of ASCII characters to decode.
@@ -2659,7 +2659,7 @@ AsciiStrToUnicodeStr (
equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
If Destination is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then the Destination is unmodified.
@@ -2705,7 +2705,7 @@ AsciiStrToUnicodeStrS (
((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes.
If Destination is not aligned on a 16-bit boundary, then ASSERT().
- If an error would be returned, then the function will also ASSERT().
+ If an error would be returned, then the function will also ASSERT_CONSTRAINT().
If an error is returned, then Destination and DestinationLength are
unmodified.
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 7dc03d2caa..f6cdd76c82 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -14,7 +14,7 @@
#define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \
do { \
- ASSERT (Expression); \
+ ASSERT_CONSTRAINT (Expression); \
if (!(Expression)) { \
return Status; \
} \
--
2.24.2 (Apple Git-127)
^ permalink raw reply related [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
@ 2020-05-11 20:37 ` Laszlo Ersek
2020-05-11 20:42 ` Laszlo Ersek
1 sibling, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:37 UTC (permalink / raw)
To: devel, cheptsov; +Cc: Michael Kinney, Liming Gao
On 05/11/20 17:40, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> This library allows to make a common part of all DebugLib instances
> and avoid the need to update every DebugLib on extending a new debug
> mask PCD bit.
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> MdePkg/Include/Library/DebugCommonLib.h | 154 ++++++++++++++++++++
> MdePkg/Include/Library/DebugLib.h | 137 +----------------
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf | 39 +++++
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni | 16 ++
> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 113 ++++++++++++++
> MdePkg/MdePkg.dec | 3 +
> MdePkg/MdePkg.dsc | 1 +
> MdePkg/MdePkg.uni | 3 +-
> 8 files changed, 329 insertions(+), 137 deletions(-)
>
> diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
> new file mode 100644
> index 0000000000..31249f91fa
> --- /dev/null
> +++ b/MdePkg/Include/Library/DebugCommonLib.h
> @@ -0,0 +1,154 @@
> +/** @file
> + Provides services to access common debugging features.
> +
> + The debug common library interface provides common code for all debug libraries.
> +
> + Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __DEBUG_COMMON_LIB_H__
> +#define __DEBUG_COMMON_LIB_H__
> +
> +//
> +// Declare bits for PcdDebugPropertyMask
> +//
> +#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
> +#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
> +#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
> +#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
> +#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
> +#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
> +
> +//
> +// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
> +//
> +#define DEBUG_INIT 0x00000001 // Initialization
> +#define DEBUG_WARN 0x00000002 // Warnings
> +#define DEBUG_LOAD 0x00000004 // Load events
> +#define DEBUG_FS 0x00000008 // EFI File system
> +#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
> +#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
> +#define DEBUG_INFO 0x00000040 // Informational debug messages
> +#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
> +#define DEBUG_VARIABLE 0x00000100 // Variable
> +#define DEBUG_BM 0x00000400 // Boot Manager
> +#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
> +#define DEBUG_NET 0x00004000 // Network Io Driver
> +#define DEBUG_UNDI 0x00010000 // UNDI Driver
> +#define DEBUG_LOADFILE 0x00020000 // LoadFile
> +#define DEBUG_EVENT 0x00080000 // Event messages
> +#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
> +#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
> +#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
> + // significantly impact boot performance
> +#define DEBUG_ERROR 0x80000000 // Error
> +
> +//
> +// Aliases of debug message mask bits
> +//
> +#define EFI_D_INIT DEBUG_INIT
> +#define EFI_D_WARN DEBUG_WARN
> +#define EFI_D_LOAD DEBUG_LOAD
> +#define EFI_D_FS DEBUG_FS
> +#define EFI_D_POOL DEBUG_POOL
> +#define EFI_D_PAGE DEBUG_PAGE
> +#define EFI_D_INFO DEBUG_INFO
> +#define EFI_D_DISPATCH DEBUG_DISPATCH
> +#define EFI_D_VARIABLE DEBUG_VARIABLE
> +#define EFI_D_BM DEBUG_BM
> +#define EFI_D_BLKIO DEBUG_BLKIO
> +#define EFI_D_NET DEBUG_NET
> +#define EFI_D_UNDI DEBUG_UNDI
> +#define EFI_D_LOADFILE DEBUG_LOADFILE
> +#define EFI_D_EVENT DEBUG_EVENT
> +#define EFI_D_VERBOSE DEBUG_VERBOSE
> +#define EFI_D_ERROR DEBUG_ERROR
> +
> +/**
> + Returns TRUE if ASSERT() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG_CODE() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugCodeEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugClearMemoryEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + @retval TRUE Current ErrorLevel is supported.
> + @retval FALSE Current ErrorLevel is not supported.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintLevelEnabled (
> + IN CONST UINTN ErrorLevel
> + );
> +
> +
> +#endif
> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
> index baab34bf05..a38e0e2904 100644
> --- a/MdePkg/Include/Library/DebugLib.h
> +++ b/MdePkg/Include/Library/DebugLib.h
> @@ -16,60 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #ifndef __DEBUG_LIB_H__
> #define __DEBUG_LIB_H__
>
> -//
> -// Declare bits for PcdDebugPropertyMask
> -//
> -#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
> -#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
> -#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
> -#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
> -#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
> -#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
> -
> -//
> -// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
> -//
> -#define DEBUG_INIT 0x00000001 // Initialization
> -#define DEBUG_WARN 0x00000002 // Warnings
> -#define DEBUG_LOAD 0x00000004 // Load events
> -#define DEBUG_FS 0x00000008 // EFI File system
> -#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
> -#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
> -#define DEBUG_INFO 0x00000040 // Informational debug messages
> -#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
> -#define DEBUG_VARIABLE 0x00000100 // Variable
> -#define DEBUG_BM 0x00000400 // Boot Manager
> -#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
> -#define DEBUG_NET 0x00004000 // Network Io Driver
> -#define DEBUG_UNDI 0x00010000 // UNDI Driver
> -#define DEBUG_LOADFILE 0x00020000 // LoadFile
> -#define DEBUG_EVENT 0x00080000 // Event messages
> -#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
> -#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
> -#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
> - // significantly impact boot performance
> -#define DEBUG_ERROR 0x80000000 // Error
> -
> -//
> -// Aliases of debug message mask bits
> -//
> -#define EFI_D_INIT DEBUG_INIT
> -#define EFI_D_WARN DEBUG_WARN
> -#define EFI_D_LOAD DEBUG_LOAD
> -#define EFI_D_FS DEBUG_FS
> -#define EFI_D_POOL DEBUG_POOL
> -#define EFI_D_PAGE DEBUG_PAGE
> -#define EFI_D_INFO DEBUG_INFO
> -#define EFI_D_DISPATCH DEBUG_DISPATCH
> -#define EFI_D_VARIABLE DEBUG_VARIABLE
> -#define EFI_D_BM DEBUG_BM
> -#define EFI_D_BLKIO DEBUG_BLKIO
> -#define EFI_D_NET DEBUG_NET
> -#define EFI_D_UNDI DEBUG_UNDI
> -#define EFI_D_LOADFILE DEBUG_LOADFILE
> -#define EFI_D_EVENT DEBUG_EVENT
> -#define EFI_D_VERBOSE DEBUG_VERBOSE
> -#define EFI_D_ERROR DEBUG_ERROR
> +#include <Library/DebugCommonLib.h>
>
> /**
> Prints a debug message to the debug output device if the specified error level is enabled.
> @@ -198,88 +145,6 @@ DebugClearMemory (
> );
>
>
> -/**
> - Returns TRUE if ASSERT() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugAssertEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG_CODE() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugCodeEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugClearMemoryEnabled (
> - VOID
> - );
> -
> -/**
> - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - @retval TRUE Current ErrorLevel is supported.
> - @retval FALSE Current ErrorLevel is not supported.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintLevelEnabled (
> - IN CONST UINTN ErrorLevel
> - );
> -
> /**
> Internal worker macro that calls DebugAssert().
>
> diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> new file mode 100644
> index 0000000000..c1f4b0d5a8
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> @@ -0,0 +1,39 @@
> +## @file
> +# Instance of Debug Common Library interface.
> +# It uses PcdLib to provide a common set of Debug Library interface.
> +#
> +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +##
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = BaseDebugCommonLib
> + MODULE_UNI_FILE = BaseDebugCommonLib.uni
> + FILE_GUID = 7CD790D2-E13F-4446-AF4F-813F0B9DEFF8
> + MODULE_TYPE = BASE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = DebugCommonLib
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 EBC
> +#
> +
> +[Sources]
> + DebugCommonLib.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> + PcdLib
> +
> +[Pcd]
> + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES
> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
> + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
> +
> diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
> new file mode 100644
> index 0000000000..a5ad34298b
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
> @@ -0,0 +1,16 @@
> +// /** @file
> +// Instance of Debug Common Library interface.
> +//
> +// It uses PcdLib to provide a common set of Debug Library interface.
> +//
> +// Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +// **/
> +
> +
> +#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Common Library interface"
> +
> +#string STR_MODULE_DESCRIPTION #language en-US "It uses PcdLib to provide a common set of Debug Library interface."
> +
> diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> new file mode 100644
> index 0000000000..2291fb5382
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> @@ -0,0 +1,113 @@
> +/** @file
> + Instance of Debug Common Library interface.
> + It uses PcdLib to provide a common set of Debug Library interface.
> +
> + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/DebugCommonLib.h>
> +#include <Library/PcdLib.h>
> +
> +
> +/**
> + Returns TRUE if ASSERT() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG_CODE() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugCodeEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugClearMemoryEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + @retval TRUE Current ErrorLevel is supported.
> + @retval FALSE Current ErrorLevel is not supported.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintLevelEnabled (
> + IN CONST UINTN ErrorLevel
> + )
> +{
> + return (BOOLEAN) ((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
> +}
> +
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 0b9c4bc40a..a121b9ecab 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -229,6 +229,9 @@ [LibraryClasses]
> # library class maps directly on top of the Timer class.
> S3StallLib|Include/Library/S3StallLib.h
>
> + ## @libraryclass Provides services to access common debugging features.
> + DebugCommonLib|Include/Library/DebugCommonLib.h
> +
> ## @libraryclass Defines library APIs used by modules to get/set print error level.
> DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h
>
> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
> index 6cd38e7ec3..1072322450 100644
> --- a/MdePkg/MdePkg.dsc
> +++ b/MdePkg/MdePkg.dsc
> @@ -36,6 +36,7 @@ [Components]
> MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
> MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> + MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
> index 5c1fa24065..5addb0eaba 100644
> --- a/MdePkg/MdePkg.uni
> +++ b/MdePkg/MdePkg.uni
> @@ -189,7 +189,8 @@
> "BIT2 - Enable Debug Code.<BR>\n"
> "BIT3 - Enable Clear Memory.<BR>\n"
> "BIT4 - Enable BreakPoint as ASSERT.<BR>\n"
> - "BIT5 - Enable DeadLoop as ASSERT.<BR>"
> + "BIT5 - Enable DeadLoop as ASSERT.<BR>\n"
> + "BIT6 - Treat constrait violations as ASSERT.<BR>"
>
> #string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero."
>
>
I think the very last hunk in this patch belongs in patch#26 ("MdePkg:
Introduce assertion on constraint debug mask bit"), which is where BIT6
is actually defined for PcdDebugPropertyMask.
Other than that, this approach looks good to me. I haven't reviewed the
rest of this series yet, but from this patch, the series seems to
consider bisectability / building at every stage important (which they are).
For this patch:
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(My review is of course no substitute for the MdePkg owners, Mike and
Liming.)
Thanks
Laszlo
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
2020-05-11 20:37 ` [edk2-devel] " Laszlo Ersek
@ 2020-05-11 20:42 ` Laszlo Ersek
1 sibling, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:42 UTC (permalink / raw)
To: devel, cheptsov; +Cc: Michael Kinney, Liming Gao
ah, one superficial comment:
On 05/11/20 17:40, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> This library allows to make a common part of all DebugLib instances
> and avoid the need to update every DebugLib on extending a new debug
> mask PCD bit.
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> MdePkg/Include/Library/DebugCommonLib.h | 154 ++++++++++++++++++++
> MdePkg/Include/Library/DebugLib.h | 137 +----------------
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf | 39 +++++
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni | 16 ++
> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 113 ++++++++++++++
> MdePkg/MdePkg.dec | 3 +
> MdePkg/MdePkg.dsc | 1 +
> MdePkg/MdePkg.uni | 3 +-
> 8 files changed, 329 insertions(+), 137 deletions(-)
>
> diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
> new file mode 100644
> index 0000000000..31249f91fa
> --- /dev/null
> +++ b/MdePkg/Include/Library/DebugCommonLib.h
> @@ -0,0 +1,154 @@
> +/** @file
> + Provides services to access common debugging features.
> +
> + The debug common library interface provides common code for all debug libraries.
> +
> + Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __DEBUG_COMMON_LIB_H__
> +#define __DEBUG_COMMON_LIB_H__
> +
> +//
> +// Declare bits for PcdDebugPropertyMask
> +//
> +#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
> +#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
> +#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
> +#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
> +#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
> +#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
> +
> +//
> +// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
> +//
> +#define DEBUG_INIT 0x00000001 // Initialization
> +#define DEBUG_WARN 0x00000002 // Warnings
> +#define DEBUG_LOAD 0x00000004 // Load events
> +#define DEBUG_FS 0x00000008 // EFI File system
> +#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
> +#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
> +#define DEBUG_INFO 0x00000040 // Informational debug messages
> +#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
> +#define DEBUG_VARIABLE 0x00000100 // Variable
> +#define DEBUG_BM 0x00000400 // Boot Manager
> +#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
> +#define DEBUG_NET 0x00004000 // Network Io Driver
> +#define DEBUG_UNDI 0x00010000 // UNDI Driver
> +#define DEBUG_LOADFILE 0x00020000 // LoadFile
> +#define DEBUG_EVENT 0x00080000 // Event messages
> +#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
> +#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
> +#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
> + // significantly impact boot performance
> +#define DEBUG_ERROR 0x80000000 // Error
> +
> +//
> +// Aliases of debug message mask bits
> +//
> +#define EFI_D_INIT DEBUG_INIT
> +#define EFI_D_WARN DEBUG_WARN
> +#define EFI_D_LOAD DEBUG_LOAD
> +#define EFI_D_FS DEBUG_FS
> +#define EFI_D_POOL DEBUG_POOL
> +#define EFI_D_PAGE DEBUG_PAGE
> +#define EFI_D_INFO DEBUG_INFO
> +#define EFI_D_DISPATCH DEBUG_DISPATCH
> +#define EFI_D_VARIABLE DEBUG_VARIABLE
> +#define EFI_D_BM DEBUG_BM
> +#define EFI_D_BLKIO DEBUG_BLKIO
> +#define EFI_D_NET DEBUG_NET
> +#define EFI_D_UNDI DEBUG_UNDI
> +#define EFI_D_LOADFILE DEBUG_LOADFILE
> +#define EFI_D_EVENT DEBUG_EVENT
> +#define EFI_D_VERBOSE DEBUG_VERBOSE
> +#define EFI_D_ERROR DEBUG_ERROR
> +
> +/**
> + Returns TRUE if ASSERT() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG_CODE() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugCodeEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugClearMemoryEnabled (
> + VOID
> + );
> +
> +
> +/**
> + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + @retval TRUE Current ErrorLevel is supported.
> + @retval FALSE Current ErrorLevel is not supported.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintLevelEnabled (
> + IN CONST UINTN ErrorLevel
> + );
> +
> +
> +#endif
> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
> index baab34bf05..a38e0e2904 100644
> --- a/MdePkg/Include/Library/DebugLib.h
> +++ b/MdePkg/Include/Library/DebugLib.h
> @@ -16,60 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> #ifndef __DEBUG_LIB_H__
> #define __DEBUG_LIB_H__
>
> -//
> -// Declare bits for PcdDebugPropertyMask
> -//
> -#define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01
> -#define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02
> -#define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04
> -#define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
> -#define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
> -#define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
> -
> -//
> -// Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
> -//
> -#define DEBUG_INIT 0x00000001 // Initialization
> -#define DEBUG_WARN 0x00000002 // Warnings
> -#define DEBUG_LOAD 0x00000004 // Load events
> -#define DEBUG_FS 0x00000008 // EFI File system
> -#define DEBUG_POOL 0x00000010 // Alloc & Free (pool)
> -#define DEBUG_PAGE 0x00000020 // Alloc & Free (page)
> -#define DEBUG_INFO 0x00000040 // Informational debug messages
> -#define DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers
> -#define DEBUG_VARIABLE 0x00000100 // Variable
> -#define DEBUG_BM 0x00000400 // Boot Manager
> -#define DEBUG_BLKIO 0x00001000 // BlkIo Driver
> -#define DEBUG_NET 0x00004000 // Network Io Driver
> -#define DEBUG_UNDI 0x00010000 // UNDI Driver
> -#define DEBUG_LOADFILE 0x00020000 // LoadFile
> -#define DEBUG_EVENT 0x00080000 // Event messages
> -#define DEBUG_GCD 0x00100000 // Global Coherency Database changes
> -#define DEBUG_CACHE 0x00200000 // Memory range cachability changes
> -#define DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
> - // significantly impact boot performance
> -#define DEBUG_ERROR 0x80000000 // Error
> -
> -//
> -// Aliases of debug message mask bits
> -//
> -#define EFI_D_INIT DEBUG_INIT
> -#define EFI_D_WARN DEBUG_WARN
> -#define EFI_D_LOAD DEBUG_LOAD
> -#define EFI_D_FS DEBUG_FS
> -#define EFI_D_POOL DEBUG_POOL
> -#define EFI_D_PAGE DEBUG_PAGE
> -#define EFI_D_INFO DEBUG_INFO
> -#define EFI_D_DISPATCH DEBUG_DISPATCH
> -#define EFI_D_VARIABLE DEBUG_VARIABLE
> -#define EFI_D_BM DEBUG_BM
> -#define EFI_D_BLKIO DEBUG_BLKIO
> -#define EFI_D_NET DEBUG_NET
> -#define EFI_D_UNDI DEBUG_UNDI
> -#define EFI_D_LOADFILE DEBUG_LOADFILE
> -#define EFI_D_EVENT DEBUG_EVENT
> -#define EFI_D_VERBOSE DEBUG_VERBOSE
> -#define EFI_D_ERROR DEBUG_ERROR
> +#include <Library/DebugCommonLib.h>
>
> /**
> Prints a debug message to the debug output device if the specified error level is enabled.
> @@ -198,88 +145,6 @@ DebugClearMemory (
> );
>
>
> -/**
> - Returns TRUE if ASSERT() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugAssertEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG_CODE() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugCodeEnabled (
> - VOID
> - );
> -
> -
> -/**
> - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugClearMemoryEnabled (
> - VOID
> - );
> -
> -/**
> - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - @retval TRUE Current ErrorLevel is supported.
> - @retval FALSE Current ErrorLevel is not supported.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintLevelEnabled (
> - IN CONST UINTN ErrorLevel
> - );
> -
> /**
> Internal worker macro that calls DebugAssert().
>
> diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> new file mode 100644
> index 0000000000..c1f4b0d5a8
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> @@ -0,0 +1,39 @@
> +## @file
> +# Instance of Debug Common Library interface.
> +# It uses PcdLib to provide a common set of Debug Library interface.
> +#
> +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +##
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = BaseDebugCommonLib
> + MODULE_UNI_FILE = BaseDebugCommonLib.uni
> + FILE_GUID = 7CD790D2-E13F-4446-AF4F-813F0B9DEFF8
> + MODULE_TYPE = BASE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = DebugCommonLib
> +
> +#
> +# VALID_ARCHITECTURES = IA32 X64 EBC
> +#
I think the VALID_ARCHITECTURES comment should be dropped altogether.
At least the current arch list "IA32 X64 EBC" is incorrect; first
because ARM and AARCH64 are missing (despite the series -- correctly --
patching Arm*Pkg and such), and second because -- I *think* -- EBC is no
longer an arch natively supported by edk2. (Mike and Liming will correct
me on that, if needed.)
(... Please consider adding Cc: tags to the commit messages, so that
each patch email reaches the subject package owners directly too. Anyway
that's for the future.)
Thanks,
Laszlo
> +
> +[Sources]
> + DebugCommonLib.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> + PcdLib
> +
> +[Pcd]
> + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue ## SOMETIMES_CONSUMES
> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
> + gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel ## CONSUMES
> +
> diff --git a/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
> new file mode 100644
> index 0000000000..a5ad34298b
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.uni
> @@ -0,0 +1,16 @@
> +// /** @file
> +// Instance of Debug Common Library interface.
> +//
> +// It uses PcdLib to provide a common set of Debug Library interface.
> +//
> +// Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +// **/
> +
> +
> +#string STR_MODULE_ABSTRACT #language en-US "Instance of Debug Common Library interface"
> +
> +#string STR_MODULE_DESCRIPTION #language en-US "It uses PcdLib to provide a common set of Debug Library interface."
> +
> diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> new file mode 100644
> index 0000000000..2291fb5382
> --- /dev/null
> +++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> @@ -0,0 +1,113 @@
> +/** @file
> + Instance of Debug Common Library interface.
> + It uses PcdLib to provide a common set of Debug Library interface.
> +
> + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> + Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/DebugCommonLib.h>
> +#include <Library/PcdLib.h>
> +
> +
> +/**
> + Returns TRUE if ASSERT() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG_CODE() macros are enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugCodeEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugClearMemoryEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
> +}
> +
> +
> +/**
> + Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> +
> + @retval TRUE Current ErrorLevel is supported.
> + @retval FALSE Current ErrorLevel is not supported.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugPrintLevelEnabled (
> + IN CONST UINTN ErrorLevel
> + )
> +{
> + return (BOOLEAN) ((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
> +}
> +
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 0b9c4bc40a..a121b9ecab 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -229,6 +229,9 @@ [LibraryClasses]
> # library class maps directly on top of the Timer class.
> S3StallLib|Include/Library/S3StallLib.h
>
> + ## @libraryclass Provides services to access common debugging features.
> + DebugCommonLib|Include/Library/DebugCommonLib.h
> +
> ## @libraryclass Defines library APIs used by modules to get/set print error level.
> DebugPrintErrorLevelLib|Include/Library/DebugPrintErrorLevelLib.h
>
> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
> index 6cd38e7ec3..1072322450 100644
> --- a/MdePkg/MdePkg.dsc
> +++ b/MdePkg/MdePkg.dsc
> @@ -36,6 +36,7 @@ [Components]
> MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
> MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> + MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
> index 5c1fa24065..5addb0eaba 100644
> --- a/MdePkg/MdePkg.uni
> +++ b/MdePkg/MdePkg.uni
> @@ -189,7 +189,8 @@
> "BIT2 - Enable Debug Code.<BR>\n"
> "BIT3 - Enable Clear Memory.<BR>\n"
> "BIT4 - Enable BreakPoint as ASSERT.<BR>\n"
> - "BIT5 - Enable DeadLoop as ASSERT.<BR>"
> + "BIT5 - Enable DeadLoop as ASSERT.<BR>\n"
> + "BIT6 - Treat constrait violations as ASSERT.<BR>"
>
> #string STR_gEfiMdePkgTokenSpaceGuid_ERR_80000002 #language en-US "Reserved bits must be set to zero."
>
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 07/27] ArmVirtPkg: Add support for DebugCommonLib
2020-05-11 15:41 ` [PATCH V4 07/27] ArmVirtPkg: " Vitaly Cheptsov
@ 2020-05-11 20:42 ` Laszlo Ersek
0 siblings, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:42 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 17:41, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> ArmVirtPkg/ArmVirt.dsc.inc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index cf44fc7389..4f3092a201 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -39,6 +39,7 @@ [LibraryClasses.common]
> !else
> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> !endif
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
> BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 16/27] OvmfPkg: Add support for DebugCommonLib
2020-05-11 15:41 ` [PATCH V4 16/27] OvmfPkg: " Vitaly Cheptsov
@ 2020-05-11 20:49 ` Laszlo Ersek
0 siblings, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:49 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 17:41, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 98 --------------------
> OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf | 1 +
> OvmfPkg/OvmfPkgIa32.dsc | 1 +
> OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
> OvmfPkg/OvmfPkgX64.dsc | 1 +
> OvmfPkg/OvmfXen.dsc | 1 +
> 6 files changed, 5 insertions(+), 98 deletions(-)
>
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> index dffb20822d..a4e0861d00 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> @@ -261,101 +261,3 @@ DebugClearMemory (
> //
> return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
> }
> -
> -
> -/**
> - Returns TRUE if ASSERT() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugAssertEnabled (
> - VOID
> - )
> -{
> - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
> -}
> -
> -
> -/**
> - Returns TRUE if DEBUG() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintEnabled (
> - VOID
> - )
> -{
> - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
> -}
> -
> -
> -/**
> - Returns TRUE if DEBUG_CODE() macros are enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugCodeEnabled (
> - VOID
> - )
> -{
> - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
> -}
> -
> -
> -/**
> - Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
> -
> - This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> - PcdDebugProperyMask is set. Otherwise FALSE is returned.
> -
> - @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
> - @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugClearMemoryEnabled (
> - VOID
> - )
> -{
> - return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
> -}
> -
> -/**
> - Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
> -
> - @retval TRUE Current ErrorLevel is supported.
> - @retval FALSE Current ErrorLevel is not supported.
> -
> -**/
> -BOOLEAN
> -EFIAPI
> -DebugPrintLevelEnabled (
> - IN CONST UINTN ErrorLevel
> - )
> -{
> - return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
> -}
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> index 8f721d249d..4078f0e361 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
> @@ -39,6 +39,7 @@ [LibraryClasses]
> PcdLib
> PrintLib
> BaseLib
> + DebugCommonLib
> DebugPrintErrorLevelLib
>
> [Pcd]
(1) The other two INF files in the same directory should get the same
update. (I.e., a dependency on DebugCommonLib.)
(2) I believe it should be possible to remove
"PcdFixedDebugPrintErrorLevel" from all three INF files in the same
directory. (The only reference, which is being removed, is in
DebugPrintLevelEnabled().)
Otherwise, the patch looks OK to me.
Thanks!
Laszlo
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 7c8b51f43b..c8adf75730 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -180,6 +180,7 @@ [LibraryClasses]
> !endif
>
> LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index a0596c4416..4df757ae68 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -184,6 +184,7 @@ [LibraryClasses]
> !endif
>
> LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 2e764b6b72..f0f6226f67 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -184,6 +184,7 @@ [LibraryClasses]
> !endif
>
> LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
> index 8b3615e0b0..257e2c1740 100644
> --- a/OvmfPkg/OvmfXen.dsc
> +++ b/OvmfPkg/OvmfXen.dsc
> @@ -171,6 +171,7 @@ [LibraryClasses]
> !endif
>
> LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>
> IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 24/27] UefiCpuPkg: Add support for DebugCommonLib
2020-05-11 15:41 ` [PATCH V4 24/27] UefiCpuPkg: " Vitaly Cheptsov
@ 2020-05-11 20:52 ` Laszlo Ersek
0 siblings, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:52 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 17:41, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> UefiCpuPkg/UefiCpuPkg.dsc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
> index d28cb5cccb..f5f407ad23 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> @@ -27,6 +27,7 @@ [LibraryClasses]
> CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
> + DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit
2020-05-11 15:41 ` [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit Vitaly Cheptsov
@ 2020-05-11 20:58 ` Laszlo Ersek
2020-05-11 22:12 ` Laszlo Ersek
0 siblings, 1 reply; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 20:58 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 17:41, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> This bit allows to control assertion on constrain violation.
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> MdePkg/Include/Library/DebugCommonLib.h | 18 ++++++++++++++++++
> MdePkg/Include/Library/DebugLib.h | 18 ++++++++++++++++++
> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 20 ++++++++++++++++++++
> MdePkg/MdePkg.dec | 3 ++-
> 4 files changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
> index 31249f91fa..3dc906d02a 100644
> --- a/MdePkg/Include/Library/DebugCommonLib.h
> +++ b/MdePkg/Include/Library/DebugCommonLib.h
> @@ -21,6 +21,7 @@
> #define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
> #define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
> #define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
> +#define DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED 0x40
>
> //
> // Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
> @@ -135,6 +136,23 @@ DebugClearMemoryEnabled (
> );
>
>
> +/**
> + Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertConstraintEnabled (
> + VOID
> + );
> +
> +
> /**
> Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
>
> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
> index a38e0e2904..ea38522ae3 100644
> --- a/MdePkg/Include/Library/DebugLib.h
> +++ b/MdePkg/Include/Library/DebugLib.h
> @@ -212,6 +212,24 @@ DebugClearMemory (
> #define ASSERT(Expression)
> #endif
>
> +
> +/**
> + Macro that calls ASSERT when constrain assertions are enabled.
> +
> + If DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set,
> + then this macro evaluates to an ASSERT macro passing in the original Expression.
> +
> + @param Expression Boolean expression.
> +
> +**/
> +#define ASSERT_CONSTRAINT(Expression) \
> + do { \
> + if (DebugAssertConstraintEnabled ()) { \
> + ASSERT (Expression); \
> + } \
> + } while (FALSE)
> +
> +
> /**
> Macro that calls DebugPrint().
>
> diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> index 2291fb5382..870f9ceec5 100644
> --- a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> +++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> @@ -93,6 +93,26 @@ DebugClearMemoryEnabled (
> }
>
>
> +/**
> + Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
> +
> + This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
> +
> + @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
> + @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +DebugAssertConstraintEnabled (
> + VOID
> + )
> +{
> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED) != 0);
> +}
> +
> +
> /**
> Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
>
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index a121b9ecab..63003357d6 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -2136,9 +2136,10 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
> # BIT3 - Enable Clear Memory.<BR>
> # BIT4 - Enable BreakPoint as ASSERT.<BR>
> # BIT5 - Enable DeadLoop as ASSERT.<BR>
> + # BIT6 - Treat constrait violations as ASSERT.<BR>
> # @Prompt Debug Property.
> # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
> - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000045
>
> ## This flag is used to control the print out Debug message.<BR><BR>
> # BIT0 - Initialization message.<BR>
>
(2) The "MdePkg/MdePkg.uni" file update from patch#1 belongs here, IMO.
Otherwise, the patch looks OK to me.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString
2020-05-11 15:41 ` [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString Vitaly Cheptsov
@ 2020-05-11 21:04 ` Laszlo Ersek
0 siblings, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 21:04 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 17:41, Vitaly Cheptsov wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> This change allows using SafeString interfaces for untrusted data
> checking when constraint violation assertions are disabled.
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> MdePkg/Include/Library/BaseLib.h | 120 ++++++++++----------
> MdePkg/Library/BaseLib/SafeString.c | 2 +-
> 2 files changed, 61 insertions(+), 61 deletions(-)
>
> diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
> index b0bbe8cef8..9c9f9fe25f 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -216,7 +216,7 @@ StrnSizeS (
>
> If Destination is not aligned on a 16-bit boundary, then ASSERT().
> If Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -252,7 +252,7 @@ StrCpyS (
>
> If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().
> If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -290,7 +290,7 @@ StrnCpyS (
>
> If Destination is not aligned on a 16-bit boundary, then ASSERT().
> If Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -330,7 +330,7 @@ StrCatS (
>
> If Destination is not aligned on a 16-bit boundary, then ASSERT().
> If Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -377,12 +377,12 @@ StrnCatS (
> be ignored. Then, the function stops at the first character that is a not a
> valid decimal character or a Null-terminator, whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If String is not aligned in a 16-bit boundary, then ASSERT().
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid decimal digits in the above format, then 0 is stored
> at the location pointed to by Data.
> @@ -433,12 +433,12 @@ StrDecimalToUintnS (
> be ignored. Then, the function stops at the first character that is a not a
> valid decimal character or a Null-terminator, whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If String is not aligned in a 16-bit boundary, then ASSERT().
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid decimal digits in the above format, then 0 is stored
> at the location pointed to by Data.
> @@ -494,12 +494,12 @@ StrDecimalToUint64S (
> the first character that is a not a valid hexadecimal character or NULL,
> whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If String is not aligned in a 16-bit boundary, then ASSERT().
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid hexadecimal digits in the above format, then 0 is
> stored at the location pointed to by Data.
> @@ -555,12 +555,12 @@ StrHexToUintnS (
> the first character that is a not a valid hexadecimal character or NULL,
> whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If String is not aligned in a 16-bit boundary, then ASSERT().
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid hexadecimal digits in the above format, then 0 is
> stored at the location pointed to by Data.
> @@ -649,7 +649,7 @@ AsciiStrnSizeS (
>
> This function is similar as strcpy_s defined in C11.
>
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -683,7 +683,7 @@ AsciiStrCpyS (
>
> This function is similar as strncpy_s defined in C11.
>
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -719,7 +719,7 @@ AsciiStrnCpyS (
>
> This function is similar as strcat_s defined in C11.
>
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -757,7 +757,7 @@ AsciiStrCatS (
>
> This function is similar as strncat_s defined in C11.
>
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -804,11 +804,11 @@ AsciiStrnCatS (
> be ignored. Then, the function stops at the first character that is a not a
> valid decimal character or a Null-terminator, whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If PcdMaximumAsciiStringLength is not zero, and String contains more than
> PcdMaximumAsciiStringLength Ascii characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid decimal digits in the above format, then 0 is stored
> at the location pointed to by Data.
> @@ -859,11 +859,11 @@ AsciiStrDecimalToUintnS (
> be ignored. Then, the function stops at the first character that is a not a
> valid decimal character or a Null-terminator, whichever one comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If PcdMaximumAsciiStringLength is not zero, and String contains more than
> PcdMaximumAsciiStringLength Ascii characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid decimal digits in the above format, then 0 is stored
> at the location pointed to by Data.
> @@ -918,11 +918,11 @@ AsciiStrDecimalToUint64S (
> character that is a not a valid hexadecimal character or Null-terminator,
> whichever on comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If PcdMaximumAsciiStringLength is not zero, and String contains more than
> PcdMaximumAsciiStringLength Ascii characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid hexadecimal digits in the above format, then 0 is
> stored at the location pointed to by Data.
> @@ -977,11 +977,11 @@ AsciiStrHexToUintnS (
> character that is a not a valid hexadecimal character or Null-terminator,
> whichever on comes first.
>
> - If String is NULL, then ASSERT().
> - If Data is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Data is NULL, then ASSERT_CONSTRAINT().
> If PcdMaximumAsciiStringLength is not zero, and String contains more than
> PcdMaximumAsciiStringLength Ascii characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If String has no valid hexadecimal digits in the above format, then 0 is
> stored at the location pointed to by Data.
> @@ -1533,15 +1533,15 @@ StrHexToUint64 (
> "::" can be used to compress one or more groups of X when X contains only 0.
> The "::" can only appear once in the String.
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Address is NULL, then ASSERT().
> + If Address is NULL, then ASSERT_CONSTRAINT().
>
> If String is not aligned in a 16-bit boundary, then ASSERT().
>
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If EndPointer is not NULL and Address is translated from String, a pointer
> to the character that stopped the scan is stored at the location pointed to
> @@ -1594,15 +1594,15 @@ StrToIpv6Address (
> When /P is in the String, the function stops at the first character that is not
> a valid decimal digit character after P is converted.
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Address is NULL, then ASSERT().
> + If Address is NULL, then ASSERT_CONSTRAINT().
>
> If String is not aligned in a 16-bit boundary, then ASSERT().
>
> If PcdMaximumUnicodeStringLength is not zero, and String contains more than
> PcdMaximumUnicodeStringLength Unicode characters, not including the
> - Null-terminator, then ASSERT().
> + Null-terminator, then ASSERT_CONSTRAINT().
>
> If EndPointer is not NULL and Address is translated from String, a pointer
> to the character that stopped the scan is stored at the location pointed to
> @@ -1667,8 +1667,8 @@ StrToIpv4Address (
> oo Data4[48:55]
> pp Data4[56:63]
>
> - If String is NULL, then ASSERT().
> - If Guid is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Guid is NULL, then ASSERT_CONSTRAINT().
> If String is not aligned in a 16-bit boundary, then ASSERT().
>
> @param String Pointer to a Null-terminated Unicode string.
> @@ -1703,16 +1703,16 @@ StrToGuid (
>
> If String is not aligned in a 16-bit boundary, then ASSERT().
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Buffer is NULL, then ASSERT().
> + If Buffer is NULL, then ASSERT_CONSTRAINT().
>
> - If Length is not multiple of 2, then ASSERT().
> + If Length is not multiple of 2, then ASSERT_CONSTRAINT().
>
> If PcdMaximumUnicodeStringLength is not zero and Length is greater than
> - PcdMaximumUnicodeStringLength, then ASSERT().
> + PcdMaximumUnicodeStringLength, then ASSERT_CONSTRAINT().
>
> - If MaxBufferSize is less than (Length / 2), then ASSERT().
> + If MaxBufferSize is less than (Length / 2), then ASSERT_CONSTRAINT().
>
> @param String Pointer to a Null-terminated Unicode string.
> @param Length The number of Unicode characters to decode.
> @@ -1804,7 +1804,7 @@ UnicodeStrToAsciiStr (
> the upper 8 bits, then ASSERT().
>
> If Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -1851,7 +1851,7 @@ UnicodeStrToAsciiStrS (
> If any Unicode characters in Source contain non-zero value in the upper 8
> bits, then ASSERT().
> If Source is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -2415,9 +2415,9 @@ AsciiStrHexToUint64 (
> "::" can be used to compress one or more groups of X when X contains only 0.
> The "::" can only appear once in the String.
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Address is NULL, then ASSERT().
> + If Address is NULL, then ASSERT_CONSTRAINT().
>
> If EndPointer is not NULL and Address is translated from String, a pointer
> to the character that stopped the scan is stored at the location pointed to
> @@ -2470,9 +2470,9 @@ AsciiStrToIpv6Address (
> When /P is in the String, the function stops at the first character that is not
> a valid decimal digit character after P is converted.
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Address is NULL, then ASSERT().
> + If Address is NULL, then ASSERT_CONSTRAINT().
>
> If EndPointer is not NULL and Address is translated from String, a pointer
> to the character that stopped the scan is stored at the location pointed to
> @@ -2535,8 +2535,8 @@ AsciiStrToIpv4Address (
> oo Data4[48:55]
> pp Data4[56:63]
>
> - If String is NULL, then ASSERT().
> - If Guid is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
> + If Guid is NULL, then ASSERT_CONSTRAINT().
>
> @param String Pointer to a Null-terminated ASCII string.
> @param Guid Pointer to the converted GUID.
> @@ -2568,16 +2568,16 @@ AsciiStrToGuid (
> decoding stops after Length of characters and outputs Buffer containing
> (Length / 2) bytes.
>
> - If String is NULL, then ASSERT().
> + If String is NULL, then ASSERT_CONSTRAINT().
>
> - If Buffer is NULL, then ASSERT().
> + If Buffer is NULL, then ASSERT_CONSTRAINT().
>
> - If Length is not multiple of 2, then ASSERT().
> + If Length is not multiple of 2, then ASSERT_CONSTRAINT().
>
> If PcdMaximumAsciiStringLength is not zero and Length is greater than
> - PcdMaximumAsciiStringLength, then ASSERT().
> + PcdMaximumAsciiStringLength, then ASSERT_CONSTRAINT().
>
> - If MaxBufferSize is less than (Length / 2), then ASSERT().
> + If MaxBufferSize is less than (Length / 2), then ASSERT_CONSTRAINT().
>
> @param String Pointer to a Null-terminated ASCII string.
> @param Length The number of ASCII characters to decode.
> @@ -2659,7 +2659,7 @@ AsciiStrToUnicodeStr (
> equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.
>
> If Destination is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then the Destination is unmodified.
>
> @@ -2705,7 +2705,7 @@ AsciiStrToUnicodeStrS (
> ((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes.
>
> If Destination is not aligned on a 16-bit boundary, then ASSERT().
> - If an error would be returned, then the function will also ASSERT().
> + If an error would be returned, then the function will also ASSERT_CONSTRAINT().
>
> If an error is returned, then Destination and DestinationLength are
> unmodified.
> diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
> index 7dc03d2caa..f6cdd76c82 100644
> --- a/MdePkg/Library/BaseLib/SafeString.c
> +++ b/MdePkg/Library/BaseLib/SafeString.c
> @@ -14,7 +14,7 @@
>
> #define SAFE_STRING_CONSTRAINT_CHECK(Expression, Status) \
> do { \
> - ASSERT (Expression); \
> + ASSERT_CONSTRAINT (Expression); \
> if (!(Expression)) { \
> return Status; \
> } \
>
The amount of function-level comments that need an update is dizzying,
so I'm not going to review them individually. The final macro update
looks OK.
Acked-by: Laszlo Ersek <lersek@redhat.com>
Note: unfortunately, the edk2-platforms tree contains a huge number of
DebugLib class resolutions (124 resolutions in 48 files, at commit
bfa32ac70a75), and I think the final patch in the present series will
break those platforms unless you post patches for them too.
IMO this is another good example why edk2-platforms should *not* exist
as a separate repository.
Thanks,
Laszlo
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit
2020-05-11 20:58 ` [edk2-devel] " Laszlo Ersek
@ 2020-05-11 22:12 ` Laszlo Ersek
0 siblings, 0 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-11 22:12 UTC (permalink / raw)
To: devel, cheptsov
On 05/11/20 22:58, Laszlo Ersek wrote:
> On 05/11/20 17:41, Vitaly Cheptsov wrote:
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>>
>> This bit allows to control assertion on constrain violation.
(1) Ugh, sorry, my point (1) was going to be about out two instances of
the same typo:
s/constrain/constraint/
in (a) the commit message, and (b) in the ASSERT_CONSTRAINT macro's
documentation, below.
Thanks & sorry for the mixup
Laszlo
>>
>> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
>> ---
>> MdePkg/Include/Library/DebugCommonLib.h | 18 ++++++++++++++++++
>> MdePkg/Include/Library/DebugLib.h | 18 ++++++++++++++++++
>> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c | 20 ++++++++++++++++++++
>> MdePkg/MdePkg.dec | 3 ++-
>> 4 files changed, 58 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdePkg/Include/Library/DebugCommonLib.h b/MdePkg/Include/Library/DebugCommonLib.h
>> index 31249f91fa..3dc906d02a 100644
>> --- a/MdePkg/Include/Library/DebugCommonLib.h
>> +++ b/MdePkg/Include/Library/DebugCommonLib.h
>> @@ -21,6 +21,7 @@
>> #define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08
>> #define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10
>> #define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20
>> +#define DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED 0x40
>>
>> //
>> // Declare bits for PcdDebugPrintErrorLevel and the ErrorLevel parameter of DebugPrint()
>> @@ -135,6 +136,23 @@ DebugClearMemoryEnabled (
>> );
>>
>>
>> +/**
>> + Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
>> +
>> + This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
>> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
>> +
>> + @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
>> + @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
>> +
>> +**/
>> +BOOLEAN
>> +EFIAPI
>> +DebugAssertConstraintEnabled (
>> + VOID
>> + );
>> +
>> +
>> /**
>> Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
>>
>> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
>> index a38e0e2904..ea38522ae3 100644
>> --- a/MdePkg/Include/Library/DebugLib.h
>> +++ b/MdePkg/Include/Library/DebugLib.h
>> @@ -212,6 +212,24 @@ DebugClearMemory (
>> #define ASSERT(Expression)
>> #endif
>>
>> +
>> +/**
>> + Macro that calls ASSERT when constrain assertions are enabled.
>> +
>> + If DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set,
>> + then this macro evaluates to an ASSERT macro passing in the original Expression.
>> +
>> + @param Expression Boolean expression.
>> +
>> +**/
>> +#define ASSERT_CONSTRAINT(Expression) \
>> + do { \
>> + if (DebugAssertConstraintEnabled ()) { \
>> + ASSERT (Expression); \
>> + } \
>> + } while (FALSE)
>> +
>> +
>> /**
>> Macro that calls DebugPrint().
>>
>> diff --git a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
>> index 2291fb5382..870f9ceec5 100644
>> --- a/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
>> +++ b/MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
>> @@ -93,6 +93,26 @@ DebugClearMemoryEnabled (
>> }
>>
>>
>> +/**
>> + Returns TRUE if ASSERT_CONSTRAINT() macro is enabled.
>> +
>> + This function returns TRUE if the DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of
>> + PcdDebugProperyMask is set. Otherwise, FALSE is returned.
>> +
>> + @retval TRUE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is set.
>> + @retval FALSE The DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED bit of PcdDebugProperyMask is clear.
>> +
>> +**/
>> +BOOLEAN
>> +EFIAPI
>> +DebugAssertConstraintEnabled (
>> + VOID
>> + )
>> +{
>> + return (BOOLEAN) ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_CONSTRAINT_ENABLED) != 0);
>> +}
>> +
>> +
>> /**
>> Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
>>
>> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
>> index a121b9ecab..63003357d6 100644
>> --- a/MdePkg/MdePkg.dec
>> +++ b/MdePkg/MdePkg.dec
>> @@ -2136,9 +2136,10 @@ [PcdsFixedAtBuild,PcdsPatchableInModule]
>> # BIT3 - Enable Clear Memory.<BR>
>> # BIT4 - Enable BreakPoint as ASSERT.<BR>
>> # BIT5 - Enable DeadLoop as ASSERT.<BR>
>> + # BIT6 - Treat constrait violations as ASSERT.<BR>
>> # @Prompt Debug Property.
>> # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
>> - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
>> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000045
>>
>> ## This flag is used to control the print out Debug message.<BR><BR>
>> # BIT0 - Initialization message.<BR>
>>
>
> (2) The "MdePkg/MdePkg.uni" file update from patch#1 belongs here, IMO.
>
> Otherwise, the patch looks OK to me.
>
> Thanks
> Laszlo
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
` (26 preceding siblings ...)
2020-05-11 15:41 ` [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString Vitaly Cheptsov
@ 2020-05-11 22:40 ` Michael D Kinney
2020-05-12 9:50 ` Laszlo Ersek
27 siblings, 1 reply; 48+ messages in thread
From: Michael D Kinney @ 2020-05-11 22:40 UTC (permalink / raw)
To: Vitaly Cheptsov, devel@edk2.groups.io, Kinney, Michael D
Cc: Andrew Fish, Marvin Häuser, Gao, Liming, Gao, Zhichao,
Laszlo Ersek
Vitaly,
Thank you for the contribution.
There are a couple points about this approach that need to be discussed.
You have included the <Library/DebugCommonLib.h> from
MdePkg/Include/Library/DebugLib.h. It is very rare for a
lib class to include another lib class. This means that a module
that has a dependency on the DebugLib class inherits a hidden
dependency on the DebugCommonLib class. For module INF files,
we require the INF file to list all the lib classes that the
module sources directly use. Since a module that uses the
DebugLib uses the ASSERT() and DEBUG() macros, all the APIs
that the ASSERT() and DEBUG() macros use are also directly
used by the module. With this patch series, these macros
now use the DebugCommonLib class APIs, which means any module
that uses the DebugLib also directly uses the DebugCommonLib.
The INF files for all modules that use the DebugLib should
also be updated to list the DebugCommonLib. If we go down
that path, then it would be cleaner for the modules to include
both DebugLib.h and DebugCommonLib.h so the list of includes
matches the list of lib classes in the INF file. This would
be an even much larger change than the patch series already
under review.
I think there is general agreement that the ASSERT_CONSTRAINT()
feature is valuable, and the sticking point has been the
complexity of the change and the impact to the existing modules
and platforms.
In order to address the original problem statement and
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
Perhaps we should go back to the original proposal that
adds one new PCD so the string APIs in the BaseLib can
filter out ASSERT() conditions for UEFI Applications that
want return status behavior without ASSERT() behavior.
The work on this patch series and the other proposals have
all been very valuable and we can continue to look for ways
to implement the general purpose ASSERT_CONSTRAINT() without
so many module and platform side effects.
Thanks,
Mike
> -----Original Message-----
> From: Vitaly Cheptsov <cheptsov@ispras.ru>
> Sent: Monday, May 11, 2020 8:41 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish <afish@apple.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Marvin Häuser
> <mhaeuser@outlook.de>; Gao, Liming
> <liming.gao@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>; Laszlo Ersek
> <lersek@redhat.com>
> Subject: [PATCH V4 00/27] Disabling safe string
> constraint assertions
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Mike Kinney <michael.d.kinney@intel.com>
> Cc: Marvin Häuser <mhaeuser@outlook.de>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> CC: Laszlo Ersek <lersek@redhat.com>
>
> This changesest hopefully finally resolves the
> longstanding
> https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Requesting to merge into edk2-stable202005.
>
> Vitaly Cheptsov (27):
> MdePkg: Introduce DebugCommonLib interface and
> BaseDebugCommonLib
> UnitTestFrameworkPkg: Add support for DebugCommonLib
> MdePkg: Add support for DebugCommonLib
> MdeModulePkg: Add support for DebugCommonLib
> ArmPkg: Add support for DebugCommonLib
> ArmPlatformPkg: Add support for DebugCommonLib
> ArmVirtPkg: Add support for DebugCommonLib
> CryptoPkg: Add support for DebugCommonLib
> DynamicTablesPkg: Add support for DebugCommonLib
> EmbeddedPkg: Add support for DebugCommonLib
> EmulatorPkg: Add support for DebugCommonLib
> FatPkg: Add support for DebugCommonLib
> FmpDevicePkg: Add support for DebugCommonLib
> IntelFsp2Pkg: Add support for DebugCommonLib
> IntelFsp2WrapperPkg: Add support for DebugCommonLib
> OvmfPkg: Add support for DebugCommonLib
> NetworkPkg: Add support for DebugCommonLib
> ShellPkg: Add support for DebugCommonLib
> SecurityPkg: Add support for DebugCommonLib
> PcAtChipsetPkg: Add support for DebugCommonLib
> SignedCapsulePkg: Add support for DebugCommonLib
> SourceLevelDebugPkg: Add support for DebugCommonLib
> StandaloneMmPkg: Add support for DebugCommonLib
> UefiCpuPkg: Add support for DebugCommonLib
> UefiPayloadPkg: Add support for DebugCommonLib
> MdePkg: Introduce assertion on constraint debug mask
> bit
> MdePkg: Use assertion on constraint violation bit in
> SafeString
>
> ArmPkg/ArmPkg.dsc
> | 1 +
> ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.dsc
> | 1 +
> ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
> | 84 ----------
>
> ArmPkg/Library/SemiHostingDebugLib/SemiHostingDebugLib.
> inf | 3 +-
> ArmPlatformPkg/ArmPlatformPkg.dsc
> | 1 +
> ArmVirtPkg/ArmVirt.dsc.inc
> | 1 +
> CryptoPkg/CryptoPkg.dsc
> | 2 +
> DynamicTablesPkg/DynamicTablesPkg.dsc
> | 1 +
> EmbeddedPkg/EmbeddedPkg.dsc
> | 1 +
> EmulatorPkg/EmulatorPkg.dsc
> | 1 +
> FatPkg/FatPkg.dsc
> | 1 +
> FmpDevicePkg/FmpDevicePkg.dsc
> | 1 +
> IntelFsp2Pkg/IntelFsp2Pkg.dsc
> | 1 +
>
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspD
> ebugLibSerialPort.inf | 1 +
>
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib
> .c | 97 -----------
> IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> | 1 +
> MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
> | 100 ------------
>
> MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDeb
> ugPpi.inf | 1 +
>
> MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/Deb
> ugLib.c | 98 -----------
>
> MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/Pei
> DxeDebugLibReportStatusCode.inf | 1 +
> MdeModulePkg/MdeModulePkg.dsc
> | 1 +
> MdePkg/Include/Library/BaseLib.h
> | 120 +++++++-------
> MdePkg/Include/Library/DebugCommonLib.h
> | 172 ++++++++++++++++++++
> MdePkg/Include/Library/DebugLib.h
> | 155 +++---------------
>
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.in
> f | 39 +++++
>
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.un
> i | 16 ++
> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
> | 133 +++++++++++++++
> MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> | 10 ++
> MdePkg/Library/BaseDebugLibNull/DebugLib.c
> | 98 -----------
>
> MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSeria
> lPort.inf | 1 +
> MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
> | 98 -----------
> MdePkg/Library/BaseLib/BaseLib.inf
> | 1 +
> MdePkg/Library/BaseLib/SafeString.c
> | 2 +-
> MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
> | 98 -----------
>
> MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeD
> ebugLibSerialPort.inf | 1 +
> MdePkg/Library/UefiDebugLibConOut/DebugLib.c
> | 98 -----------
>
> MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.in
> f | 1 +
>
> MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
> | 99 -----------
>
> MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugL
> ibDebugPortProtocol.inf | 1 +
> MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
> | 98 -----------
>
> MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.in
> f | 1 +
> MdePkg/MdePkg.dec
> | 6 +-
> MdePkg/MdePkg.dsc
> | 1 +
> MdePkg/MdePkg.uni
> | 3 +-
> NetworkPkg/NetworkPkg.dsc
> | 1 +
> OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> | 98 -----------
>
> OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebug
> LibIoPort.inf | 1 +
> OvmfPkg/OvmfPkgIa32.dsc
> | 1 +
> OvmfPkg/OvmfPkgIa32X64.dsc
> | 1 +
> OvmfPkg/OvmfPkgX64.dsc
> | 1 +
> OvmfPkg/OvmfXen.dsc
> | 1 +
> PcAtChipsetPkg/PcAtChipsetPkg.dsc
> | 1 +
> SecurityPkg/SecurityPkg.dsc
> | 1 +
> ShellPkg/ShellPkg.dsc
> | 1 +
> SignedCapsulePkg/SignedCapsulePkg.dsc
> | 1 +
> SourceLevelDebugPkg/SourceLevelDebugPkg.dsc
> | 1 +
> StandaloneMmPkg/StandaloneMmPkg.dsc
> | 1 +
> UefiCpuPkg/UefiCpuPkg.dsc
> | 1 +
> UefiPayloadPkg/UefiPayloadPkgIa32.dsc
> | 1 +
> UefiPayloadPkg/UefiPayloadPkgIa32X64.dsc
> | 1 +
>
> UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugL
> ibPosix.c | 94 -----------
>
> UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugL
> ibPosix.inf | 1 +
> UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> | 1 +
>
> UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
> | 1 +
> 64 files changed, 501 insertions(+), 1360 deletions(-)
> create mode 100644
> MdePkg/Include/Library/DebugCommonLib.h
> create mode 100644
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.in
> f
> create mode 100644
> MdePkg/Library/BaseDebugCommonLib/BaseDebugCommonLib.un
> i
> create mode 100644
> MdePkg/Library/BaseDebugCommonLib/DebugCommonLib.c
>
> --
> 2.24.2 (Apple Git-127)
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 15/27] IntelFsp2WrapperPkg: Add support for DebugCommonLib
2020-05-11 15:41 ` [PATCH V4 15/27] IntelFsp2WrapperPkg: " Vitaly Cheptsov
@ 2020-05-12 0:47 ` Chiu, Chasel
0 siblings, 0 replies; 48+ messages in thread
From: Chiu, Chasel @ 2020-05-12 0:47 UTC (permalink / raw)
To: devel@edk2.groups.io, cheptsov@ispras.ru
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Vitaly
> Cheptsov
> Sent: Monday, May 11, 2020 11:41 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH V4 15/27] IntelFsp2WrapperPkg: Add support
> for DebugCommonLib
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> index cb4f69285d..b84de7cf70 100644
> --- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> +++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc
> @@ -22,6 +22,7 @@ [LibraryClasses]
> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf+
> DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCom
> monLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Base
> DebugPrintErrorLevelLib.inf
> PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf--
> 2.24.2 (Apple Git-127)
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
>
> View/Reply Online (#59114): https://edk2.groups.io/g/devel/message/59114
> Mute This Topic: https://groups.io/mt/74138548/1777047
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.chiu@intel.com]
> -=-=-=-=-=-=
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 14/27] IntelFsp2Pkg: Add support for DebugCommonLib
2020-05-11 15:41 ` [PATCH V4 14/27] IntelFsp2Pkg: " Vitaly Cheptsov
@ 2020-05-12 0:49 ` Chiu, Chasel
0 siblings, 0 replies; 48+ messages in thread
From: Chiu, Chasel @ 2020-05-12 0:49 UTC (permalink / raw)
To: devel@edk2.groups.io, cheptsov@ispras.ru
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Vitaly
> Cheptsov
> Sent: Monday, May 11, 2020 11:41 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH V4 14/27] IntelFsp2Pkg: Add support for
> DebugCommonLib
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054
>
> Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
> ---
> IntelFsp2Pkg/IntelFsp2Pkg.dsc
> | 1 +
>
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.
> inf | 1 +
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> | 97 --------------------
> 3 files changed, 2 insertions(+), 97 deletions(-)
>
> diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> index 02fe9cb188..3b2d2a5b8a 100644
> --- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> @@ -21,6 +21,7 @@ [LibraryClasses]
> BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf+
> DebugCommonLib|MdePkg/Library/BaseDebugCommonLib/BaseDebugCom
> monLib.inf
> DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/Base
> DebugPrintErrorLevelLib.inf
> PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
> IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.infdiff --git
> a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPo
> rt.inf
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPo
> rt.inf
> index 14b1899e6c..c708386677 100644
> ---
> a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPo
> rt.inf
> +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSeri
> +++ alPort.inf
> @@ -35,6 +35,7 @@ [LibraryClasses]
> PcdLib PrintLib BaseLib+ DebugCommonLib DebugDeviceLib
> DebugPrintErrorLevelLib diff --git
> a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> index b34905365d..f2e1de8822 100644
> --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> @@ -316,100 +316,3 @@ DebugClearMemory (
> { return Buffer; }---/**- Returns TRUE if ASSERT() macros are enabled.--
> This function returns TRUE if the
> DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of-
> PcdDebugPropertyMask is set. Otherwise FALSE is returned.-- @retval
> TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
> PcdDebugPropertyMask is set.- @retval FALSE The
> DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugPropertyMask
> is clear.--**/-BOOLEAN-EFIAPI-DebugAssertEnabled (- VOID- )-{- return
> (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) &
> DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);-}---/**- Returns TRUE
> if DEBUG() macros are enabled.-- This function returns TRUE if the
> DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of-
> PcdDebugPropertyMask is set. Otherwise FALSE is returned.-- @retval
> TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
> PcdDebugPropertyMask is set.- @retval FALSE The
> DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugPropertyMask is
> clear.--**/-BOOLEAN-EFIAPI-DebugPrintEnabled (- VOID- )-{- return
> (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) &
> DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);-}--/**- Returns TRUE if
> DEBUG_CODE() macros are enabled.-- This function returns TRUE if the
> DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of- PcdDebugPropertyMask
> is set. Otherwise FALSE is returned.-- @retval TRUE The
> DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugPropertyMask is
> set.- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED
> bit of PcdDebugPropertyMask is
> clear.--**/-BOOLEAN-EFIAPI-DebugCodeEnabled (- VOID- )-{- return
> (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) &
> DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);-}---/**- Returns TRUE if
> DEBUG_CLEAR_MEMORY() macro is enabled.-- This function returns TRUE
> if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of-
> PcdDebugPropertyMask is set. Otherwise FALSE is returned.-- @retval
> TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> PcdDebugPropertyMask is set.- @retval FALSE The
> DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
> PcdDebugPropertyMask is
> clear.--**/-BOOLEAN-EFIAPI-DebugClearMemoryEnabled (- VOID- )-{-
> return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) &
> DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);-}--/**- Returns TRUE
> if any one of the bit is set both in ErrorLevel and
> PcdFixedDebugPrintErrorLevel.-- This function compares the bit mask of
> ErrorLevel and PcdFixedDebugPrintErrorLevel.-- @retval TRUE
> Current ErrorLevel is supported.- @retval FALSE Current ErrorLevel is
> not supported.--**/-BOOLEAN-EFIAPI-DebugPrintLevelEnabled (- IN
> CONST UINTN ErrorLevel- )-{- return (BOOLEAN) ((ErrorLevel &
> PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);-}--
> 2.24.2 (Apple Git-127)
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
>
> View/Reply Online (#59113): https://edk2.groups.io/g/devel/message/59113
> Mute This Topic: https://groups.io/mt/74138546/1777047
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.chiu@intel.com]
> -=-=-=-=-=-=
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-11 22:40 ` [PATCH V4 00/27] Disabling safe string constraint assertions Michael D Kinney
@ 2020-05-12 9:50 ` Laszlo Ersek
2020-05-12 17:03 ` Vitaly Cheptsov
2020-05-12 18:18 ` [edk2-devel] " Michael D Kinney
0 siblings, 2 replies; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-12 9:50 UTC (permalink / raw)
To: Kinney, Michael D, Vitaly Cheptsov, devel@edk2.groups.io
Cc: Andrew Fish, Marvin Häuser, Gao, Liming, Gao, Zhichao
On 05/12/20 00:40, Kinney, Michael D wrote:
> Vitaly,
>
> Thank you for the contribution.
>
> There are a couple points about this approach that need to be discussed.
>
> You have included the <Library/DebugCommonLib.h> from
> MdePkg/Include/Library/DebugLib.h.
Right, I've noticed it. I agree it's unusual. I didn't think it was wrong.
> It is very rare for a
> lib class to include another lib class. This means that a module
> that has a dependency on the DebugLib class inherits a hidden
> dependency on the DebugCommonLib class.
I agree.
I think it should be fine. Any header H1 should include such further
headers H2, H3, ... Hn that are required for making the interfaces
declared in H1 usable in client modules.
> For module INF files,
> we require the INF file to list all the lib classes that the
> module sources directly use.
Yes, keyword being "directly".
> Since a module that uses the
> DebugLib uses the ASSERT() and DEBUG() macros, all the APIs
> that the ASSERT() and DEBUG() macros use are also directly
> used by the module.
I believe this is where I disagree. The replacement texts of the
ASSERT() and DEBUG() function-like macros are internals of the
DebugLib.h lib class header, in my opinion. Those internals place
requirements on specific DebugLib instances, not on DebugLib class
consumers.
In other words, when writing a new DebugLib instance, the implementor
has to ensure that the ASSERT() and DEBUG() macros, as defined in the
DebugLib class header, will continue working in DebugLib consumer
modules. The implementor may then choose to make the new DebugLib
instance dependent on the (singleton) DebugCommonLib instance, for
example. (This is being done in patches #3, #4, #16, maybe more.) The
DebugLib consumer module will inherit that dependency, and everything
will work.
Just because ASSERT() and DEBUG() are function-like macros and not
actual functions, I don't think the INF file requirements in
DebugLib-consumer modules should change.
> With this patch series, these macros
> now use the DebugCommonLib class APIs, which means any module
> that uses the DebugLib also directly uses the DebugCommonLib.
In my opinion: indirectly.
Thanks,
Laszlo
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-12 9:50 ` Laszlo Ersek
@ 2020-05-12 17:03 ` Vitaly Cheptsov
2020-05-12 18:18 ` [edk2-devel] " Michael D Kinney
1 sibling, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-12 17:03 UTC (permalink / raw)
To: Kinney, Michael D, Laszlo Ersek
Cc: devel@edk2.groups.io, Andrew Fish, Marvin Häuser,
Gao, Liming, Gao, Zhichao
[-- Attachment #1.1: Type: text/plain, Size: 7892 bytes --]
Hello everyone,
Let me try in order.
After an internal review I added the following to SafeString commit message:
Note, for packages with constraint assertions disabled this change
turn off the assertions on constraint violations.
This is obvious, and I believe everyone agreed it is not healthy except for some private packages but I guess it is worth mentioning, so that it is cared in these private packages as necessary.
The latest version of the changes is on GitHub branch (https://github.com/vit9696/edk2/tree/constraint <https://github.com/vit9696/edk2/tree/constraint>). I also resubmitted the V5 of the patchset including all the requested changes.
> You have included the <Library/DebugCommonLib.h> from
> MdePkg/Include/Library/DebugLib.h. It is very rare for a
> lib class to include another lib class. This means that a module
> that has a dependency on the DebugLib class inherits a hidden
> dependency on the DebugCommonLib class. For module INF files,
> we require the INF file to list all the lib classes that the
> module sources directly use. Since a module that uses the
> DebugLib uses the ASSERT() and DEBUG() macros, all the APIs
> that the ASSERT() and DEBUG() macros use are also directly
> used by the module. With this patch series, these macros
> now use the DebugCommonLib class APIs, which means any module
> that uses the DebugLib also directly uses the DebugCommonLib.
> The INF files for all modules that use the DebugLib should
> also be updated to list the DebugCommonLib. If we go down
> that path, then it would be cleaner for the modules to include
> both DebugLib.h and DebugCommonLib.h so the list of includes
> matches the list of lib classes in the INF file. This would
> be an even much larger change than the patch series already
> under review.
I do not think it is unusual to include one library header from the other. That’s what we regularly do in our code. I also do not agree that we need to add a dependency on a library consumed by the other library. This is an indirect dependency. Just like Laszlo says.
> In order to address the original problem statement and
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2054 <https://bugzilla.tianocore.org/show_bug.cgi?id=2054>
> Perhaps we should go back to the original proposal that
> adds one new PCD so the string APIs in the BaseLib can
> filter out ASSERT() conditions for UEFI Applications that
> want return status behavior without ASSERT() behavior.
If you believe it is not possible to merge the current patch into May release, I am fine to submit a small change that will add a PCD to protect SafeString. However, I am not very happy about it as it may take a considerable amount of time to get rid of this PCD in the future, and we (and likely other people) will have to change the code multiple times. I really want to resolve this sick situation with both BaseLib and DebugLib once and forever, as the need to change the hell of DebugLibs all over the place for a small thing is very very wrong.
> Note: unfortunately, the edk2-platforms tree contains a huge number of
> DebugLib class resolutions (124 resolutions in 48 files, at commit
> bfa32ac70a75), and I think the final patch in the present series will
> break those platforms unless you post patches for them too.
>
> IMO this is another good example why edk2-platforms should *not* exist
> as a separate repository.
I agree that separating edk2-platforms is very sick as well. I can send the patches on them too, but due to their amount (just like you said it will be almost half a hundred) I would rather make a branch and then just merge it. Same for EDK II (e.g. somewhere in edk2-staging). In addition to that is very hard for me to read the review of the patches by e-mails, and spamming the mailing list feels also not so great.
> (... Please consider adding Cc: tags to the commit messages, so that
> each patch email reaches the subject package owners directly too. Anyway
> that's for the future.)
Fixed.
> I think the very last hunk in this patch belongs in patch#26 ("MdePkg:
> Introduce assertion on constraint debug mask bit"), which is where BIT6
> is actually defined for PcdDebugPropertyMask.
> (2) The "MdePkg/MdePkg.uni" file update from patch#1 belongs here, IMO.
Fixed.
> I think the VALID_ARCHITECTURES comment should be dropped altogether.
>
> At least the current arch list "IA32 X64 EBC" is incorrect; first
> because ARM and AARCH64 are missing (despite the series -- correctly --
> patching Arm*Pkg and such), and second because -- I *think* -- EBC is no
> longer an arch natively supported by edk2. (Mike and Liming will correct
> me on that, if needed.)
Fixed.
> (1) The other two INF files in the same directory should get the same
> update. (I.e., a dependency on DebugCommonLib.)
Nice catch, fixed.
> (2) I believe it should be possible to remove
> "PcdFixedDebugPrintErrorLevel" from all three INF files in the same
> directory. (The only reference, which is being removed, is in
> DebugPrintLevelEnabled().)
This issue is common across the patches, fixed everywhere.
> (1) Ugh, sorry, my point (1) was going to be about out two instances of
> the same typo:
>
> s/constrain/constraint/
There also were a couple of cases with constrait. Fixed everything.
Best regards,
Vitaly
> 12 мая 2020 г., в 12:50, Laszlo Ersek <lersek@redhat.com> написал(а):
>
> On 05/12/20 00:40, Kinney, Michael D wrote:
>> Vitaly,
>>
>> Thank you for the contribution.
>>
>> There are a couple points about this approach that need to be discussed.
>>
>> You have included the <Library/DebugCommonLib.h> from
>> MdePkg/Include/Library/DebugLib.h.
>
> Right, I've noticed it. I agree it's unusual. I didn't think it was wrong.
>
>> It is very rare for a
>> lib class to include another lib class. This means that a module
>> that has a dependency on the DebugLib class inherits a hidden
>> dependency on the DebugCommonLib class.
>
> I agree.
>
> I think it should be fine. Any header H1 should include such further
> headers H2, H3, ... Hn that are required for making the interfaces
> declared in H1 usable in client modules.
>
>> For module INF files,
>> we require the INF file to list all the lib classes that the
>> module sources directly use.
>
> Yes, keyword being "directly".
>
>> Since a module that uses the
>> DebugLib uses the ASSERT() and DEBUG() macros, all the APIs
>> that the ASSERT() and DEBUG() macros use are also directly
>> used by the module.
>
> I believe this is where I disagree. The replacement texts of the
> ASSERT() and DEBUG() function-like macros are internals of the
> DebugLib.h lib class header, in my opinion. Those internals place
> requirements on specific DebugLib instances, not on DebugLib class
> consumers.
>
> In other words, when writing a new DebugLib instance, the implementor
> has to ensure that the ASSERT() and DEBUG() macros, as defined in the
> DebugLib class header, will continue working in DebugLib consumer
> modules. The implementor may then choose to make the new DebugLib
> instance dependent on the (singleton) DebugCommonLib instance, for
> example. (This is being done in patches #3, #4, #16, maybe more.) The
> DebugLib consumer module will inherit that dependency, and everything
> will work.
>
> Just because ASSERT() and DEBUG() are function-like macros and not
> actual functions, I don't think the INF file requirements in
> DebugLib-consumer modules should change.
>
>> With this patch series, these macros
>> now use the DebugCommonLib class APIs, which means any module
>> that uses the DebugLib also directly uses the DebugCommonLib.
>
> In my opinion: indirectly.
>
> Thanks,
> Laszlo
>
[-- Attachment #1.2: Type: text/html, Size: 18210 bytes --]
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-12 9:50 ` Laszlo Ersek
2020-05-12 17:03 ` Vitaly Cheptsov
@ 2020-05-12 18:18 ` Michael D Kinney
2020-05-12 18:57 ` Vitaly Cheptsov
2020-05-13 9:16 ` Laszlo Ersek
1 sibling, 2 replies; 48+ messages in thread
From: Michael D Kinney @ 2020-05-12 18:18 UTC (permalink / raw)
To: devel@edk2.groups.io, lersek@redhat.com, Vitaly Cheptsov,
Kinney, Michael D
Cc: Andrew Fish, Marvin Häuser, Gao, Liming, Gao, Zhichao
Laszlo,
A library implementation that uses another library class
lists those library classes in the library INF. This is
a way a module can inherit the use of a second lib without
listing the second lib in the module INF. This is the
type of inheritance that is supported by the EDK II build
system and the EDK II meta data files.
What is not supported today is indirect inheritance from
the libclass .h file itself. There is no mechanism for
the libclass .h file to declare it is using another library
class. This would require extensions to the meta data
files to declare this type dependency.
How does the build system know to add DebugCommonLib to
the link command for a module that only lists DebugLib
in its library classes section? What if there is a
DebugLib implementation of the DebugLib class that
does not depend on DebugCommonLib. The module link
will then fail when the module writer followed all the
rules. This is why including a libclass from another
libclass is bad idea.
Mike
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On
> Behalf Of Laszlo Ersek
> Sent: Tuesday, May 12, 2020 2:51 AM
> To: Kinney, Michael D <michael.d.kinney@intel.com>;
> Vitaly Cheptsov <cheptsov@ispras.ru>;
> devel@edk2.groups.io
> Cc: Andrew Fish <afish@apple.com>; Marvin Häuser
> <mhaeuser@outlook.de>; Gao, Liming
> <liming.gao@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling
> safe string constraint assertions
>
> On 05/12/20 00:40, Kinney, Michael D wrote:
> > Vitaly,
> >
> > Thank you for the contribution.
> >
> > There are a couple points about this approach that
> need to be discussed.
> >
> > You have included the <Library/DebugCommonLib.h> from
> > MdePkg/Include/Library/DebugLib.h.
>
> Right, I've noticed it. I agree it's unusual. I didn't
> think it was wrong.
>
> > It is very rare for a
> > lib class to include another lib class. This means
> that a module
> > that has a dependency on the DebugLib class inherits
> a hidden
> > dependency on the DebugCommonLib class.
>
> I agree.
>
> I think it should be fine. Any header H1 should include
> such further
> headers H2, H3, ... Hn that are required for making the
> interfaces
> declared in H1 usable in client modules.
>
> > For module INF files,
> > we require the INF file to list all the lib classes
> that the
> > module sources directly use.
>
> Yes, keyword being "directly".
>
> > Since a module that uses the
> > DebugLib uses the ASSERT() and DEBUG() macros, all
> the APIs
> > that the ASSERT() and DEBUG() macros use are also
> directly
> > used by the module.
>
> I believe this is where I disagree. The replacement
> texts of the
> ASSERT() and DEBUG() function-like macros are internals
> of the
> DebugLib.h lib class header, in my opinion. Those
> internals place
> requirements on specific DebugLib instances, not on
> DebugLib class
> consumers.
>
> In other words, when writing a new DebugLib instance,
> the implementor
> has to ensure that the ASSERT() and DEBUG() macros, as
> defined in the
> DebugLib class header, will continue working in
> DebugLib consumer
> modules. The implementor may then choose to make the
> new DebugLib
> instance dependent on the (singleton) DebugCommonLib
> instance, for
> example. (This is being done in patches #3, #4, #16,
> maybe more.) The
> DebugLib consumer module will inherit that dependency,
> and everything
> will work.
>
> Just because ASSERT() and DEBUG() are function-like
> macros and not
> actual functions, I don't think the INF file
> requirements in
> DebugLib-consumer modules should change.
>
> > With this patch series, these macros
> > now use the DebugCommonLib class APIs, which means
> any module
> > that uses the DebugLib also directly uses the
> DebugCommonLib.
>
> In my opinion: indirectly.
>
> Thanks,
> Laszlo
>
>
>
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-12 18:18 ` [edk2-devel] " Michael D Kinney
@ 2020-05-12 18:57 ` Vitaly Cheptsov
2020-05-13 17:59 ` Liming Gao
2020-05-13 9:16 ` Laszlo Ersek
1 sibling, 1 reply; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-12 18:57 UTC (permalink / raw)
To: Kinney, Michael D, lersek@redhat.com
Cc: devel@edk2.groups.io, Andrew Fish, Marvin Häuser,
Gao, Liming, Gao, Zhichao
[-- Attachment #1: Type: text/plain, Size: 4742 bytes --]
Mike,
I see what you mean here, but I believe it is absolutely fine to implement DebugCommonLib.h interface within DebugLib without depending on DebugCommonLib if one absolutely desires it (thought I do not think it is a good idea).
In this case, perhaps we can avoid adding DebugCommonLib.h header at all and leave it all in DebugLib.h?
So that DebugCommonLib library is entirely private thing to DebugLib, which can either use it or not.
Best wishes,
Vitaly
> 12 мая 2020 г., в 21:18, Kinney, Michael D <michael.d.kinney@intel.com> написал(а):
>
> Laszlo,
>
> A library implementation that uses another library class
> lists those library classes in the library INF. This is
> a way a module can inherit the use of a second lib without
> listing the second lib in the module INF. This is the
> type of inheritance that is supported by the EDK II build
> system and the EDK II meta data files.
>
> What is not supported today is indirect inheritance from
> the libclass .h file itself. There is no mechanism for
> the libclass .h file to declare it is using another library
> class. This would require extensions to the meta data
> files to declare this type dependency.
>
> How does the build system know to add DebugCommonLib to
> the link command for a module that only lists DebugLib
> in its library classes section? What if there is a
> DebugLib implementation of the DebugLib class that
> does not depend on DebugCommonLib. The module link
> will then fail when the module writer followed all the
> rules. This is why including a libclass from another
> libclass is bad idea.
>
> Mike
>
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On
>> Behalf Of Laszlo Ersek
>> Sent: Tuesday, May 12, 2020 2:51 AM
>> To: Kinney, Michael D <michael.d.kinney@intel.com>;
>> Vitaly Cheptsov <cheptsov@ispras.ru>;
>> devel@edk2.groups.io
>> Cc: Andrew Fish <afish@apple.com>; Marvin Häuser
>> <mhaeuser@outlook.de>; Gao, Liming
>> <liming.gao@intel.com>; Gao, Zhichao
>> <zhichao.gao@intel.com>
>> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling
>> safe string constraint assertions
>>
>> On 05/12/20 00:40, Kinney, Michael D wrote:
>>> Vitaly,
>>>
>>> Thank you for the contribution.
>>>
>>> There are a couple points about this approach that
>> need to be discussed.
>>>
>>> You have included the <Library/DebugCommonLib.h> from
>>> MdePkg/Include/Library/DebugLib.h.
>>
>> Right, I've noticed it. I agree it's unusual. I didn't
>> think it was wrong.
>>
>>> It is very rare for a
>>> lib class to include another lib class. This means
>> that a module
>>> that has a dependency on the DebugLib class inherits
>> a hidden
>>> dependency on the DebugCommonLib class.
>>
>> I agree.
>>
>> I think it should be fine. Any header H1 should include
>> such further
>> headers H2, H3, ... Hn that are required for making the
>> interfaces
>> declared in H1 usable in client modules.
>>
>>> For module INF files,
>>> we require the INF file to list all the lib classes
>> that the
>>> module sources directly use.
>>
>> Yes, keyword being "directly".
>>
>>> Since a module that uses the
>>> DebugLib uses the ASSERT() and DEBUG() macros, all
>> the APIs
>>> that the ASSERT() and DEBUG() macros use are also
>> directly
>>> used by the module.
>>
>> I believe this is where I disagree. The replacement
>> texts of the
>> ASSERT() and DEBUG() function-like macros are internals
>> of the
>> DebugLib.h lib class header, in my opinion. Those
>> internals place
>> requirements on specific DebugLib instances, not on
>> DebugLib class
>> consumers.
>>
>> In other words, when writing a new DebugLib instance,
>> the implementor
>> has to ensure that the ASSERT() and DEBUG() macros, as
>> defined in the
>> DebugLib class header, will continue working in
>> DebugLib consumer
>> modules. The implementor may then choose to make the
>> new DebugLib
>> instance dependent on the (singleton) DebugCommonLib
>> instance, for
>> example. (This is being done in patches #3, #4, #16,
>> maybe more.) The
>> DebugLib consumer module will inherit that dependency,
>> and everything
>> will work.
>>
>> Just because ASSERT() and DEBUG() are function-like
>> macros and not
>> actual functions, I don't think the INF file
>> requirements in
>> DebugLib-consumer modules should change.
>>
>>> With this patch series, these macros
>>> now use the DebugCommonLib class APIs, which means
>> any module
>>> that uses the DebugLib also directly uses the
>> DebugCommonLib.
>>
>> In my opinion: indirectly.
>>
>> Thanks,
>> Laszlo
>>
>>
>>
>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-12 18:18 ` [edk2-devel] " Michael D Kinney
2020-05-12 18:57 ` Vitaly Cheptsov
@ 2020-05-13 9:16 ` Laszlo Ersek
2020-05-13 14:41 ` [EXTERNAL] " Bret Barkelew
1 sibling, 1 reply; 48+ messages in thread
From: Laszlo Ersek @ 2020-05-13 9:16 UTC (permalink / raw)
To: Kinney, Michael D, devel@edk2.groups.io, Vitaly Cheptsov
Cc: Andrew Fish, Marvin Häuser, Gao, Liming, Gao, Zhichao
Hi Mike,
On 05/12/20 20:18, Kinney, Michael D wrote:
> What if there is a
> DebugLib implementation of the DebugLib class that
> does not depend on DebugCommonLib.
There need not be a link failure in this case either, if the DebugLib
instance in question provides the DebugCommonLib API implementations too.
Anyway I don't want to obsess about this. I'm just sad there are zero
acceptable solutions apparently to the 100% valid problem statement that
Vitaly submitted last August, in TianoCore#2054. (Asserting properties
of untrusted external data is *asinine*.) But then, if Vitaly proposes
to update all DebugLib instances one by one, that gets shot down because
"too many DebugLib instances in platforms". And if Vitaly extracts the
common bits so that only the common bits have to be updated, that gets
shot down by "we don't support this kind of dependency, please update
all DebugLib instances instead".
Let's just be honest and call DebugLib frozen forever.
Laszlo
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [EXTERNAL] Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-13 9:16 ` Laszlo Ersek
@ 2020-05-13 14:41 ` Bret Barkelew
2020-05-13 20:14 ` Brian J. Johnson
0 siblings, 1 reply; 48+ messages in thread
From: Bret Barkelew @ 2020-05-13 14:41 UTC (permalink / raw)
To: devel@edk2.groups.io, lersek@redhat.com, Kinney, Michael D,
Vitaly Cheptsov
Cc: Andrew Fish, Marvin Häuser, liming.gao, Gao, Zhichao
[-- Attachment #1: Type: text/plain, Size: 1739 bytes --]
Ooooo. Does that mean we get to start on DebugLibEx?
In all seriousness, I’m also in the camp of “can’t we just drop these assertions”?
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Laszlo Ersek via groups.io <lersek=redhat.com@groups.io>
Sent: Wednesday, May 13, 2020 2:16:12 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Vitaly Cheptsov <cheptsov@ispras.ru>
Cc: Andrew Fish <afish@apple.com>; Marvin Häuser <mhaeuser@outlook.de>; liming.gao <liming.gao@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
Hi Mike,
On 05/12/20 20:18, Kinney, Michael D wrote:
> What if there is a
> DebugLib implementation of the DebugLib class that
> does not depend on DebugCommonLib.
There need not be a link failure in this case either, if the DebugLib
instance in question provides the DebugCommonLib API implementations too.
Anyway I don't want to obsess about this. I'm just sad there are zero
acceptable solutions apparently to the 100% valid problem statement that
Vitaly submitted last August, in TianoCore#2054. (Asserting properties
of untrusted external data is *asinine*.) But then, if Vitaly proposes
to update all DebugLib instances one by one, that gets shot down because
"too many DebugLib instances in platforms". And if Vitaly extracts the
common bits so that only the common bits have to be updated, that gets
shot down by "we don't support this kind of dependency, please update
all DebugLib instances instead".
Let's just be honest and call DebugLib frozen forever.
Laszlo
[-- Attachment #2: Type: text/html, Size: 2596 bytes --]
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-12 18:57 ` Vitaly Cheptsov
@ 2020-05-13 17:59 ` Liming Gao
2020-05-13 18:37 ` Vitaly Cheptsov
0 siblings, 1 reply; 48+ messages in thread
From: Liming Gao @ 2020-05-13 17:59 UTC (permalink / raw)
To: Vitaly Cheptsov, Kinney, Michael D, lersek@redhat.com
Cc: devel@edk2.groups.io, Andrew Fish, Marvin Häuser,
Gao, Zhichao
Vitaly:
I would like to propose one solution to update DebugLib.h only. This solution directly declares PcdDebugPropertyMask global variable in DebugLib.h. Then, DebugLib macro can use it. Because most of DebugLib library instances describe PcdDebugPropertyMask in their INF, this PCD can be generated without the additional change. I also evaluate PcdDebugPropertyMask usage in existing platform. This PCD is always used as FixedAtBuild. So, I change PcdDebugPropertyMask type in DEC to FixedAtBuild. This change impact should be smaller than current patch set. Below patch passes the build on OvmfPkg. It should work.
Besides, new PcdDebugPropertyMask BIT6 for Treat constraint violations as ASSERT. This BIT should be enabled by default to be compatible with current platform. Now, most platforms set this PCD PcdDebugPropertyMask in their platform DSC file. PCD value is also required to be updated. Another compatible way is to define BIT6 for Treat constraint violations as empty. When BIT6 is 1, it means constraint violation as empty. When BIT6 is 0, it means constraint violation as ASSERT. If so, this PCD value is not required to be changed in platform DSC.
Thanks
Liming
---
MdePkg/Include/Library/DebugLib.h | 7 ++++++-
.../Library/BaseDebugLibNull/BaseDebugLibNull.inf | 4 ++++
MdePkg/MdePkg.dec | 22 +++++++++++-----------
3 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
index baab34bf05..68604de869 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -321,6 +321,11 @@ DebugPrintLevelEnabled (
#define _DEBUG(Expression) DebugPrint Expression
#endif
+//
+// FixedAtBuild PCD value PcdDebugPropertyMask
+//
+extern const UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask;
+
/**
Macro that calls DebugAssert() if an expression evaluates to FALSE.
@@ -336,7 +341,7 @@ DebugPrintLevelEnabled (
#if !defined(MDEPKG_NDEBUG)
#define ASSERT(Expression) \
do { \
- if (DebugAssertEnabled ()) { \
+ if ((DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED & _gPcd_FixedAtBuild_PcdDebugPropertyMask) != 0) { \
if (!(Expression)) { \
_ASSERT (Expression); \
ANALYZER_UNREACHABLE (); \
diff --git a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
index 81a63a5074..1e95a2f077 100644
--- a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+++ b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
@@ -29,3 +29,7 @@
[Packages]
MdePkg/MdePkg.dec
+[Pcd]
+ # This PCD is consumed in DebugLib.h
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
+
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 0ab09195c1..f8aacdf428 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2105,6 +2105,17 @@
# @Prompt Speculation Barrier Type.
gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x30001018
+ ## The mask is used to control DebugLib behavior.<BR><BR>
+ # BIT0 - Enable Debug Assert.<BR>
+ # BIT1 - Enable Debug Print.<BR>
+ # BIT2 - Enable Debug Code.<BR>
+ # BIT3 - Enable Clear Memory.<BR>
+ # BIT4 - Enable BreakPoint as ASSERT.<BR>
+ # BIT5 - Enable DeadLoop as ASSERT.<BR>
+ # @Prompt Debug Property.
+ # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
+
[PcdsFixedAtBuild,PcdsPatchableInModule]
## Indicates the maximum length of unicode string used in the following
# BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()<BR><BR>
@@ -2139,17 +2150,6 @@
# @Prompt Spin Lock Timeout (us).
gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004
- ## The mask is used to control DebugLib behavior.<BR><BR>
- # BIT0 - Enable Debug Assert.<BR>
- # BIT1 - Enable Debug Print.<BR>
- # BIT2 - Enable Debug Code.<BR>
- # BIT3 - Enable Clear Memory.<BR>
- # BIT4 - Enable BreakPoint as ASSERT.<BR>
- # BIT5 - Enable DeadLoop as ASSERT.<BR>
- # @Prompt Debug Property.
- # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
-
## This flag is used to control the print out Debug message.<BR><BR>
# BIT0 - Initialization message.<BR>
# BIT1 - Warning message.<BR>
--
Thanks
Liming
> -----Original Message-----
> From: Vitaly Cheptsov <cheptsov@ispras.ru>
> Sent: Wednesday, May 13, 2020 2:58 AM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; lersek@redhat.com
> Cc: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Marvin Häuser <mhaeuser@outlook.de>; Gao, Liming
> <liming.gao@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
>
> Mike,
>
> I see what you mean here, but I believe it is absolutely fine to implement DebugCommonLib.h interface within DebugLib without
> depending on DebugCommonLib if one absolutely desires it (thought I do not think it is a good idea).
> In this case, perhaps we can avoid adding DebugCommonLib.h header at all and leave it all in DebugLib.h?
> So that DebugCommonLib library is entirely private thing to DebugLib, which can either use it or not.
>
> Best wishes,
> Vitaly
>
> > 12 мая 2020 г., в 21:18, Kinney, Michael D <michael.d.kinney@intel.com> написал(а):
> >
> > Laszlo,
> >
> > A library implementation that uses another library class
> > lists those library classes in the library INF. This is
> > a way a module can inherit the use of a second lib without
> > listing the second lib in the module INF. This is the
> > type of inheritance that is supported by the EDK II build
> > system and the EDK II meta data files.
> >
> > What is not supported today is indirect inheritance from
> > the libclass .h file itself. There is no mechanism for
> > the libclass .h file to declare it is using another library
> > class. This would require extensions to the meta data
> > files to declare this type dependency.
> >
> > How does the build system know to add DebugCommonLib to
> > the link command for a module that only lists DebugLib
> > in its library classes section? What if there is a
> > DebugLib implementation of the DebugLib class that
> > does not depend on DebugCommonLib. The module link
> > will then fail when the module writer followed all the
> > rules. This is why including a libclass from another
> > libclass is bad idea.
> >
> > Mike
> >
> >> -----Original Message-----
> >> From: devel@edk2.groups.io <devel@edk2.groups.io> On
> >> Behalf Of Laszlo Ersek
> >> Sent: Tuesday, May 12, 2020 2:51 AM
> >> To: Kinney, Michael D <michael.d.kinney@intel.com>;
> >> Vitaly Cheptsov <cheptsov@ispras.ru>;
> >> devel@edk2.groups.io
> >> Cc: Andrew Fish <afish@apple.com>; Marvin Häuser
> >> <mhaeuser@outlook.de>; Gao, Liming
> >> <liming.gao@intel.com>; Gao, Zhichao
> >> <zhichao.gao@intel.com>
> >> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling
> >> safe string constraint assertions
> >>
> >> On 05/12/20 00:40, Kinney, Michael D wrote:
> >>> Vitaly,
> >>>
> >>> Thank you for the contribution.
> >>>
> >>> There are a couple points about this approach that
> >> need to be discussed.
> >>>
> >>> You have included the <Library/DebugCommonLib.h> from
> >>> MdePkg/Include/Library/DebugLib.h.
> >>
> >> Right, I've noticed it. I agree it's unusual. I didn't
> >> think it was wrong.
> >>
> >>> It is very rare for a
> >>> lib class to include another lib class. This means
> >> that a module
> >>> that has a dependency on the DebugLib class inherits
> >> a hidden
> >>> dependency on the DebugCommonLib class.
> >>
> >> I agree.
> >>
> >> I think it should be fine. Any header H1 should include
> >> such further
> >> headers H2, H3, ... Hn that are required for making the
> >> interfaces
> >> declared in H1 usable in client modules.
> >>
> >>> For module INF files,
> >>> we require the INF file to list all the lib classes
> >> that the
> >>> module sources directly use.
> >>
> >> Yes, keyword being "directly".
> >>
> >>> Since a module that uses the
> >>> DebugLib uses the ASSERT() and DEBUG() macros, all
> >> the APIs
> >>> that the ASSERT() and DEBUG() macros use are also
> >> directly
> >>> used by the module.
> >>
> >> I believe this is where I disagree. The replacement
> >> texts of the
> >> ASSERT() and DEBUG() function-like macros are internals
> >> of the
> >> DebugLib.h lib class header, in my opinion. Those
> >> internals place
> >> requirements on specific DebugLib instances, not on
> >> DebugLib class
> >> consumers.
> >>
> >> In other words, when writing a new DebugLib instance,
> >> the implementor
> >> has to ensure that the ASSERT() and DEBUG() macros, as
> >> defined in the
> >> DebugLib class header, will continue working in
> >> DebugLib consumer
> >> modules. The implementor may then choose to make the
> >> new DebugLib
> >> instance dependent on the (singleton) DebugCommonLib
> >> instance, for
> >> example. (This is being done in patches #3, #4, #16,
> >> maybe more.) The
> >> DebugLib consumer module will inherit that dependency,
> >> and everything
> >> will work.
> >>
> >> Just because ASSERT() and DEBUG() are function-like
> >> macros and not
> >> actual functions, I don't think the INF file
> >> requirements in
> >> DebugLib-consumer modules should change.
> >>
> >>> With this patch series, these macros
> >>> now use the DebugCommonLib class APIs, which means
> >> any module
> >>> that uses the DebugLib also directly uses the
> >> DebugCommonLib.
> >>
> >> In my opinion: indirectly.
> >>
> >> Thanks,
> >> Laszlo
> >>
> >>
> >>
> >
^ permalink raw reply related [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-13 17:59 ` Liming Gao
@ 2020-05-13 18:37 ` Vitaly Cheptsov
0 siblings, 0 replies; 48+ messages in thread
From: Vitaly Cheptsov @ 2020-05-13 18:37 UTC (permalink / raw)
To: Gao, Liming
Cc: Kinney, Michael D, lersek@redhat.com, devel@edk2.groups.io,
Andrew Fish, Marvin Häuser, Gao, Zhichao
[-- Attachment #1: Type: text/plain, Size: 12529 bytes --]
Liming,
Firstly, could you please explain why did not you suggest anything alike a couple of months ago when I proposed exactly the same solution and posted a patch asking how to workaround the undeclared identifier issue?
I am somewhat unhappy here doing rounds. I propose a solution, somebody from your team says it is wrong, I propose another solution, you say it is wrong again, months later you start suggesting me to use one of my older solutions but «slightly» change it, so that it starts to look ugly (and I do not mean just this time, it has been at least trice). If your team wants to continue to sabotage any attempts to fix it we could consider ceasing any relationship with EDK II, but I want to believe it is just some misunderstanding which unfortunately escalated this much.
Secondly, «being compatible to the current platform» and leaving on by default is something that nobody really needs. I explicitly mentioned that the defaults are changed in the latest commit message, and so far nobody objects about it. My opinion is that the ill behaviour we have now should never ever be the default. Be that compatibility or not. If you need it for some packages — override it. In fact, Also, in fact I once made the PCD inverted a few revisions ago… and somebody asked to change it :D
Thirdly, I am not happy about code duplication in the debug lib we have now. This makes changing anything in DebugLib a very hard matter. Just like Laszlo says, if DebugLib is frozen forever, we should not even attempt to change things there. It sounds insane if true.
All in all, several people including us, guys from Microsoft and Red Hat have already told you many times that the reasons behind keeping this assertion are illicit in the first place. Perhaps, it should really be just removed in a single small patch without any PCDs and we can just get over it once and forever. If you believe it is not the case, perhaps you could submit a patch on your own? We will review it as soon as possible.
Best wishes,
Vitaly
[1] https://edk2.groups.io/g/devel/message/55961
> 13 мая 2020 г., в 20:59, Gao, Liming <liming.gao@intel.com> написал(а):
>
> Vitaly:
> I would like to propose one solution to update DebugLib.h only. This solution directly declares PcdDebugPropertyMask global variable in DebugLib.h. Then, DebugLib macro can use it. Because most of DebugLib library instances describe PcdDebugPropertyMask in their INF, this PCD can be generated without the additional change. I also evaluate PcdDebugPropertyMask usage in existing platform. This PCD is always used as FixedAtBuild. So, I change PcdDebugPropertyMask type in DEC to FixedAtBuild. This change impact should be smaller than current patch set. Below patch passes the build on OvmfPkg. It should work.
>
> Besides, new PcdDebugPropertyMask BIT6 for Treat constraint violations as ASSERT. This BIT should be enabled by default to be compatible with current platform. Now, most platforms set this PCD PcdDebugPropertyMask in their platform DSC file. PCD value is also required to be updated. Another compatible way is to define BIT6 for Treat constraint violations as empty. When BIT6 is 1, it means constraint violation as empty. When BIT6 is 0, it means constraint violation as ASSERT. If so, this PCD value is not required to be changed in platform DSC.
>
> Thanks
> Liming
> ---
> MdePkg/Include/Library/DebugLib.h | 7 ++++++-
> .../Library/BaseDebugLibNull/BaseDebugLibNull.inf | 4 ++++
> MdePkg/MdePkg.dec | 22 +++++++++++-----------
> 3 files changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/DebugLib.h
> index baab34bf05..68604de869 100644
> --- a/MdePkg/Include/Library/DebugLib.h
> +++ b/MdePkg/Include/Library/DebugLib.h
> @@ -321,6 +321,11 @@ DebugPrintLevelEnabled (
> #define _DEBUG(Expression) DebugPrint Expression
> #endif
>
> +//
> +// FixedAtBuild PCD value PcdDebugPropertyMask
> +//
> +extern const UINT8 _gPcd_FixedAtBuild_PcdDebugPropertyMask;
> +
> /**
> Macro that calls DebugAssert() if an expression evaluates to FALSE.
>
> @@ -336,7 +341,7 @@ DebugPrintLevelEnabled (
> #if !defined(MDEPKG_NDEBUG)
> #define ASSERT(Expression) \
> do { \
> - if (DebugAssertEnabled ()) { \
> + if ((DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED & _gPcd_FixedAtBuild_PcdDebugPropertyMask) != 0) { \
> if (!(Expression)) { \
> _ASSERT (Expression); \
> ANALYZER_UNREACHABLE (); \
> diff --git a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> index 81a63a5074..1e95a2f077 100644
> --- a/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> +++ b/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> @@ -29,3 +29,7 @@
> [Packages]
> MdePkg/MdePkg.dec
>
> +[Pcd]
> + # This PCD is consumed in DebugLib.h
> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask ## CONSUMES
> +
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index 0ab09195c1..f8aacdf428 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -2105,6 +2105,17 @@
> # @Prompt Speculation Barrier Type.
> gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x30001018
>
> + ## The mask is used to control DebugLib behavior.<BR><BR>
> + # BIT0 - Enable Debug Assert.<BR>
> + # BIT1 - Enable Debug Print.<BR>
> + # BIT2 - Enable Debug Code.<BR>
> + # BIT3 - Enable Clear Memory.<BR>
> + # BIT4 - Enable BreakPoint as ASSERT.<BR>
> + # BIT5 - Enable DeadLoop as ASSERT.<BR>
> + # @Prompt Debug Property.
> + # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
> + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
> +
> [PcdsFixedAtBuild,PcdsPatchableInModule]
> ## Indicates the maximum length of unicode string used in the following
> # BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()<BR><BR>
> @@ -2139,17 +2150,6 @@
> # @Prompt Spin Lock Timeout (us).
> gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004
>
> - ## The mask is used to control DebugLib behavior.<BR><BR>
> - # BIT0 - Enable Debug Assert.<BR>
> - # BIT1 - Enable Debug Print.<BR>
> - # BIT2 - Enable Debug Code.<BR>
> - # BIT3 - Enable Clear Memory.<BR>
> - # BIT4 - Enable BreakPoint as ASSERT.<BR>
> - # BIT5 - Enable DeadLoop as ASSERT.<BR>
> - # @Prompt Debug Property.
> - # @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
> - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
> -
> ## This flag is used to control the print out Debug message.<BR><BR>
> # BIT0 - Initialization message.<BR>
> # BIT1 - Warning message.<BR>
> --
>
> Thanks
> Liming
>> -----Original Message-----
>> From: Vitaly Cheptsov <cheptsov@ispras.ru>
>> Sent: Wednesday, May 13, 2020 2:58 AM
>> To: Kinney, Michael D <michael.d.kinney@intel.com>; lersek@redhat.com
>> Cc: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Marvin Häuser <mhaeuser@outlook.de>; Gao, Liming
>> <liming.gao@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
>> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
>>
>> Mike,
>>
>> I see what you mean here, but I believe it is absolutely fine to implement DebugCommonLib.h interface within DebugLib without
>> depending on DebugCommonLib if one absolutely desires it (thought I do not think it is a good idea).
>> In this case, perhaps we can avoid adding DebugCommonLib.h header at all and leave it all in DebugLib.h?
>> So that DebugCommonLib library is entirely private thing to DebugLib, which can either use it or not.
>>
>> Best wishes,
>> Vitaly
>>
>>> 12 мая 2020 г., в 21:18, Kinney, Michael D <michael.d.kinney@intel.com> написал(а):
>>>
>>> Laszlo,
>>>
>>> A library implementation that uses another library class
>>> lists those library classes in the library INF. This is
>>> a way a module can inherit the use of a second lib without
>>> listing the second lib in the module INF. This is the
>>> type of inheritance that is supported by the EDK II build
>>> system and the EDK II meta data files.
>>>
>>> What is not supported today is indirect inheritance from
>>> the libclass .h file itself. There is no mechanism for
>>> the libclass .h file to declare it is using another library
>>> class. This would require extensions to the meta data
>>> files to declare this type dependency.
>>>
>>> How does the build system know to add DebugCommonLib to
>>> the link command for a module that only lists DebugLib
>>> in its library classes section? What if there is a
>>> DebugLib implementation of the DebugLib class that
>>> does not depend on DebugCommonLib. The module link
>>> will then fail when the module writer followed all the
>>> rules. This is why including a libclass from another
>>> libclass is bad idea.
>>>
>>> Mike
>>>
>>>> -----Original Message-----
>>>> From: devel@edk2.groups.io <devel@edk2.groups.io> On
>>>> Behalf Of Laszlo Ersek
>>>> Sent: Tuesday, May 12, 2020 2:51 AM
>>>> To: Kinney, Michael D <michael.d.kinney@intel.com>;
>>>> Vitaly Cheptsov <cheptsov@ispras.ru>;
>>>> devel@edk2.groups.io
>>>> Cc: Andrew Fish <afish@apple.com>; Marvin Häuser
>>>> <mhaeuser@outlook.de>; Gao, Liming
>>>> <liming.gao@intel.com>; Gao, Zhichao
>>>> <zhichao.gao@intel.com>
>>>> Subject: Re: [edk2-devel] [PATCH V4 00/27] Disabling
>>>> safe string constraint assertions
>>>>
>>>> On 05/12/20 00:40, Kinney, Michael D wrote:
>>>>> Vitaly,
>>>>>
>>>>> Thank you for the contribution.
>>>>>
>>>>> There are a couple points about this approach that
>>>> need to be discussed.
>>>>>
>>>>> You have included the <Library/DebugCommonLib.h> from
>>>>> MdePkg/Include/Library/DebugLib.h.
>>>>
>>>> Right, I've noticed it. I agree it's unusual. I didn't
>>>> think it was wrong.
>>>>
>>>>> It is very rare for a
>>>>> lib class to include another lib class. This means
>>>> that a module
>>>>> that has a dependency on the DebugLib class inherits
>>>> a hidden
>>>>> dependency on the DebugCommonLib class.
>>>>
>>>> I agree.
>>>>
>>>> I think it should be fine. Any header H1 should include
>>>> such further
>>>> headers H2, H3, ... Hn that are required for making the
>>>> interfaces
>>>> declared in H1 usable in client modules.
>>>>
>>>>> For module INF files,
>>>>> we require the INF file to list all the lib classes
>>>> that the
>>>>> module sources directly use.
>>>>
>>>> Yes, keyword being "directly".
>>>>
>>>>> Since a module that uses the
>>>>> DebugLib uses the ASSERT() and DEBUG() macros, all
>>>> the APIs
>>>>> that the ASSERT() and DEBUG() macros use are also
>>>> directly
>>>>> used by the module.
>>>>
>>>> I believe this is where I disagree. The replacement
>>>> texts of the
>>>> ASSERT() and DEBUG() function-like macros are internals
>>>> of the
>>>> DebugLib.h lib class header, in my opinion. Those
>>>> internals place
>>>> requirements on specific DebugLib instances, not on
>>>> DebugLib class
>>>> consumers.
>>>>
>>>> In other words, when writing a new DebugLib instance,
>>>> the implementor
>>>> has to ensure that the ASSERT() and DEBUG() macros, as
>>>> defined in the
>>>> DebugLib class header, will continue working in
>>>> DebugLib consumer
>>>> modules. The implementor may then choose to make the
>>>> new DebugLib
>>>> instance dependent on the (singleton) DebugCommonLib
>>>> instance, for
>>>> example. (This is being done in patches #3, #4, #16,
>>>> maybe more.) The
>>>> DebugLib consumer module will inherit that dependency,
>>>> and everything
>>>> will work.
>>>>
>>>> Just because ASSERT() and DEBUG() are function-like
>>>> macros and not
>>>> actual functions, I don't think the INF file
>>>> requirements in
>>>> DebugLib-consumer modules should change.
>>>>
>>>>> With this patch series, these macros
>>>>> now use the DebugCommonLib class APIs, which means
>>>> any module
>>>>> that uses the DebugLib also directly uses the
>>>> DebugCommonLib.
>>>>
>>>> In my opinion: indirectly.
>>>>
>>>> Thanks,
>>>> Laszlo
>>>>
>>>>
>>>>
>>>
>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 48+ messages in thread
* Re: [edk2-devel] [PATCH V4 00/27] Disabling safe string constraint assertions
2020-05-13 14:41 ` [EXTERNAL] " Bret Barkelew
@ 2020-05-13 20:14 ` Brian J. Johnson
0 siblings, 0 replies; 48+ messages in thread
From: Brian J. Johnson @ 2020-05-13 20:14 UTC (permalink / raw)
To: devel, bret.barkelew, lersek@redhat.com, Kinney, Michael D,
Vitaly Cheptsov
Cc: Andrew Fish, Marvin Häuser, liming.gao, Gao, Zhichao
As am I -- I don't see that they add value.
Brian
-------- Original Message --------
From: Bret Barkelew via groups.io
[mailto:bret.barkelew=microsoft.com@groups.io]
Sent: Wednesday, May 13, 2020, 9:41 AM
To: devel@edk2.groups.io <devel@edk2.groups.io>, lersek@redhat.com
<lersek@redhat.com>, Kinney, Michael D <michael.d.kinney@intel.com>,
Vitaly Cheptsov <cheptsov@ispras.ru>
Cc: Andrew Fish <afish@apple.com>, Marvin Häuser <mhaeuser@outlook.de>,
liming.gao <liming.gao@intel.com>, Gao, Zhichao <zhichao.gao@intel.com>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH V4 00/27] Disabling safe
string constraint assertions
Ooooo. Does that mean we get to start on DebugLibEx?
In all seriousness, I’m also in the camp of “can’t we just drop these
assertions”?
- Bret
------------------------------------------------------------------------
*From:* devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Laszlo
Ersek via groups.io <lersek=redhat.com@groups.io>
*Sent:* Wednesday, May 13, 2020 2:16:12 AM
*To:* Kinney, Michael D <michael.d.kinney@intel.com>;
devel@edk2.groups.io <devel@edk2.groups.io>; Vitaly Cheptsov
<cheptsov@ispras.ru>
*Cc:* Andrew Fish <afish@apple.com>; Marvin Häuser
<mhaeuser@outlook.de>; liming.gao <liming.gao@intel.com>; Gao, Zhichao
<zhichao.gao@intel.com>
*Subject:* [EXTERNAL] Re: [edk2-devel] [PATCH V4 00/27] Disabling safe
string constraint assertions
Hi Mike,
On 05/12/20 20:18, Kinney, Michael D wrote:
> What if there is a
> DebugLib implementation of the DebugLib class that
> does not depend on DebugCommonLib.
There need not be a link failure in this case either, if the DebugLib
instance in question provides the DebugCommonLib API implementations too.
Anyway I don't want to obsess about this. I'm just sad there are zero
acceptable solutions apparently to the 100% valid problem statement that
Vitaly submitted last August, in TianoCore#2054. (Asserting properties
of untrusted external data is *asinine*.) But then, if Vitaly proposes
to update all DebugLib instances one by one, that gets shot down because
"too many DebugLib instances in platforms". And if Vitaly extracts the
common bits so that only the common bits have to be updated, that gets
shot down by "we don't support this kind of dependency, please update
all DebugLib instances instead".
Let's just be honest and call DebugLib frozen forever.
Laszlo
--
Brian
--------------------------------------------------------------------
"We are Microsoft. UNIX is irrelevant. OS/2 is irrelevant. Openness
is futile. Prepare to be assimilated."
-- prs@turing.org
-- (quoted by Eric Berggren)
^ permalink raw reply [flat|nested] 48+ messages in thread
end of thread, other threads:[~2020-05-13 20:14 UTC | newest]
Thread overview: 48+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-11 15:40 [PATCH V4 00/27] Disabling safe string constraint assertions Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 01/27] MdePkg: Introduce DebugCommonLib interface and BaseDebugCommonLib Vitaly Cheptsov
2020-05-11 20:37 ` [edk2-devel] " Laszlo Ersek
2020-05-11 20:42 ` Laszlo Ersek
2020-05-11 15:40 ` [PATCH V4 02/27] UnitTestFrameworkPkg: Add support for DebugCommonLib Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 03/27] MdePkg: " Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 04/27] MdeModulePkg: " Vitaly Cheptsov
2020-05-11 15:40 ` [PATCH V4 05/27] ArmPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 06/27] ArmPlatformPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 07/27] ArmVirtPkg: " Vitaly Cheptsov
2020-05-11 20:42 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 08/27] CryptoPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 09/27] DynamicTablesPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 10/27] EmbeddedPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 11/27] EmulatorPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 12/27] FatPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 13/27] FmpDevicePkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 14/27] IntelFsp2Pkg: " Vitaly Cheptsov
2020-05-12 0:49 ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 15/27] IntelFsp2WrapperPkg: " Vitaly Cheptsov
2020-05-12 0:47 ` [edk2-devel] " Chiu, Chasel
2020-05-11 15:41 ` [PATCH V4 16/27] OvmfPkg: " Vitaly Cheptsov
2020-05-11 20:49 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 17/27] NetworkPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 18/27] ShellPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 19/27] SecurityPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 20/27] PcAtChipsetPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 21/27] SignedCapsulePkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 22/27] SourceLevelDebugPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 23/27] StandaloneMmPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 24/27] UefiCpuPkg: " Vitaly Cheptsov
2020-05-11 20:52 ` [edk2-devel] " Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 25/27] UefiPayloadPkg: " Vitaly Cheptsov
2020-05-11 15:41 ` [PATCH V4 26/27] MdePkg: Introduce assertion on constraint debug mask bit Vitaly Cheptsov
2020-05-11 20:58 ` [edk2-devel] " Laszlo Ersek
2020-05-11 22:12 ` Laszlo Ersek
2020-05-11 15:41 ` [PATCH V4 27/27] MdePkg: Use assertion on constraint violation bit in SafeString Vitaly Cheptsov
2020-05-11 21:04 ` [edk2-devel] " Laszlo Ersek
2020-05-11 22:40 ` [PATCH V4 00/27] Disabling safe string constraint assertions Michael D Kinney
2020-05-12 9:50 ` Laszlo Ersek
2020-05-12 17:03 ` Vitaly Cheptsov
2020-05-12 18:18 ` [edk2-devel] " Michael D Kinney
2020-05-12 18:57 ` Vitaly Cheptsov
2020-05-13 17:59 ` Liming Gao
2020-05-13 18:37 ` Vitaly Cheptsov
2020-05-13 9:16 ` Laszlo Ersek
2020-05-13 14:41 ` [EXTERNAL] " Bret Barkelew
2020-05-13 20:14 ` Brian J. Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox