public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Feng, YunhuaX" <yunhuax.feng@intel.com>
Subject: Re: [Patch] BaseTools: Check elf sections alignment with MAX_COFF_ALIGNMENT
Date: Fri, 8 Jun 2018 03:38:30 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E294A13@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1528336951-6212-1-git-send-email-yonghong.zhu@intel.com>

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Thursday, June 7, 2018 10:03 AM
> To: edk2-devel@lists.01.org
> Cc: Feng, YunhuaX <yunhuax.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [Patch] BaseTools: Check elf sections alignment with MAX_COFF_ALIGNMENT
> 
> From: Yunhua Feng <yunhuax.feng@intel.com>
> 
> Add the logic to check whether mCoffAlignment is larger than
> MAX_COFF_ALIGNMENT, and report error for it.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Yonghong Zhu <yonghong.zhu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  BaseTools/Source/C/GenFw/Elf32Convert.c | 10 +++++++++-
>  BaseTools/Source/C/GenFw/Elf64Convert.c | 11 ++++++++++-
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
> index 14fe4a2..e0f6491 100644
> --- a/BaseTools/Source/C/GenFw/Elf32Convert.c
> +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
> @@ -1,9 +1,9 @@
>  /** @file
>  Elf32 Convert solution
> 
> -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
>  Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
> 
>  This program and the accompanying materials are licensed and made available
>  under the terms and conditions of the BSD License which accompanies this
>  distribution.  The full text of the license may be found at
> @@ -382,10 +382,18 @@ ScanSections32 (
>        mCoffAlignment = (UINT32)shdr->sh_addralign;
>      }
>    }
> 
>    //
> +  // Check if mCoffAlignment larger than MAX_COFF_ALIGNMENT
> +  //
> +  if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
> +    Error (NULL, 0, 3000, "Invalid", "Section alignment larger than MAX_COFF_ALIGNMENT.");
> +    assert (FALSE);
> +  }
> +
> +  //
>    // Move the PE/COFF header right before the first section. This will help us
>    // save space when converting to TE.
>    //
>    if (mCoffAlignment > mCoffOffset) {
>      mNtHdrOffset += mCoffAlignment - mCoffOffset;
> diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
> index c39bdff..9e68d22 100644
> --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
> +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
> @@ -1,9 +1,9 @@
>  /** @file
>  Elf64 convert solution
> 
> -Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
>  Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
> 
>  This program and the accompanying materials are licensed and made available
>  under the terms and conditions of the BSD License which accompanies this
>  distribution.  The full text of the license may be found at
> @@ -375,10 +375,19 @@ ScanSections64 (
>        mCoffAlignment = (UINT32)shdr->sh_addralign;
>      }
>    }
> 
>    //
> +  // Check if mCoffAlignment larger than MAX_COFF_ALIGNMENT
> +  //
> +  if (mCoffAlignment > MAX_COFF_ALIGNMENT) {
> +    Error (NULL, 0, 3000, "Invalid", "Section alignment larger than MAX_COFF_ALIGNMENT.");
> +    assert (FALSE);
> +  }
> +
> +
> +  //
>    // Move the PE/COFF header right before the first section. This will help us
>    // save space when converting to TE.
>    //
>    if (mCoffAlignment > mCoffOffset) {
>      mNtHdrOffset += mCoffAlignment - mCoffOffset;
> --
> 2.6.1.windows.1



      reply	other threads:[~2018-06-08  3:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07  2:02 [Patch] BaseTools: Check elf sections alignment with MAX_COFF_ALIGNMENT Yonghong Zhu
2018-06-08  3:38 ` Gao, Liming [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=4A89E2EF3DFEDB4C8BFDE51014F606A14E294A13@SHSMSX104.ccr.corp.intel.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