]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
MdeModulePkg PiSmmCore: Enhance SMM FreePool to catch buffer overflow
authorStar Zeng <star.zeng@intel.com>
Wed, 19 Apr 2017 03:12:18 +0000 (11:12 +0800)
committerStar Zeng <star.zeng@intel.com>
Thu, 20 Apr 2017 06:10:04 +0000 (14:10 +0800)
commit861c8dff2f506d602f8612ace12d244c29e63f31
tree5fcb9f1647a2689777ebe7ce1422b93a8b0422c9
parent95ad8f7f6a6c84ef46a96a8ba852afed805d1ca3
MdeModulePkg PiSmmCore: Enhance SMM FreePool to catch buffer overflow

This solution is equivalent to DXE core.

AllocatePool() allocates POOL_TAIL after the buffer.
This POOL_TAIL is checked at FreePool().
If the there is buffer overflow, the issue can be caught at FreePool().

This patch could also handle the eight-byte aligned allocation
requirement. The discussion related to the eight-byte aligned
allocation requirement is at
https://lists.01.org/pipermail/edk2-devel/2017-April/009995.html.

According to the PI spec (Vol 4, Section 3.2 SmmAllocatePool()):
The SmmAllocatePool() function ... All allocations are eight-byte aligned.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
MdeModulePkg/Core/PiSmmCore/Pool.c