U-boot Archive mirror
 help / color / mirror / Atom feed
From: Raymond Mao <raymond.mao@linaro.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>,  Simon Glass <sjg@chromium.org>,
	Igor Opaniuk <igor.opaniuk@gmail.com>,
	 Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Ralph Siemsen <ralph.siemsen@linaro.org>,
	 Masahisa Kojima <kojima.masahisa@socionext.com>,
	Eddie James <eajames@linux.ibm.com>
Subject: Re: [PATCH 4/4] arm: EFI linker script text section alignment
Date: Fri, 10 May 2024 12:32:12 -0400	[thread overview]
Message-ID: <CAEfUkUJC7S+cwebJqh+TvbjYE6nEnczKwYELHYeN5iXBxoCpMw@mail.gmail.com> (raw)
In-Reply-To: <CAC_iWjL+kbQLG=QwBGfrcRpFU3bhCCcyXLCtwxdY86JcC=0Kmg@mail.gmail.com>

Hi Ilias,

On Thu, 9 May 2024 at 14:15, Ilias Apalodimas <ilias.apalodimas@linaro.org>
wrote:

> Hi Raymond,
>
> Try not to post the same patches without the fixes that were asked
> [0], at least not without an explanation.
>
> On Thu, 9 May 2024 at 17:38, Raymond Mao <raymond.mao@linaro.org> wrote:
> >
> > Add text section alignment to fix sbsign signing warning
> > 'gaps in the section table may result in different checksums'
> > which causes a failure of efi_image_verify_diges()
> >
> > Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> > ---
> >  arch/arm/lib/elf_aarch64_efi.lds | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/lib/elf_aarch64_efi.lds
> b/arch/arm/lib/elf_aarch64_efi.lds
> > index 5dd98091698..bffd9a0447a 100644
> > --- a/arch/arm/lib/elf_aarch64_efi.lds
> > +++ b/arch/arm/lib/elf_aarch64_efi.lds
> > @@ -28,6 +28,7 @@ SECTIONS
> >                 *(.dynamic);
> >                 . = ALIGN(512);
> >         }
> > +       . = ALIGN(4096);
>
> This is not what you want. There's already an ALIGN a few lines below
> and you must include the symbols for _etext and _text_size.
> You have to move the rela.* sections after the alignment. IIRC those
> were inspired by [1], so you can look for guidance there.
> On top of that riscv will need similar fixes (and any other
> architecture that uses those)
>
> In practice, I have to add  ALIGN(4096) for both `.rela.*` and `.data`,
otherwise it always prompts warning when signing the EFI image as
below and finally leads a failure when calling function
`efi_image_verify_digest()`.

```
warning: gap in section table:
    .text   : 0x00001000 - 0x00001c00,
    .data   : 0x00002000 - 0x00002200,
gaps in the section table may result in different checksums
warning: data remaining[7680 vs 12720]: gaps between PE/COFF sections?
```

I am not sure if RISC-V is working, never tried to build with that.
But arm32, x86 should be fine - they don't have the `.rela.*` sections and
text and data sections are well aligned.


> >         .rela.dyn : { *(.rela.dyn) }
> >         .rela.plt : { *(.rela.plt) }
> >         .rela.got : { *(.rela.got) }
> > --
> > 2.25.1
> >
>
> [0]
> https://lore.kernel.org/u-boot/CAC_iWjK+14L6mEi8GQN-McF-SChvhnjJ79nE1tWLV+kgWZKVew@mail.gmail.com/
> [1] https://git.code.sf.net/p/gnu-efi/code
>
>
Regards,
Raymond

      reply	other threads:[~2024-05-10 16:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 14:37 [PATCH 0/4] Clean-up patch set for MbedTLS integration Raymond Mao
2024-05-09 14:37 ` [PATCH 1/4] image: remove redundant hash includes Raymond Mao
2024-05-09 14:53   ` Tom Rini
2024-05-09 16:17     ` Ilias Apalodimas
2024-05-09 14:37 ` [PATCH 2/4] efi_loader: " Raymond Mao
2024-05-09 14:53   ` Tom Rini
2024-05-09 18:03   ` Ilias Apalodimas
2024-05-09 14:37 ` [PATCH 3/4] md5: Use typedef for MD5 context Raymond Mao
2024-05-09 14:53   ` Tom Rini
2024-05-09 16:17   ` Ilias Apalodimas
2024-05-09 14:37 ` [PATCH 4/4] arm: EFI linker script text section alignment Raymond Mao
2024-05-09 18:15   ` Ilias Apalodimas
2024-05-10 16:32     ` Raymond Mao [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-all 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=CAEfUkUJC7S+cwebJqh+TvbjYE6nEnczKwYELHYeN5iXBxoCpMw@mail.gmail.com \
    --to=raymond.mao@linaro.org \
    --cc=eajames@linux.ibm.com \
    --cc=igor.opaniuk@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kojima.masahisa@socionext.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=ralph.siemsen@linaro.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).