public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
@ 2019-08-12  6:24 Zhang, Shenglei
  2019-08-12 13:06 ` Laszlo Ersek
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Zhang, Shenglei @ 2019-08-12  6:24 UTC (permalink / raw)
  To: devel; +Cc: Dandan Bi, Liming Gao, Hao A Wu, Laszlo Ersek, Eric Dong

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@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@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
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
@ 2019-08-12 13:06 ` Laszlo Ersek
  2019-08-13  1:51 ` Wu, Hao A
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Laszlo Ersek @ 2019-08-12 13:06 UTC (permalink / raw)
  To: Shenglei Zhang, devel; +Cc: Dandan Bi, Liming Gao, Hao A Wu, Eric Dong

Hello Shenglei,

On 08/12/19 08:24, Shenglei Zhang 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@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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 prefer to leave this to the other people on CC.

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
  2019-08-12 13:06 ` Laszlo Ersek
@ 2019-08-13  1:51 ` Wu, Hao A
  2019-08-13  2:04 ` Dandan Bi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Wu, Hao A @ 2019-08-13  1:51 UTC (permalink / raw)
  To: Dong, Eric, Zhang, Shenglei, devel@edk2.groups.io
  Cc: Bi, Dandan, Gao, Liming, Laszlo Ersek, Dong, Eric

Hello Eric,

Could you help to take a look at this one as well?


> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, August 12, 2019 2:25 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan; Gao, Liming; Wu, Hao A; Laszlo Ersek; Dong, Eric
> Subject: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of
> PageMapLevel5Entry++
> 
> 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@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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++;
>      }


I think the change is fine,
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
>      for ( IndexOfPml4Entries = 0
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
  2019-08-12 13:06 ` Laszlo Ersek
  2019-08-13  1:51 ` Wu, Hao A
@ 2019-08-13  2:04 ` Dandan Bi
  2019-08-13  2:17   ` Dong, Eric
  2019-08-13 12:26 ` [edk2-devel] " Laszlo Ersek
  2019-08-14  1:05 ` Wu, Hao A
  4 siblings, 1 reply; 8+ messages in thread
From: Dandan Bi @ 2019-08-13  2:04 UTC (permalink / raw)
  To: Zhang, Shenglei, devel@edk2.groups.io
  Cc: Gao, Liming, Wu, Hao A, Laszlo Ersek, Dong, Eric

> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, August 12, 2019 2:25 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>;
> Wu, Hao A <hao.a.wu@intel.com>; Laszlo Ersek <lersek@redhat.com>; Dong,
> Eric <eric.dong@intel.com>
> Subject: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of
> PageMapLevel5Entry++
> 
> 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.
I think "uninitialized" here should be a typo, you may mean "initialized".
Please update it before commit.
I have no other comments for this patch.
Reviewed-by: Dandan Bi <dandan.bi@intel.com>

> 
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-13  2:04 ` Dandan Bi
@ 2019-08-13  2:17   ` Dong, Eric
  0 siblings, 0 replies; 8+ messages in thread
From: Dong, Eric @ 2019-08-13  2:17 UTC (permalink / raw)
  To: Bi, Dandan, Zhang, Shenglei, devel@edk2.groups.io
  Cc: Gao, Liming, Wu, Hao A, Laszlo Ersek

Agree with Dandan's comments. With that update, Reviewed-by: Eric Dong <eric.dong@intel.com>

> -----Original Message-----
> From: Bi, Dandan
> Sent: Tuesday, August 13, 2019 10:04 AM
> To: Zhang, Shenglei <shenglei.zhang@intel.com>; devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Laszlo Ersek <lersek@redhat.com>; Dong, Eric <eric.dong@intel.com>
> Subject: RE: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the
> operation of PageMapLevel5Entry++
> 
> > -----Original Message-----
> > From: Zhang, Shenglei
> > Sent: Monday, August 12, 2019 2:25 PM
> > To: devel@edk2.groups.io
> > Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming
> > <liming.gao@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Laszlo Ersek
> > <lersek@redhat.com>; Dong, Eric <eric.dong@intel.com>
> > Subject: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation
> > of
> > PageMapLevel5Entry++
> >
> > 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.
> I think "uninitialized" here should be a typo, you may mean "initialized".
> Please update it before commit.
> I have no other comments for this patch.
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> 
> >
> > Cc: Dandan Bi <dandan.bi@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Signed-off-by: Shenglei Zhang <shenglei.zhang@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
> > --
> > 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
                   ` (2 preceding siblings ...)
  2019-08-13  2:04 ` Dandan Bi
@ 2019-08-13 12:26 ` Laszlo Ersek
  2019-08-14  0:06   ` Wu, Hao A
  2019-08-14  1:05 ` Wu, Hao A
  4 siblings, 1 reply; 8+ messages in thread
From: Laszlo Ersek @ 2019-08-13 12:26 UTC (permalink / raw)
  To: devel, shenglei.zhang; +Cc: Dandan Bi, Liming Gao, Hao A Wu, Eric Dong

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@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-13 12:26 ` [edk2-devel] " Laszlo Ersek
@ 2019-08-14  0:06   ` Wu, Hao A
  0 siblings, 0 replies; 8+ messages in thread
From: Wu, Hao A @ 2019-08-14  0:06 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, Zhang, Shenglei
  Cc: Bi, Dandan, Gao, Liming, Dong, Eric

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Tuesday, August 13, 2019 8:26 PM
> To: devel@edk2.groups.io; Zhang, Shenglei
> Cc: Bi, Dandan; Gao, Liming; Wu, Hao A; Dong, Eric
> Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate
> the operation of PageMapLevel5Entry++
> 
> 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@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Signed-off-by: Shenglei Zhang <shenglei.zhang@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


Hello Laszlo,

Thanks for the information.
I will update the commit message when I push this patch.

Best Regards,
Hao Wu


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++
  2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
                   ` (3 preceding siblings ...)
  2019-08-13 12:26 ` [edk2-devel] " Laszlo Ersek
@ 2019-08-14  1:05 ` Wu, Hao A
  4 siblings, 0 replies; 8+ messages in thread
From: Wu, Hao A @ 2019-08-14  1:05 UTC (permalink / raw)
  To: Zhang, Shenglei, devel@edk2.groups.io
  Cc: Bi, Dandan, Gao, Liming, Laszlo Ersek, Dong, Eric

> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, August 12, 2019 2:25 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan; Gao, Liming; Wu, Hao A; Laszlo Ersek; Dong, Eric
> Subject: [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of
> PageMapLevel5Entry++
> 
> 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.


With the commit message updated, pushed via commit 46f8a68916.

Best Regards,
Hao Wu


> 
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@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
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-14  1:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-12  6:24 [PATCH 1/1] MdeModulePkg/DxeIplPeim: Relocate the operation of PageMapLevel5Entry++ Zhang, Shenglei
2019-08-12 13:06 ` Laszlo Ersek
2019-08-13  1:51 ` Wu, Hao A
2019-08-13  2:04 ` Dandan Bi
2019-08-13  2:17   ` Dong, Eric
2019-08-13 12:26 ` [edk2-devel] " Laszlo Ersek
2019-08-14  0:06   ` Wu, Hao A
2019-08-14  1:05 ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox