[edk2-devel] [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++

Laszlo Ersek lersek at redhat.com
Tue Aug 13 12:26:20 UTC 2019


On 08/12/19 08:24, Zhang, Shenglei wrote:
> PageMapLevel5Entry may be uninitialized in original code, which means
> uninitialized pointer will be modified at some circumstance.
> So relocate the operation of PageMapLevel5Entry++ in order to make sure
> the pointer could be modified only when it is uninitialized.
> 
> Cc: Dandan Bi <dandan.bi at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Eric Dong <eric.dong at intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang at intel.com>
> ---
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> index b40b7e0c9813..2389f3eb485b 100644
> --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
> @@ -764,7 +764,7 @@ CreateIdentityMappingPageTables (
>  
>    for ( IndexOfPml5Entries = 0
>        ; IndexOfPml5Entries < NumberOfPml5EntriesNeeded
> -      ; IndexOfPml5Entries++, PageMapLevel5Entry++) {
> +      ; IndexOfPml5Entries++) {
>      //
>      // Each PML5 entry points to a page of PML4 entires.
>      // So lets allocate space for them and fill them in in the IndexOfPml4Entries loop.
> @@ -780,6 +780,7 @@ CreateIdentityMappingPageTables (
>        PageMapLevel5Entry->Uint64 = (UINT64) (UINTN) PageMapLevel4Entry | AddressEncMask;
>        PageMapLevel5Entry->Bits.ReadWrite = 1;
>        PageMapLevel5Entry->Bits.Present   = 1;
> +      PageMapLevel5Entry++;
>      }
>  
>      for ( IndexOfPml4Entries = 0
> 

I'm commenting for a second time here because the underlying bug seems
to break the building of OVMF:

[edk2-devel] ovmf build fail with gcc 4.8.5

When you commit the patch, please add the following to the commit message:

Fixes: b3527dedc3951f061c5a73cb4fb2b0f95f47e08b

(Because the invalid access was apparently introduced in that commit. I
did regression-test b3527dedc395, but I didn't get the warning.)

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#45563): https://edk2.groups.io/g/devel/message/45563
Mute This Topic: https://groups.io/mt/32838114/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list