[edk2-devel] [PATCH 0/2] Reserve page 0 for NULL pointer detection

Wang, Jian J posted 2 patches 1 week ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c   | 5 +++++
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++
MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c  | 4 ++++
3 files changed, 13 insertions(+)

[edk2-devel] [PATCH 0/2] Reserve page 0 for NULL pointer detection

Posted by Wang, Jian J 1 week ago
When a boot loader examines the memory map, it can see that location 0
is available memory. If it chooses to use that memory, and
PcdNullPointerDetectionPropertyMask is enabled, use of memory in page 0
will cause an exception. This does occur when running the memtest86
program.

Leaving page 0 available is for legacy support purpose. Since we have
deprecated the support of legacy, the solution is just reserving it so
that it cannot be allocated for other uses.

Tests:
  - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x03
  - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x83
  - boot OVMF into Windows 7 with PcdNullPointerDetectionPropertyMask set to 0x83 

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1885
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>

Jian J Wang (2):
  MdeModulePkg/DxeIplPeim: reserve page 0 for NULL pointer detection
  MdeModulePkg/Core/Dxe: free page 0 after disabling NULL pointer
    detection

 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c   | 5 +++++
 MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++
 MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c  | 4 ++++
 3 files changed, 13 insertions(+)

-- 
2.17.1.windows.2


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

View/Reply Online (#50060): https://edk2.groups.io/g/devel/message/50060
Mute This Topic: https://groups.io/mt/44036050/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/2] Reserve page 0 for NULL pointer detection

Posted by Ni, Ray 1 week ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Wang, Jian J <jian.j.wang@intel.com>
> Sent: Wednesday, November 6, 2019 9:14 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
> Subject: [PATCH 0/2] Reserve page 0 for NULL pointer detection
> 
> When a boot loader examines the memory map, it can see that location 0
> is available memory. If it chooses to use that memory, and
> PcdNullPointerDetectionPropertyMask is enabled, use of memory in page 0
> will cause an exception. This does occur when running the memtest86
> program.
> 
> Leaving page 0 available is for legacy support purpose. Since we have
> deprecated the support of legacy, the solution is just reserving it so
> that it cannot be allocated for other uses.
> 
> Tests:
>   - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x03
>   - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x83
>   - boot OVMF into Windows 7 with PcdNullPointerDetectionPropertyMask set to 0x83
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1885
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> 
> Jian J Wang (2):
>   MdeModulePkg/DxeIplPeim: reserve page 0 for NULL pointer detection
>   MdeModulePkg/Core/Dxe: free page 0 after disabling NULL pointer
>     detection
> 
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c   | 5 +++++
>  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++
>  MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c  | 4 ++++
>  3 files changed, 13 insertions(+)
> 
> --
> 2.17.1.windows.2


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

View/Reply Online (#50151): https://edk2.groups.io/g/devel/message/50151
Mute This Topic: https://groups.io/mt/44036050/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH 0/2] Reserve page 0 for NULL pointer detection

Posted by Wang, Jian J 1 week ago
Pushed at fb92fe9e1817a53ca0fc985447f3c534201a62fa

Regards,
Jian

> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Thursday, November 07, 2019 10:11 AM
> To: Wang, Jian J <jian.j.wang@intel.com>; 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>; Sean Brogan <sean.brogan@microsoft.com>
> Subject: RE: [PATCH 0/2] Reserve page 0 for NULL pointer detection
> 
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> 
> > -----Original Message-----
> > From: Wang, Jian J <jian.j.wang@intel.com>
> > Sent: Wednesday, November 6, 2019 9:14 PM
> > To: devel@edk2.groups.io
> > Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Wu, Hao A
> > <hao.a.wu@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
> > Subject: [PATCH 0/2] Reserve page 0 for NULL pointer detection
> >
> > When a boot loader examines the memory map, it can see that location 0
> > is available memory. If it chooses to use that memory, and
> > PcdNullPointerDetectionPropertyMask is enabled, use of memory in page 0
> > will cause an exception. This does occur when running the memtest86
> > program.
> >
> > Leaving page 0 available is for legacy support purpose. Since we have
> > deprecated the support of legacy, the solution is just reserving it so
> > that it cannot be allocated for other uses.
> >
> > Tests:
> >   - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x03
> >   - run memtest86 with PcdNullPointerDetectionPropertyMask set to 0x83
> >   - boot OVMF into Windows 7 with PcdNullPointerDetectionPropertyMask set
> to 0x83
> >
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1885
> > Cc: Dandan Bi <dandan.bi@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Sean Brogan <sean.brogan@microsoft.com>
> >
> > Jian J Wang (2):
> >   MdeModulePkg/DxeIplPeim: reserve page 0 for NULL pointer detection
> >   MdeModulePkg/Core/Dxe: free page 0 after disabling NULL pointer
> >     detection
> >
> >  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c   | 5 +++++
> >  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 4 ++++
> >  MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c  | 4 ++++
> >  3 files changed, 13 insertions(+)
> >
> > --
> > 2.17.1.windows.2


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

View/Reply Online (#50316): https://edk2.groups.io/g/devel/message/50316
Mute This Topic: https://groups.io/mt/44036050/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-