audk/MdeModulePkg/Library/DxeCorePerformanceLib
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
..
DxeCorePerformanceLib.c MdeModulePkg/DxeCorePerformanceLib: add lock protection 2017-11-29 20:34:10 +08:00
DxeCorePerformanceLib.inf MdeModulePkg: Add performance property configuration table 2017-02-23 09:01:17 -08:00
DxeCorePerformanceLib.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeCorePerformanceLibInternal.h MdeModulePkg: Add performance property configuration table 2017-02-23 09:01:17 -08:00