audk/MdeModulePkg/Library
Heyi Guo f1f7190bf3 MdeModulePkg/DxeCorePerformanceLib: add lock protection
DXE performance gauge record access functions might be reentered since
we are supporting something like USB hot-plug, which is a timer event
where gBS->ConnectController might be called and then PERF will be
called in CoreConnectSingleController.

When StartGaugeEx is being reentered, not only the gauge record might
be overwritten, more serious situation will be caused if gauge data
buffer reallocation procedure is interrupted, between line 180 and 187
in DxeCorePerformanceLib.c specifically. There, mMaxGaugeRecords will
be doubled twice (denoted as 4X), but mGaugeData only points to a
buffer of size 2X, which will probably cause the following 2X memory
to be overflowed when gauge records are increased.

So we add EFI lock with TPL_NOTIFY in StartGaugeEx/EndGaugeEx/GetGaugeEx
to avoid memory overflow and gauge data corruption.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-11-29 20:34:10 +08:00
..
AuthVariableLibNull MdeModulePkg: Deprecate EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 2017-11-01 22:25:36 +08:00
BaseIpmiLibNull
BasePlatformHookLibNull
BaseResetSystemLibNull
BaseSerialPortLib16550
BaseSortLib
BootLogoLib
BootMaintenanceManagerUiLib MdeModulePkg: Fix misuses of AllocateCopyPool 2017-11-08 17:13:03 +08:00
BootManagerUiLib MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp 2017-07-27 10:47:15 +08:00
BrotliCustomDecompressLib MdeModulePkg: Fix MSFT C4255 warning 2017-11-14 18:18:43 +08:00
CpuExceptionHandlerLibNull MdeModulePkg/CpuExceptionHandlerLib: Add DumpCpuContext() 2017-04-07 09:43:40 +08:00
CustomizedDisplayLib
DebugAgentLibNull
DeviceManagerUiLib MdeModulePkg: Fix misuses of AllocateCopyPool 2017-11-08 17:13:03 +08:00
DxeCapsuleLibFmp MdeModulePkg: Update Ppi/Protocol/Guid usage in INF files 2017-10-10 18:10:25 +08:00
DxeCapsuleLibNull
DxeCoreMemoryAllocationLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
DxeCorePerformanceLib MdeModulePkg/DxeCorePerformanceLib: add lock protection 2017-11-29 20:34:10 +08:00
DxeCrc32GuidedSectionExtractLib
DxeDebugPrintErrorLevelLib
DxeDpcLib
DxeFileExplorerProtocol
DxeHttpLib MdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODE 2017-08-02 15:31:21 +08:00
DxeIpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
DxeIpmiLibIpmiProtocol
DxeNetLib MdeModulePkg: Update IP4 stack to support point-to-point link with 31-bit mask. 2017-11-13 13:52:17 +08:00
DxePerformanceLib
DxePrintLibPrint2Protocol MdeModulePkg/PrintLib: Fix possible negative value left shift 2017-09-29 16:14:17 +08:00
DxeReportStatusCodeLib
DxeSecurityManagementLib MdeModulePkg: Fix MSFT C4255 warning 2017-11-14 18:18:43 +08:00
DxeSmmPerformanceLib
DxeTcpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
DxeUdpIoLib MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLib 2017-08-23 09:17:28 +08:00
FileExplorerLib MdeModulePkg: Update Ppi/Protocol/Guid usage in INF files 2017-10-10 18:10:25 +08:00
FmpAuthenticationLibNull
FrameBufferBltLib MdeModulePkg/FrameBufferBltLib: Use dynamic allocated line buffer 2017-01-24 15:06:39 +08:00
LockBoxNullLib
LzmaCustomDecompressLib MdeModulePkg: Fix MSFT C4255 warning 2017-11-14 18:18:43 +08:00
NonDiscoverableDeviceRegistrationLib MdeModulePkg: Update NonDiscoverableDeviceRegistrationLib file header format 2017-07-26 09:00:25 +08:00
OemHookStatusCodeLibNull
PciHostBridgeLibNull
PeiCrc32GuidedSectionExtractLib MdeModulePkg: Update modules to consume CalculateCrc32() 2017-10-10 18:10:16 +08:00
PeiDebugPrintHobLib
PeiDxeDebugLibReportStatusCode
PeiIpmiLibIpmiPpi
PeiPerformanceLib
PeiRecoveryLibNull
PeiReportStatusCodeLib
PeiS3LibNull
PiDxeS3BootScriptLib MdeModulePkg: Update PiDxeS3BootScriptLib Internal function name 2017-09-13 15:02:08 +08:00
PiSmmCoreMemoryAllocationLib MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue 2017-08-01 17:44:02 +08:00
PiSmmCoreSmmServicesTableLib
PlatformBootManagerLibNull
PlatformHookLibSerialPortPpi
PlatformVarCleanupLib MdeModulePkg: Fix MSFT C4255 warning 2017-11-14 18:18:43 +08:00
RuntimeDxeReportStatusCodeLib
SmmCorePerformanceLib MdeModulePkg PerformanceLib: Fix GCC build failure caused by cfb0aba 2017-02-24 16:33:26 +08:00
SmmCorePlatformHookLibNull
SmmIpmiLibSmmIpmiProtocol
SmmLockBoxLib MdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM buffer 2017-07-26 16:05:51 +08:00
SmmMemoryAllocationProfileLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
SmmPerformanceLib
SmmReportStatusCodeLib
SmmSmiHandlerProfileLib MdeModulePkg/SmiHandlerProfile: Add Context support in Unregister 2017-03-13 16:04:12 +08:00
TpmMeasurementLibNull
UefiBootManagerLib MdeModulePkg/UefiBootManagerLib: Remove assertion 2017-11-22 17:50:39 +08:00
UefiHiiLib MdeModulePkg: Fix misuses of AllocateCopyPool 2017-11-08 17:13:03 +08:00
UefiHiiServicesLib
UefiMemoryAllocationProfileLib MdeModulePkg: Refine casting expression result to bigger size 2017-03-06 14:33:20 +08:00
UefiSortLib MdeModulePkg: Update Ppi/Protocol/Guid usage in INF files 2017-10-10 18:10:25 +08:00
VarCheckHiiLib MdeModulePkg/VarCheckHii: Enhance VarCheckHiiLib to support bit check 2017-11-07 10:02:51 +08:00
VarCheckLib
VarCheckPcdLib
VarCheckUefiLib