Linux-EFI Archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Mike Beaton <mjsbeaton@gmail.com>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>,
	Linux EFI <linux-efi@vger.kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ivan Hu <ivan.hu@canonical.com>,  Jeremy Kerr <jk@ozlabs.org>,
	Peter Jones <pjones@redhat.com>
Subject: Re: Broken section alignment in 6.7 and 6.8rc EFI stub
Date: Mon, 5 Feb 2024 08:59:02 +0100	[thread overview]
Message-ID: <CAMj1kXFTFjM3LjJk=M4ZcO7=vfFxSH2c_GPu3YpwByZkVknkcw@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXFyVKRg0DTTrZGPGfVPxqY5zsXbK+Sxp0GBid-msqe46w@mail.gmail.com>

On Mon, 5 Feb 2024 at 08:47, Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Mon, 5 Feb 2024 at 08:37, Mike Beaton <mjsbeaton@gmail.com> wrote:
> >
> > On Mon, 5 Feb 2024 at 02:06, Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> > >
> > > So v6.7 onwards misses .reloc section, right?
> > >
> > > Confused...
> >
> > Reloc info is still present as normal in data directories, e.g.
> > `llvm-objdump -p` shows NumberOfRvaAndSizes = 6. Reloc info is taken
> > from index 5 https://github.com/tianocore/edk2/blob/master/MdePkg/Include/IndustryStandard/PeImage.h#L128
> > . (I've been told a dummy .reloc section was dumped recently?)
> >
>
> So there are a couple of things going on here:
> - the .reloc section was indeed dropped because we could not find any
> evidence anywhere that the reason it was added is still valid;
> - the .compat section uses a non-1:1 RVA mapping, to avoid padding,
> but reading the PE/COFF spec again, I suppose this is not compliant.
>
> Note that objdump looks broken too, on an image I have locally, I get
>
> (llvm-readelf -a)
>
>   Section {
>     Number: 2
>     Name: .compat (2E 63 6F 6D 70 61 74 00)
>     VirtualSize: 0x8
>     VirtualAddress: 0xB82000
>     RawDataSize: 4096
>     PointerToRawData: 0x4000
>
> (objdump -h)
>
>   1 .compat       00000008  0000000000b82000  0000000000b82000  00004000  2**2
>                   CONTENTS, ALLOC, LOAD, READONLY, DATA
>
> So the .compat section is in the correct spot in the file view but not
> in the memory view.
>
> Given that the .setup section is not relevant to EFI boot anyway, we
> could try to use the same file mapping as the virtual mapping, and
> just split the content preceding .text across the .setup and .compat
> sections arbitrarily.
>
> Could you try the below?
>

OK, never mind - that violates the section alignment.

      reply	other threads:[~2024-02-05  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05  0:08 Broken section alignment in 6.7 and 6.8rc EFI stub Mike Beaton
2024-02-05  2:06 ` Bagas Sanjaya
2024-02-05  7:36   ` Mike Beaton
2024-02-05  7:47     ` Ard Biesheuvel
2024-02-05  7:59       ` Ard Biesheuvel [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='CAMj1kXFTFjM3LjJk=M4ZcO7=vfFxSH2c_GPu3YpwByZkVknkcw@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=bagasdotme@gmail.com \
    --cc=ivan.hu@canonical.com \
    --cc=jk@ozlabs.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjsbeaton@gmail.com \
    --cc=pjones@redhat.com \
    /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).