diff options
author | Heyi Guo <heyi.guo@linaro.org> | 2017-11-27 11:31:44 +0800 |
---|---|---|
committer | Star Zeng <star.zeng@intel.com> | 2017-11-29 20:34:10 +0800 |
commit | f1f7190bf3bf932b52287258a65c366ed5bdce13 (patch) | |
tree | 1f9b7c4c26fddc168d73de5c79dd800fedbcacee /IntelFsp2WrapperPkg/FspWrapperNotifyDxe | |
parent | cc1ad92aaa5c494c14006751d0f43439880caeba (diff) | |
download | edk2-f1f7190bf3bf932b52287258a65c366ed5bdce13.tar.gz edk2-f1f7190bf3bf932b52287258a65c366ed5bdce13.tar.bz2 edk2-f1f7190bf3bf932b52287258a65c366ed5bdce13.zip |
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>
Diffstat (limited to 'IntelFsp2WrapperPkg/FspWrapperNotifyDxe')
0 files changed, 0 insertions, 0 deletions