From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, gaoliming@byosoft.com.cn
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Subject: Re: [edk2-devel] [PATCH] MdePkg BasePeCoffLib: Ignore the debug entry read error after it is found
Date: Thu, 27 Apr 2023 15:47:11 +0100 [thread overview]
Message-ID: <CAMj1kXEBHHY1XkihZiVG1qAP=RM6mbVR6NxUg0CttpKkOM7V0A@mail.gmail.com> (raw)
In-Reply-To: <20230427061714.510-1-gaoliming@byosoft.com.cn>
On Thu, 27 Apr 2023 at 07:17, gaoliming via groups.io
<gaoliming=byosoft.com.cn@groups.io> wrote:
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4425
>
> This change is to support the pre-built EFI image on the old Edk2 code.
> Old Edk2 GenFw tool generates the wrong debug entry in EFI image.
> Those pre-built images can be loaded before d6457b309.
>
> Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
> MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> index 4b71176a0c..4636842eeb 100644
> --- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> +++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
> @@ -735,7 +735,7 @@ PeCoffLoaderGetImageInfo (
> &Size,
> &DebugEntry
> );
> - if (RETURN_ERROR (Status) || (Size != ReadSize)) {
> + if ((ImageContext->DebugDirectoryEntryRva == 0) && (RETURN_ERROR (Status) || (Size != ReadSize))) {
I'm not sure I understand how this fixes anything. Why is the
condition 'RVA == 0' significant here?
Would something like the below perhaps work as well?
--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
+++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
@@ -755,6 +755,17 @@ PeCoffLoaderGetImageInfo (
ImageContext->ImageSize += DebugEntry.SizeOfData;
}
+ //
+ // Implementations of GenFw before commit 60e85a39fe49071 will
+ // concatenate the debug directory entry and the codeview entry,
+ // and erroneously put the combined size into the debug directory
+ // entry's size field. If this is the case, no other relevant
+ // directory entries can exist, and we can terminate here.
+ //
+ if (DebugEntry.FileOffset ==
(DebugDirectoryEntryFileOffset + Index)) {
+ break;
+ }
+
continue;
}
next prev parent reply other threads:[~2023-04-27 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 6:17 [PATCH] MdePkg BasePeCoffLib: Ignore the debug entry read error after it is found gaoliming
2023-04-27 14:47 ` Ard Biesheuvel [this message]
2023-04-28 6:02 ` 回复: [edk2-devel] " gaoliming
2023-04-28 9:20 ` Ard Biesheuvel
2023-05-04 7:49 ` 回复: " gaoliming
2023-05-04 14:15 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMj1kXEBHHY1XkihZiVG1qAP=RM6mbVR6NxUg0CttpKkOM7V0A@mail.gmail.com' \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox