]> git.proxmox.com Git - mirror_edk2.git/commit
MdeModulePkg/MemoryProtection: split protect and unprotect paths
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 21 Mar 2017 13:49:08 +0000 (13:49 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 21 Mar 2017 21:29:26 +0000 (21:29 +0000)
commit5920a9d16b1ab887c2858224316a98e961d71b05
treed599b373bfdd5ef356680ef4345eb8382b202802
parent5d5a19028a55a1fb42c9e4304fc84108d3206296
MdeModulePkg/MemoryProtection: split protect and unprotect paths

Currently, the PE/COFF image memory protection code uses the same code
paths for protecting and unprotecting an image. This is strange, since
unprotecting an image involves a single call into the CPU arch protocol
to clear the permission attributes of the entire range, and there is no
need to parse the PE/COFF headers again.

So let's store the ImageRecord entries in a linked list, so we can find
it again at unprotect time, and simply clear the permissions.

Note that this fixes a DEBUG hang on an ASSERT() that occurs when the
PE/COFF image fails to load, which causes UnprotectUefiImage() to be
invoked before the image is fully loaded.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c