public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guo Dong" <guo.dong@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Ma, Maurice" <maurice.ma@intel.com>,
	"You, Benjamin" <benjamin.you@intel.com>
Subject: Re: [PATCH 2/2] UefiPayloadPkg/PayloadLoader: Remove assertion
Date: Wed, 30 Jun 2021 04:29:56 +0000	[thread overview]
Message-ID: <BYAPR11MB362241CC53D80562BDE9638E9E019@BYAPR11MB3622.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210629062707.1855-3-ray.ni@intel.com>


Reviewed-by: Guo Dong <guo.dong@intel.com>

> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Monday, June 28, 2021 11:27 PM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Dong, Guo
> <guo.dong@intel.com>; You, Benjamin <benjamin.you@intel.com>
> Subject: [PATCH 2/2] UefiPayloadPkg/PayloadLoader: Remove assertion
> 
> For R_386_RELATIVE and R_X86_64_RELATIVE, today's logic assumes that
> the content pointed by the Rela->r_offset is 0 but it's not always
> TRUE. We observed that linker may set the content to Rela->r_addend.
> 
> The patch removes the assertion.
> There is no functionality impact for this patch.
> 
> Signed-off-by: Ray Ni <ray.ni@intel.com>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Guo Dong <guo.dong@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> ---
>  UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c | 1 -
>  UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
> b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
> index dd27d3ce59..780f2d9507 100644
> --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
> +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf32Lib.c
> @@ -164,7 +164,6 @@ ProcessRelocation32 (
>            // Calculation: B + A
> 
>            //
> 
>            if (RelaType == SHT_RELA) {
> 
> -            ASSERT (*Ptr == 0);
> 
>              *Ptr = (UINT32) Delta + Rela->r_addend;
> 
>            } else {
> 
>              //
> 
> diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> index 3f4f12903c..0f1b06e8cc 100644
> --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> @@ -173,7 +173,6 @@ ProcessRelocation64 (
>            // Calculation: B + A
> 
>            //
> 
>            if (RelaType == SHT_RELA) {
> 
> -            ASSERT (*Ptr == 0);
> 
>              *Ptr = Delta + Rela->r_addend;
> 
>            } else {
> 
>              //
> 
> --
> 2.31.1.windows.1


      reply	other threads:[~2021-06-30  4:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  6:27 [PATCH 0/2] Fix bugs in ELF loader logic Ni, Ray
2021-06-29  6:27 ` [PATCH 1/2] UefiPayloadPkg/PayloadLoader: Fix bug in locating relocation section Ni, Ray
2021-06-30  4:29   ` Guo Dong
2021-06-29  6:27 ` [PATCH 2/2] UefiPayloadPkg/PayloadLoader: Remove assertion Ni, Ray
2021-06-30  4:29   ` Guo Dong [this message]

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=BYAPR11MB362241CC53D80562BDE9638E9E019@BYAPR11MB3622.namprd11.prod.outlook.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