[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [edk2] [PATCH 3/7] HACK: HobLib: workaround infinite lo
From: |
Andrew Fish |
Subject: |
Re: [Qemu-devel] [edk2] [PATCH 3/7] HACK: HobLib: workaround infinite loop |
Date: |
Fri, 23 Feb 2018 11:45:28 -0800 |
> On Feb 23, 2018, at 5:23 AM, address@hidden wrote:
>
> From: Marc-André Lureau <address@hidden>
>
> Without this hack, GetNextHob() loops infinitely with the next patch.
> I don't understand the reason.
>
> The loop is triggered by the GetFirstGuidHob (&gTpmErrorHobGuid) call.
>
> CC: Laszlo Ersek <address@hidden>
> CC: Stefan Berger <address@hidden>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> MdePkg/Library/PeiHobLib/HobLib.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/MdePkg/Library/PeiHobLib/HobLib.c
> b/MdePkg/Library/PeiHobLib/HobLib.c
> index 5c0eeb992f..ed3c5fbd6d 100644
> --- a/MdePkg/Library/PeiHobLib/HobLib.c
> +++ b/MdePkg/Library/PeiHobLib/HobLib.c
> @@ -89,6 +89,10 @@ GetNextHob (
> if (Hob.Header->HobType == Type) {
> return Hob.Raw;
> }
> + if (GET_HOB_LENGTH (HobStart) == 0) {
As Laszlo points out this error condition is likely memory corruption. Thus it
would be better to check for all know illegal values?
if (GET_HOB_LENGTH(HobStart) < sizeof (EFI_HOB_GENERIC_HEADER)
Thanks,
Andrew Fish
> + DEBUG ((DEBUG_INFO, "FIXME: GetNextHob length == 0"));
> + return NULL;
> + }
> Hob.Raw = GET_NEXT_HOB (Hob);
> }
> return NULL;
> --
> 2.16.1.73.g5832b7e9f2
>
> _______________________________________________
> edk2-devel mailing list
> address@hidden
> https://lists.01.org/mailman/listinfo/edk2-devel
- [Qemu-devel] [PATCH 0/7] RFC: ovmf: preliminary TPM2 support, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 2/7] ovmf: link with Tcg2ConfigPei module, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 4/7] ovmf: link with Tcg2Pei module, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 3/7] HACK: HobLib: workaround infinite loop, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 1/7] SecurityPkg/Tcg2Pei: drop Tcg2PhysicalPresenceLib dependency, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 5/7] ovmf: link with Tcg2Dxe module, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 6/7] ovmf: link with Tcg2ConfigDxe module, marcandre . lureau, 2018/02/23
- [Qemu-devel] [PATCH 7/7] ovmf: add DxeTpm2MeasureBootLib, marcandre . lureau, 2018/02/23
- Re: [Qemu-devel] [edk2] [PATCH 0/7] RFC: ovmf: preliminary TPM2 support, Laszlo Ersek, 2018/02/23