qemu-devel
[Top][All Lists]
Advanced

[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: Marc-André Lureau
Subject: Re: [Qemu-devel] [edk2] [PATCH 3/7] HACK: HobLib: workaround infinite loop
Date: Mon, 5 Mar 2018 15:05:43 +0100

Hi

On Fri, Feb 23, 2018 at 8:45 PM, Andrew Fish <address@hidden> wrote:
>
>
>> 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, I have adjusted the check.

With manual calls and printf (I don't know  a better way to debug ovmf
;), I try to locate the issue. It's somehow related to
RegisterForShadow(). The "corruption" seems to happen during the
second call. After the
PeiLoadImage(...,PEIM_STATE_REGISTER_FOR_SHADOW,..), right before
calling PeimEntryPoint(), a GetFirstGuidHob() succeed, but inside the
function, it fails (with the same arguments). Right after it succeeds
again... The PeimEntryPoint() is not the Tcg2Pei:PeimEntryMA(), I
suppose there is some kind of wrapping code, but I fail to find where.
Any idea?

thanks for your help

-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]