* [PATCH 1/1] MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex
@ 2022-01-21 12:58 Gerd Hoffmann
2022-01-28 5:24 ` 回复: [edk2-devel] " gaoliming
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2022-01-21 12:58 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Pawel Polawski, Jian J Wang, Liming Gao, Gerd Hoffmann
When setting mVirtualMap to NULL also set mVirtualMapMaxIndex to 0.
Without that RuntimeDriverConvertPointer() will go search the ZeroPage
for EFI_MEMORY_DESCRIPTOR entries.
In case mVirtualMapMaxIndex happens to be small small enough that'll go
unnoticed, the search will not find anything and EFI_NOT_FOUND will be
returned.
In case mVirtualMapMaxIndex is big enough the search will reach the end
of the ZeroPage and trigger a page fault.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
MdeModulePkg/Core/RuntimeDxe/Runtime.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
index 2a541408731d..de8f2bfce0f8 100644
--- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c
+++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
@@ -365,7 +365,8 @@ RuntimeDriverSetVirtualAddressMap (
//
// mVirtualMap is only valid during SetVirtualAddressMap() call
//
- mVirtualMap = NULL;
+ mVirtualMap = NULL;
+ mVirtualMapMaxIndex = 0;
return EFI_SUCCESS;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* 回复: [edk2-devel] [PATCH 1/1] MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex
2022-01-21 12:58 [PATCH 1/1] MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex Gerd Hoffmann
@ 2022-01-28 5:24 ` gaoliming
0 siblings, 0 replies; 2+ messages in thread
From: gaoliming @ 2022-01-28 5:24 UTC (permalink / raw)
To: devel, kraxel
Cc: 'Dandan Bi', 'Pawel Polawski',
'Jian J Wang'
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gerd
> Hoffmann
> 发送时间: 2022年1月21日 20:59
> 收件人: devel@edk2.groups.io
> 抄送: Dandan Bi <dandan.bi@intel.com>; Pawel Polawski
> <ppolawsk@redhat.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Gerd Hoffmann <kraxel@redhat.com>
> 主题: [edk2-devel] [PATCH 1/1] MdeModulePkg/RuntimeDxe: clear
> mVirtualMapMaxIndex
>
> When setting mVirtualMap to NULL also set mVirtualMapMaxIndex to 0.
> Without that RuntimeDriverConvertPointer() will go search the ZeroPage
> for EFI_MEMORY_DESCRIPTOR entries.
>
> In case mVirtualMapMaxIndex happens to be small small enough that'll go
> unnoticed, the search will not find anything and EFI_NOT_FOUND will be
> returned.
>
> In case mVirtualMapMaxIndex is big enough the search will reach the end
> of the ZeroPage and trigger a page fault.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> MdeModulePkg/Core/RuntimeDxe/Runtime.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c
> b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
> index 2a541408731d..de8f2bfce0f8 100644
> --- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c
> +++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
> @@ -365,7 +365,8 @@ RuntimeDriverSetVirtualAddressMap (
> //
> // mVirtualMap is only valid during SetVirtualAddressMap() call
> //
> - mVirtualMap = NULL;
> + mVirtualMap = NULL;
> + mVirtualMapMaxIndex = 0;
>
> return EFI_SUCCESS;
> }
> --
> 2.34.1
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-28 5:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 12:58 [PATCH 1/1] MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex Gerd Hoffmann
2022-01-28 5:24 ` 回复: [edk2-devel] " gaoliming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox